Ex Machina

I think I really enjoyed Ex Machine , it has a great mixture of near scifi and technology. There is enough mystery and conspiracy in the film to keep me engaged, I am glad my world doesn't have so much intrigue. If it did I would probably be in some Billionaires dungeon for following the wrong lead.

The Ex Machina Soundtrack is even better than the film. It reminds me of the ambient music that plays in GTAV when you wander around with the radio off. A podcast with similar drones and loops would be an excellent thing to add to my work music mix.


Reading: The Puzzle Palace, 802.11 Wireless Networks 2nd Edition, MOONCOP!

Writing this takes a little too much effort

Writing blog posts and getting them out takes far too much effort. With a streamlined publishing system the author still has to manage to write something down.

I do not have a streamlined publishing system. Instead the tools I use sit in a balance between the ideal thing I want and the hacked together scripts I have. It has been 4 months since my last post, so you can join me on a refresher.

The web side of the software is written in nodejs using express (and python with flask, but that isn't finished). The node program starts up and parses in a configured directory containing the blogposts.

$ cd blogposts

$ git pull
Already up-to-date.

The blog posts live in git and are written in markdown. Images for the posts are kept in the images subdir. The blog posts themselves live in year folders (2014,2014, etc). The year folders are provided as configuration to the node web process as well, which implies there is work to do when the calendar flips around.

$ ls
2013   2014   2015    2016    drafts    images    newid.sh    old

$ ls 2016 
32c3.md                 glitchcards.md          unreasonable0x02.md
acuratefbsdaudio.md     lighttheme.md           unreasonable0x03.md
dso138kit.md            more-unreasonable.md    update.md
fbsdpixorg.md           notifications.md        vimcrypt.md
ffmpeggif.md            pan.md                  xxx.md
freebsdbuildflags.md    ubuntu-touch.md
freebsdrecaudio.md      unreasonable.md

blogposts have an id, which is used to sort and sequence them and is used for the post url. It was needed in earlier pieces of software I wrote and I would like it to go away. Until I move to something else I have a helper script to tell me what the next id is.

$ sh ./newid
last post id: 0089
next post id: 0090

blogposts use an email style header, each line is a key value pair separated by the first colon on the line. The header block is terminated with two newlines '\n\n'. I can type out the header, but normally I copy it from a blogpost. That's the sort of lazy person I am.

$ copy 2016/somepost.md to 2016/newpost.md
$ vim 2016/newpost.md

Title: Some post
Tags: meta
Date: 2016-01-01
Preview: Some post
Permalink: 0001

Hurr durr I am a blogpost

I am totally inciteful and full of useful information, like how nat punch
through works and the secret to everlasting life.

Now we have to edit all of the fields in the header, and content for the body of the blogpost. This is a great time to add the correct post id value we got way up top.

Title: Writing this takes a little too much effort
Tags: blog
Date: 2016-09-26
Preview: Writing this takes a little too much effort 
Permalink: 0090

Writing blogposts takes far too much effort...

Okay, we have now written the blogpost, maybe even spell checked, we can upload it to the web server.

$ git add 2016/newpost.md
$ git commit -m "blogpost"
$ git push

On the remote web server we need to pull from the master blogposts branch to get the new article we wrote.

$ ssh webserver
$ cd sites/blogposts
$ git pull

Now we have the updates we have to restart the node process. There is code to reload dynamically, but I could never get nodejs to behave here. I would like to use kqueue to watch posts dir, but when I last looked this wasn't supported on the platform.

$ cd ../register
$ forever restart server.js

Phew, there we go.

We are serving up the new blogpost from the site. This seems like a lot of work, but I think post of the component stages would be required with a static site generator.

I want to write some tools to help with schduling posts. At the moment I can write a post for future release, but I have to specify the date for release.


Reading: The Puzzle Palace, 802.11 Wireless Networks 2nd Edition.

Personal Area WiFI networks

The first step to getting my devices working for me is to set up a consistent network for them to use. To do this I am going to use a small pocket sized router that can be run from a usb battery to act as a hot spot for my devices, but also as a bridge to an internet connected wifi network.

The network I want to setup looks something like this:

                                                   +
  +---------+                                      |
  |  phone  <<-------+                             |
  +---------+        |                             |
                     |                             |
  +---------+        |  DHCP     PANWIFI           | DHCP    PUBLIC WIFI
  |  laptop <<-------+      +-----------------+    |    +-----------------+
  +---------+        |      |                 |    |    |                 |
                     +---->>>   OpenWRT       <<<----->>>                 +---->  INTERNET
  +---------+        |      |                 |    |    |                 |
  |  camera <<-------+      +-----------------+    |    +-----------------+
  +---------+        |             192.168.x.x/xx  |
                     |10.10.10.0/24                |
  +---------+        |                             |
  |  pda    <<-------+                             |
  +---------+                                      |
                                                   |
        Personal area wifi network                 |  Upstream wifi network
+--------------------------------------------------+---------------------------------------+

I struggled to find a network configuration like this in the OpenWRT wiki. I wondered for a while if it was because the network was an impossible (seemed unlikely) or if it was so obvious to not be worth documenting.

Eventually google turned up a bitbucket page with a config that worked perfectly.

I need to find a method which makes it straight forward to configure a new outgoing network. I think at the moment I am going to have to edit the wifi config files to make any changes. On the road that will be less than ideal.

What do those XXX blocks mean

From Stevens TCP/IP Illustrated Vol 2 :

We will see the comment /* XXX */ throughout Net/3. It is a warning to the
reader that the code is obscure, contains nonobvious side effects, or is
quick solution to a more difficult problem.

The second volume of that series might be one of the best networking books ever written. Not because it is a good tome to learn networking from, it is instead a guide into the heart of a real system. It is close enough today to use as a starting point for finding out where things are and a step to finding out why they are.

It is where I go when I want to find out how my current machines get bytes from an application to packets on the wire.

Light terminal theme

For about as along as I have been using terminals I have had them set to a dark theme, for a while at the beginning I had my terminal set up to be green text on a black background. I might have been the l33test mutherfucker around.

! Zenburn theme
! black + red
urxvt*color0:      #101010
urxvt*color1:      #705050

! green + yellow
urxvt*color2:      #60b48a
urxvt*color3:      #f0dfaf

! blue + purple
urxvt*color4:      #506070
urxvt*color5:      #dc8cc3

! cyan + white
urxvt*color6:      #8cd0d3
urxvt*color7:      #dcdccc

! bright-black + bright-red
urxvt*color8:      #000000
urxvt*color9:      #dca3a3

! bright-green + bright-yellow
urxvt*color10:     #c3bf9f
urxvt*color11:     #f0dfaf

! bright-blue + bright-purple
urxvt*color12:     #94bff3
urxvt*color13:     #ec93d3

! bright-cyan + bright-white
urxvt*color14:     #93e0e3
urxvt*color15:     #ffffff

I moved to Zenburn from the unreasonably popular solarized at some point last year. When I moved I went through a few themes trying things out. I found that .Xresources supports cpp macros making it easy to swap themes.

!.Xresources 
urxvt*scrollBar:      false
urxvt*matcher.button: 1
urxvt.transparent:    false
urxvt*allow_bold:     true

Xft*dpi:              96
Xft*antialias:        true
Xft*hinting:          full

URxvt*geometry:       85x16
URxvt*fading:         0
URxvt*tintColor:      #ffffff
URxvt*shading:        0
URxvt*inheritPixmap:  False

#include ".papercolour"

URxvt.urlLauncher:    firefox
URxvt.matcher.button: 1

URxvt*font: xft:Source Code Pro:size=8

I tried to work outside quite a few times last year. Dark themes for terminals are really hard to see in bright sunlight. For some reason yeahconsole doesn't like the way I include themes and stayed with a default light theme. The light theme is really easy to see in sunlight. The contrast in readability made me really question using a dark theme at all.

At camp last year most of the daylight hours I spent on my laptop were inside our super tent, direct sunlight made my screen hard to read and the sun seems to melt my skin. My dark theme was okay to read in the tent, but it was no good outside, with the sun melting I just hid away until it was night time.

The sun being bad, I am grateful I live in Scotland, we don't have to put up with the sun very often(this is a joke, it is always fucking sunny, I want a refund).

When the sun isn't around I do quite like to sit in darkened rooms when I am hacking. If you too are a vampire you might have noticing the eyeball explosion that happens when you switch from your friendly terminal to the light explosion that is a web browser. Pretty much every web page has a light theme, I actually dislike dark themed web pages, I always think the designer is being up front with how much of a douchebag they are.

Anyway, this is a lot of words for "I have moved to a light theme"

! PaperColour Theme

URxvt.foreground: #4D4D4C
URxvt.background: #EEEEEE

! black
URxvt.color0: #EDEDED
URxvt.color8: #969694

! red
URxvt.color1: #D7005F
URxvt.color9: #D7005F

! green
URxvt.color2: #718C00
URxvt.color10: #718C00

! yellow / orange
URxvt.color3: #D75F00
URxvt.color11: #D75F00

! blue

URxvt.color4: #4271AE
URxvt.color12: #4271AE

! magenta
URxvt.color5: #8959A8
URxvt.color13: #8959A8

! cyan
URxvt.color6: #3E999F
URxvt.color14: #3E999F

! white
URxvt.color7: #4D4D4C
URxvt.color15: #F5F5F5