Wifi signal strength in oh-my-zsh

I recently switched theme in oh-my-zsh to powerlevel9k while the docs cover most things the wifi signal example was Linux only so I modified it to work on MacOS (only tested on Sierra) and modified to use nerd-fonts as its not the same unicode as in the docs example.

zsh_wifi_signal(){
    local signal=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI | awk '{print $2}')
    local color='%F{yellow}'
    [[ $signal -gt -60 ]] && color='%F{green}'
    [[ $signal -lt -70 ]] && color='%F{red}'
    echo -n "%{$color%}\uf424 %{%f%}"
}

POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="black"

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status custom_wifi_signal load disk_usage battery)

POWERLEVEL9K_MODE='nerdfont-complete'

So with that in my .zshrc my prompt looks like this right now everything

Nodeunit and Proxies

With ES6 in javascript we get a lot of cool things to make it a proper programming language, fun stuff like Proxy.

Recently I found a nice use for Proxies when writing tests however the nodeunit runner doesn’t support the –harmony-proxies parameter a small runner was created to allow us to run tests with working Proxy support. Just create a small script that looks something like this.

const reporter = require('nodeunit').reporters.minimal;
let args = process.argv;
args.splice(0,2);
reporter.run(args);

And invoke it using:
node --harmony-proxies runtests.js $(find ./tests -name \*.js)

Yubikey & KeePass cross platform

A while back i got a Yubikey Neo and a Neo-n they are cool little devices that can work as the second part of a 2 factor authentication. The Neo apart from usb also supports Nfc so it can be used with most modern Android phones. So here’s a short summary of how to get it all working. To get everything to work you need to install the KeeChallenge plugin in KeePass, I used the latest version (2.29) when setting everything up. The trick is to put the password file on something shared that everything can read usb stick, Dropbox or similar.

KeePass on windows

For windows follow this guide. Don’t forget to copy the files from the YubiKey-Personalization release.

KeePass on OSX

On OSX the use following guide. A bit more hands on work but just follow the steps. Currently it seems like mono 4.0.2 doesn’t work so go with 4.0.1.

KeePass on Android

On android you need the Keepass2Android Password Safe and YubiChallenge and a phone that supports Nfc, most modern Android phones do.

iOS

Nope, return in a couple of years when iOS has working nfc support

Home monitoring and sensors

I like dashboards

everything So I built one using InfluxDB, Grafana, Nginx, Tellstick Net and a bunch of scripts. Here’s a breakdown of the parts and what feeds them.

Temperatures

At home i have a Tellstick Net and a bunch of remotecontrolled power switches connected to this i also have a bunch of temperature sensors (this model) places around the house, outside and in my shed.

Logging to InfluxDB

Data is fed into InfluxDB using a couple of different scripts.

  • Temperatures are read from Telldus Live using a modified version of their tdtool.py script every 10 minutes
  • To log status for my home server running ubuntu I modified my status script, this is logged every 5 minutes.
  • Ping & packet loss is logged with a simple ping script, right now it only pings googles public dns but is should be extended to ping multiple things (isp dns server etc) currently this script runs every minute

Improvements

I plan to add more fun sensors that work with Tellstick, things like rain and wind sensors. Something that logs how bright the sun is would be cool to. At some point when I have more info it will be fun to do some ‘big data’ stuff using the data set I have, right now it’s been running for about 6 months so next year it’s possible to graph current vs last year for many values.