Understanding golang channel range... again

In a previous article, I tried to explain my understanding of go channels interaction with ranges. Turns out my explanation was probably not clear enough because here I am, nearly a year after, struggling to achieve pretty much the same exercise. So here we go again, on a good old trial and error fashion progress. The goal here is to retrieve channel messages that are pushed from go routines created in a for loop.

proof-of-work based blockchain explained with golang

Yet another “blockchain explained” article, I know, I really thought about if releasing it or not, but you know, you only understand what you can explain clearly, so I hope I'll be able to explain proof of work and blockchain as clearly as it is clear in my mind. The originality of this post is that I'll try to make those concepts clear through pieces of code extensively explained so it doesn't feel like a theoretical expose where you get the idea without the taste.

Replacing a (silently) failing disk in a ZFS pool

Maybe I can't read, but I have the feeling that official documentations explain every single corner case for a given tool, except the one you will actually need. My today's struggle: replacing a disk within a FreeBSD ZFS pool. What? there's a shitton of docs on this topic! Are you stupid? I don't know, maybe. Yet none covered the process in a simple, straight and complete manner. Here's the story:

golang reflection tips

Because I'm the kind of person who likes genericity, I often find myself using features of languages that are flagged as “only use it if you know what you're doing”. Golang reflection is one of those features, powerful yet a bit confusing. Reflection, as explained in The Laws of Reflection is the ability of a program to examine its own structure, particularly through types; it's a form of metaprogramming In short, you can introspect variables at run-time, making your program exceptionally dynamic.

Cleaner micro Kubernetes on OSX

While my main workstation is a Linux Mint machine, I occasionally use my OSX ${WORK} laptop for traveling and composing. I'm not really fond of the OS, but at least it's an UNIX-like, and pkgin runs well with it ;) When I'm “on the go”, I like to try things and play along with technologies I'm currently obsessed with, among them Kubernetes. On OSX, the natural choice is to go with minikube, it's kind of integrated and does the job well, but if you tried it already and also happen to run docker for OSX you might have found yourself struggling with versions and consistency between the two.

Understanding golang channel range

Here we go again with my golang self teaching, today with a topic I had hard time understanding correctly (and hope I actually did): range over channels along with goroutines. First of all, let's have a little reminder. We all know a goroutine live its own life and must be waited for at the main level, i.e. in this example: package main import "fmt" func main() { go func() { fmt.

CPU temperature collectd report on NetBSD

pkgsrc's collectd does not support the thermal plugin, so in order to publish thermal information I had to use the exec plugin: LoadPlugin exec # more plugins <Plugin exec> Exec "nobody:nogroup" "/home/imil/bin/temp.sh" </Plugin> And write this simple script that reads CPUs temperature from NetBSD's envstat command: $ cat bin/temp.sh #!/bin/sh hostname=$(hostname) interval=10 while : do envstat|awk '/cpu[0-9]/ {printf "%s %s\n",$1,$3}'|while read c t do echo "PUTVAL ${hostname}/temperature/temperature-zone${c#cpu}interval=${interval}N:${t%%.*}" done sleep ${interval} done I then send those values to an influxdb server:


Here's a simple solution in order to forward GRE tunnels to a server, or here a virtual machine, which is located behind a GNU/Linux gateway: # iptables -t nat -A PREROUTING -i eth0 -p gre -j DNAT --to-destination # modprobe nf_conntrack_proto_gre No need for complex PREROUTING / POSTROUTING / FORWARD combinations as I could read here and there. In my case, the virtual machine is a NetBSD domU where I created the following gre(4) interface:

NetBSD/amd64 7.0 on kvm

If you recently tried to install NetBSD 7.0 using Linux KVM you might have encountered the following failure: This bug have been recently fixed on the 7-branch but the official ISO images are not yet updated, so you'll have to use NetBSD daily builds mini-ISO which includes Christos fix to bus_dma.c For the record, here's the virt-install command I use: sudo virt-install --virt-type kvm --name korriban --ram 4096 --disk path=/dev/vms/korriban,bus=virtio --vcpus 2 --network bridge:br0,model=virtio --graphics vnc --accelerate --noautoconsole --cdrom /home/imil/iso/boot.