Wasm Prez

I presented at voxxed days last week. Here is the talk I gave, video coming when it’s published.


testing mozilla iot gateway

Mozilla iot gateway Here is what I am going to setup. I am obviously not going to rewrite one more time the tutorial and docs from mozilla. I will simply describe the specific setup I used, and the little things I setup to make it work. Prerequisites Raspberry pi 3b Zigbee dongle, zwave dongle list of compatible hardware - I used Digi XStick (ZB mesh version) and Aeotec Z-Stick (Gen5) Zigbee Smart bulb (i used a philips hue), zigbee motion detector (I used philips motion sensor) Linux I used my favorite lean alpine linux, with the setup as I explained in this post minus the complexity brought up by the rpi0.

   alpine, docker, iot, zwave, zigbee, mozilla-iot-gateway

cross compiling rust from linux to rpi0/alpine

If you read my previous posts, you should now have a raspberry-pi running alpine and docker. Resources are pretty limited on rpi0, so we are going to deploy programs using rust. Note: golang could have fit in there as well (and ofc all C and close to machine languages). Compiling from NOT a rpi0 Obviously, you don’t want to compile from a raspberry pi zero, unless you have all the time in the world and love waiting.

   linux, alpine, rpi, rpi0, rust, cross compilation

installing docker on alpine linux

Prerequisites One raspberry pi zero W One sd card Enable all cgroups On you local linux, mount the partition containing alpine files. In the cmdline.txt, add the following: echo -ne " cgroup_enable=memory cgroup_enable=cpuset swapaccount=1" >> /run/media/youruser/xxx/cmdline.txt Docker needs all cgroups enabled, so this will do the trick On you rpi0 As simple as: sudo apk add docker sudo rc-update add docker boot sudo rc-service docker start To make sure your docker env doesn’t go in memory (512MB RAM won’t bring you far…), set it on mmcblk0p3 by editing /etc/docker/daemon.

   linux, alpine, rpi, rpi0, docker

installing alpine linux on rpi0

Prerequisites One raspberry pi zero W One sd card Download Alpine linux We’ll use the almost latest version: 3.9.2 (3.9.3 would not work for some reason) The one to use for RPI is the raspberry pi (surprising :P) armhf. On your local computer (assuming you re using linux) Mount the sdcard (should be automated, if not, you probably know how to do that and you probably don’t need that tutorial)

   linux, alpine, rpi, rpi0

golang binaries

Embedding anything in a golang binary What is it about? One good thing about golang is that you compile everything to a binary. So easy to deploy, so easy to manage, so small. But what happens when you need to embed files in there? Migration files, static files, whatever you can think of? Well, you can simply deploy it in a container, add this files, you are going to say, and you are probably right, that’s imho, the cleanest solution.


a taste of wasm

Here it is, go 1.11 is out, and with it a new compilation target, Web Assembly! Let’s try it out! The test As dumb as it sounds, I needed a simple usecase to test this out. I decided to settle for the dumbest possible thing: a for loop incrementing a variable for 100000000 times. The git repo Here it is I uploaded it as well on surge for you to see without the hassle

   wasm, golang

Using GKE with multiple accounts and clusters

Google cloud configs Download and install gcloud Simply follow this link Listing existing configurations gcloud config configurations list NAME IS_ACTIVE ACCOUNT PROJECT DEFAULT_ZONE DEFAULT_REGION This should give you only one line, with a default account. Creating a configuration gcloud config configurations create testconf This will guide you through the configuration of a new configuration. It allows you to set one config per account, project, cluster… Activating a configuration gcloud config configurations activate testconf As simple as this to change your account/config.

   kubernetes, GKE, gcloud, googlecloud

Bluetooth activation at startup on arch linux

Why? You might not have reach that point yet but bluez has been deprecating hciconfig and other tools. In bluez 5.44, it’s not there anymore. What is the problem? All hciconfig udev rules to activate bluetooth at startup won’t work anymore. Most forum posts solving bluetooth issues are now outdated. Once I updated to bluez 5.44, my service leveraging hciconfig to activate bluetooth at startup didn’t work anymore! What is the solution?

   archlinux, bluetooth

Golang and Oracle

Which library To this day, the most up to date library seems to be rana/ora How to install (linux & macosx) Download Oracle Instant Client for linux x64: both packages Basic and SDK Unzip each of them in the same folder /opt/oracle mkdir -p /opt/oracle cd /opt/oracle unzip ~/Downloads/instantclient-basiclite-linux.x64- unzip ~/Downloads/instantclient-sdk-linux.x64- cd /opt/oracle/instantclient_12_1 Add the necessary env variables and paths: # Oracle export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/opt/oracle export ORACLE_HOME=$LD_LIBRARY_PATH copy from the go package .

   golang, oracle, linux, macosx, sql