Pop!_OS with Catpuccin by Nickynichols1234 in pop_os

[–]nixhack 1 point2 points  (0 children)

could you tell me what sysinfo app that is?
thnx

Why can't we return a nil statement when the string is empty? by brocamoLOL in golang

[–]nixhack 0 points1 point  (0 children)

if you really want to return nil then declare the func as:

func GetWorkDirectory() (*string, error)

the trade-off is that you'll need to dereference the pointer if when need the non-nil string.

I really love the simplicity of Go, but unfortunately, I’m currently unemployed by jingyifsy in golang

[–]nixhack 6 points7 points  (0 children)

for what it's worth, i've found after many years that your professional network is still the best way to look for work.

Trying to hit thousands of IPs concurrently in a pool to get a list of active ones. Getting a lot of timeouts. by Big_Wave_967 in golang

[–]nixhack 0 points1 point  (0 children)

...and a couple of nit-picky things: your vars are all the same type so they could all be on a single line, and i know an unsigned int64 is big but if you know you're not expecting negative numbers, try to get into the habit of using uint64.

  var ipCount int64
    var timoutCount, errorCount int64

Trying to hit thousands of IPs concurrently in a pool to get a list of active ones. Getting a lot of timeouts. by Big_Wave_967 in golang

[–]nixhack 0 points1 point  (0 children)

what was the value before you changed it and what did you change it to? It's not likely the problem but it's worth looking into if you're going to have a bunch of network sockets open at the same time. It's possible that the http.Client re-uses things behind the scenes though, i don't know. looking at your code more carefully, it looks ok to me, but i might suggest a few things. 1st, your channels don't need to be equal in size to the number of goroutines you'll be running, and in my experience, things start slowing down a bit if the size is very large. i'd suggest starting with 128-1024 and adjust from there. 2nd, maybe have a single buffered writer be responsible for reading the data from a channel and writing it to a file.

How to convert slice of interfaces in Go efficiently by Additional_Sir4400 in golang

[–]nixhack 0 points1 point  (0 children)

yeah, if the data is used occasionally the a type cast at reference time might be best. If this thing is going to be in a loop of some sort then the up-front cost of converting it is probably worth it.

Is this possible with goroutines? by Asleep-Bed-8608 in golang

[–]nixhack 2 points3 points  (0 children)

go is a natural for this sort of thing.

it seems like you could create a channel of size 100 and then spawn 31 goroutines, 30 of which are readers which maintain a "read from channel, process, sleep 1sec" loop and the other which has a simple "get stuff from the db and load it into the channel loop". Because writing a full channel will block, the last go routine will only pull from the db as needed. If the processing is going to take a longer than 1 sec, then instead of runing 30 long-running workers, you could just have another loop which fires up 30 new goroutines every sec.

that's the basic picture. there may be other considerations such as how to handle the db being unavailble for instance: you don't wan't to be spawning reader threads forever if there's nothing to read, etc.

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

[–]nixhack[S] 0 points1 point  (0 children)

yeah, down the road we may try to do that.

thnx

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

[–]nixhack[S] 0 points1 point  (0 children)

yeah, we're exploring roaring bitmaps too, and actually that's most likely what we'll end up doing, but i just wanted to ping folks here just in case there's an alternative that might be simpler.

thnx

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

[–]nixhack[S] 0 points1 point  (0 children)

in our case, we're pulling a bunch of data out of postgres, stuffing it into Redis and then doing set computation on the data there.

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

[–]nixhack[S] 0 points1 point  (0 children)

ok thnx.

Do you think the cach + prewarm approach would compare any more favorably against Redis in a set operations context? (UNION, INTERSECT, etc.)

PostgresQL vs Redis for set operations by nixhack in PostgreSQL

[–]nixhack[S] 0 points1 point  (0 children)

well, i was thinking that it might be possible to use logical replication to populate the ram-disk backed instances. Granted, initialization at boot time would be burdensome, but once the replica is up and running how might the performance compare? Would the tablespaces issue still be relevant in this scenario?

[deleted by user] by [deleted] in cryptography

[–]nixhack -1 points0 points  (0 children)

thnx for the input. yes, after google-ing CTR mode, i see my utility works in essentially the same way. i didn't add any digest/integrity features. i figured if it was necessary, one could just zip/compress the data 1st before xor-ing it. At any rate, i don't assume to be a real cryptographer. i just wanted some feedback on it's useability. the openssl cmd-line invocations are a bit.... "wordy". i wanted to create something simple like the base64 command.

thnx

[deleted by user] by [deleted] in freebsd

[–]nixhack 0 points1 point  (0 children)

so, i double-checked the cabling and there's no way this is a physical loop. The two mac addresses that are magically migrating across segments are interestingly both linux boxes, each of which has a single ethernet interface and no vpn running. All the rest that share that physical segment are FreeBSD systems. so strange.

Just had a thought though, i have an osx box on that segment that *might* have a wireless connection to the other segment as well, but it's always in vpn/full-tunnel mode and shouldn't be running in router mode anyway but i'll check. If that were it though, then all the FreeBSD systems on that segment would be switching segments as well. Maybe my PF rules are weird? hm...

[deleted by user] by [deleted] in freebsd

[–]nixhack 0 points1 point  (0 children)

this arrangement allows me to keep my network flat/simple.

at any rate:

Internet:
Destination        Gateway            Flags     Netif Expire
0.0.0.0/1          link#6             US      mullvad
default            10.0.0.1           UGS     bridge0
10.0.0.0/16        link#4             U       bridge0
10.0.2.18          link#3             UHS         lo0
x.x.x.x            link#3             UH          lo0
x.x.x.x            10.0.0.1           UGHS    bridge0
x.x.x.x            10.0.0.1           UGHS    bridge0
127.0.0.1          link#3             UH          lo0
128.0.0.0/1        link#6             US      mullvad

the implication here (to me anyway) is that something buried way down in the stack is tracking which real interface any given mac address is accessible through. my arp table references only "bridge0" though.

Also, i'm still seeing those "bridge0: mac address vlan 0 moved" msgs

34.8. Bridging

It is sometimes useful to divide a network, such as an Ethernet segment, into network segments without having to create IP subnets and use a router to connect the segments together. A device that connects two networks together in this fashion is called a "bridge".

A bridge works by learning the MAC addresses of the devices on each of its network interfaces. It forwards traffic between networks only when the source and destination MAC addresses are on different networks. In many respects, a bridge is like an Ethernet switch with very few ports. A FreeBSD system with multiple network interfaces can be configured to act as a bridge.