<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>phoenix felix, et tu</title><link href="https://boddy.im/" rel="alternate"></link><link href="https://boddy.im/feeds/all.atom.xml" rel="self"></link><id>https://boddy.im/</id><updated>2023-01-13T00:00:00+00:00</updated><entry><title>Making cycling slightly less boring</title><link href="https://boddy.im/cycle-meter.html" rel="alternate"></link><published>2023-01-13T00:00:00+00:00</published><updated>2023-01-13T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2023-01-13:/cycle-meter.html</id><summary type="html">&lt;p&gt;A terminal user interface for a cycling cadence meter&lt;/p&gt;</summary><content type="html">&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;A&lt;/span&gt; &lt;span class="nv"&gt;dashboard&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;the&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;terminal&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;bike&lt;/span&gt; &lt;span class="nv"&gt;sensor&lt;/span&gt;.
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;img src="/images/cadence.gif"/&gt;&lt;/p&gt;
&lt;h3&gt;Context&lt;/h3&gt;
&lt;p&gt;I'd rather be running and/or outside but an injury earlier this year led me to spend more time of late on a turbo trainer (this is basically a metal frame that holds a bike's back wheel while you cycle in place with some magnetic resistance) instead. &lt;/p&gt;
&lt;p&gt;To keep track of how much work is being done while on the turbo, I got a coin-sized  box with no display that attaches to bike's crank shaft or back wheel called a &lt;a href="https://en.wikipedia.org/wiki/Cadence_(cycling)"&gt;cadence sensor&lt;/a&gt;. There are many cheap sensor devices that use &lt;a href="https://en.wikipedia.org/wiki/Bluetooth_Low_Energy"&gt;Bluetooth Low Energy (BLE)&lt;/a&gt; or the proprietary &lt;a href="https://en.wikipedia.org/wiki/ANT_(network)"&gt;ANT&lt;/a&gt; protocol.&lt;/p&gt;
&lt;p&gt;This kind of sensor is super simple. It keeps track of how many revolutions the wheel/crank has made and how many seconds have passed since the thing last switched on and broadcasts those two numbers (along with some headers) to whatever BLE/ANT transciever they've connected to each time it detects another revolution.&lt;/p&gt;
&lt;p&gt;Unfortunately at the time of writing the available Android apps that talk to these sensors seemed to exclusively be some combination of stuffed with irrelevant ads, sketchy as fuck from a data-gathering/tracking perspective or just didn't work at all. &lt;/p&gt;
&lt;p&gt;At the same time, I was looking for an excuse to build a terminal-user-interface (TUI) with the &lt;a href="https://rich.readthedocs.io/en/stable/introduction.html"&gt;rich&lt;/a&gt; library to try it out (as opposed to the &lt;a href="https://rich.readthedocs.io/en/stable/introduction.html"&gt;python-prompt-toolkit&lt;/a&gt; library that I would usually reach for).&lt;/p&gt;
&lt;h3&gt;cycling-cadence-display&lt;/h3&gt;
&lt;p&gt;So I did the (completely un)needful and wrote a TUI dashboard of info about the bike  sensor showing things like how long it's been on, the instantaneous/mean revoluitions per minute (RPM). It also renders a plot of the RPM over time in ascii (via &lt;a href="http://www.gnuplot.info/"&gt;gnuplot&lt;/a&gt;) and trivially let's you export all the time-series data locally.&lt;/p&gt;
&lt;p&gt;When cycling it looks like the gif above. Usually I've got a small, semi-transparent terminal-app window with this running and some TV/film thing on in the background of a wall-mounted screen just in front of the bike which is slightly more interesting than starting at the wall behind it.&lt;/p&gt;
&lt;p&gt;Of course for using it on a phone instead you can &lt;a href="https://f-droid.org/en/packages/com.termux/"&gt;termux&lt;/a&gt; which looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/cadence_screenshot.png"/&gt;&lt;/p&gt;
&lt;p&gt;(As an aside, termux and it's API are a marvel for turning an Android phone into something much more useful with bash, cron, ssh, apt, access to storage/contacts etc.). &lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Overall I found the &lt;a href="https://rich.readthedocs.io/en/stable/introduction.html"&gt;rich&lt;/a&gt; library  intuitive to use and well documented - im my opinion it is ready to be used at work/in production to display a dashboard of information. It's not really built to for interactive interfaces though, for that you're  really looking to use &lt;a href="https://github.com/Textualize/textual"&gt;textual&lt;/a&gt; instead which is a for-profit org (who also happen to have written the rich library for use in textual).&lt;/p&gt;
&lt;p&gt;Personally I found myself doing longer "cycles" on the bike more often since I started using the dashboard. Ironically I got over the injury not long after this project so am back to hoofing it around the local woods / thames-path most of the time but the code is on &lt;a href="https://github.com/cboddy/cycling-cadence-display/"&gt;Github&lt;/a&gt; and available on &lt;a href="https://pypi.org/project/cycling-cadence-display"&gt;PyPI&lt;/a&gt;.&lt;/p&gt;</content><category term="editor"></category><category term="vim"></category><category term="python"></category><category term="cycling"></category><category term="cli"></category><category term="tui"></category></entry><entry><title>Song &amp; Spell</title><link href="https://boddy.im/song-and-spell.html" rel="alternate"></link><published>2020-12-27T00:00:00+00:00</published><updated>2020-12-27T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2020-12-27:/song-and-spell.html</id><summary type="html">&lt;p&gt;Play audio tracks based on words typed on a headless keyboard via bluetooth&lt;/p&gt;</summary><content type="html">&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;A key-logger that will play an audio track when particular words are pressed and a web-app to configure the words and songs.
&lt;/pre&gt;&lt;/div&gt;


&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;The volume of information available to anyone with a screen and an internet connection is hard to comprehend; the vastness is matched only by the variety.  &lt;/p&gt;
&lt;p&gt;It's frankly miraculous that so much information is so readily available, giving anyone with a web-browser the abilities of a minor deity from Greek mythology. &lt;/p&gt;
&lt;p&gt;And yet as a mere mortal it's also difficult to navigate without getting sucked into emotional little corners designed to illicit a response regardless of the veracity of the content.&lt;/p&gt;
&lt;p&gt;In my humble opinion most adults are not well prepared for this, and small people with malleable minds don't stand a chance. Aside from that, the &lt;a href="https://www.nhs.uk/news/pregnancy-and-child/who-guidelines-screen-time/"&gt;NHS guidance&lt;/a&gt; on screen time in general can be summarised as "nothing for those under two years old and very little for those two to five".&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;And yet it's great fun to sing and dance to music on your phone with a small person!&lt;/strong&gt; Not only that but a genre I would call toddler-folk-music is actually pretty decent. &lt;/p&gt;
&lt;p&gt;Giving a small person your phone to play something on a FAANG+ music service seems pretty dicey to me: you're trusting a commercial company whose interests are not likely to align with your own, not to mention trolls and the wider community of people you don't know. Of course, you can just use the device for the smalls, but it would be better if you didn't have to and they had the agency to choose something for themselves.&lt;/p&gt;
&lt;p&gt;Anyway, it would be great if there was a more limited way for small people to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;play a limited selection of audio media that you can choose in advance &lt;/li&gt;
&lt;li&gt;positively interact with technology without using a screen&lt;/li&gt;
&lt;li&gt;learn the alphabet and encourage spelling&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Song &amp;amp; Spell&lt;/h3&gt;
&lt;p&gt;Enter the &lt;a href="https://www.raspberrypi.org/products/raspberry-pi-400/"&gt;raspberry-pi-400&lt;/a&gt;: a cheap, general purpose PC with on-board wifi, bluetooth and I/O pins that is enclosed in its own keyboard 🤯&lt;/p&gt;
&lt;p&gt;&lt;img src="https://www.raspberrypi.org/homepage-9df4b/static/keyboard-lg-ea472ffb3ec4abfece72ef3d87ebb6d3.png"&gt;&lt;/img&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/cboddy/song-and-spell/"&gt;Song-and-Spell&lt;/a&gt; is a script that turns this wonder of the information age into a way to do just this. The idea is that &lt;strong&gt;you can use it without a screen. When the PC powers on it will automatically connect to a bluetooth speaker, use it as an audio sink and start a web-app&lt;/strong&gt; from which you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;upload files with songs to be played when certain words are typed on the keyboard&lt;/li&gt;
&lt;li&gt;download the audio track for videos directly from youtube to be played when certain words are typed on the keyboard&lt;/li&gt;
&lt;li&gt;set the speaker-volume (or just mute it)&lt;/li&gt;
&lt;li&gt;trigger playing the the songs directly, or remove them&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The web-ui looks like this on my phone:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://raw.githubusercontent.com/cboddy/song-and-spell/master/images/song_and_spell_webui.png"&gt;&lt;/img&gt;&lt;/p&gt;
&lt;p&gt;It does just this, no more or less. It was great to see it in action in the past few days, after ten minutes one happy little beta-tester could spell (type) words like "&lt;a href="https://youtu.be/Hl_-4baQeoA?t=30"&gt;lizard&lt;/a&gt;" without assistance even though they were previously unaware of those letters.&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;I'm pretty happy with how this project turned out. Most of the coding was the product of one evening while trying to get into the Christmas spirit (&lt;a href="https://www.imdb.com/title/tt0095016/"&gt;Die Hard&lt;/a&gt; was on in the background) just after a government announcement had forbid our upcoming plans. It then took considerably more effort to correctly setup the headless bluetooth &amp;amp; audio sink. The code (and installation guide) is on &lt;a href="https://github.com/cboddy/song-and-spell"&gt;Github&lt;/a&gt; and also available on &lt;a href="https://pypi.org/project/song-and-spell/"&gt;PyPI&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are some things I'm still not sure about: since there is no screen there should probably be some audio feedback after a key is pressed, or maybe just an LED flash. A beep could become annoying... someone speaking the letter was my first idea but these days phonics are taught instead. I've also ordered stickers for the keyboard with lower-case letters. If you have any insights about user-interfaces for small people then drop me a line or feel free to fork the project. Also, in case it's not obvious the web-server runs insecurely over HTTP and isn't designed to be accessible outside of your LAN. To secure it I'd recommend something simple like running nginx with SSL termination in front with &lt;code&gt;.htaccess&lt;/code&gt; for authentication.&lt;/p&gt;
&lt;p&gt;This is such a tiny facet of what this device can do, and I see it as just the beginning of a journey of education about technology that will of course, one day, when  they're ready, include a screen and an unfettered internet connection.&lt;/p&gt;</content><category term="raspberry-pi, python"></category><category term="python"></category><category term="raspberry-pi"></category><category term="flask"></category></entry><entry><title>okcli: a SQL command line interface</title><link href="https://boddy.im/oracle-okcli.html" rel="alternate"></link><published>2019-05-19T00:00:00+01:00</published><updated>2019-05-19T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2019-05-19:/oracle-okcli.html</id><summary type="html">&lt;p&gt;A new terminal client for interacting with Oracle&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;At work, the &lt;a href="https://en.wikipedia.org/wiki/Relational_database#RDBMS"&gt;RDBMS&lt;/a&gt; de-jour for many internal apps is - for better or worse - Oracle® Database. &lt;/p&gt;
&lt;p&gt;However, the provided tooling for Oracle (&lt;a href="https://en.wikipedia.org/wiki/SQL_Plus"&gt;sqlplus&lt;/a&gt;) lacks several features that I consider to be essential to be productive (e.g. schema-aware auto-complete for SQL-statements) and since there didn't seem to be any viable open-source alternatives I started a side-project to build something better.&lt;/p&gt;
&lt;h1&gt;okcli&lt;/h1&gt;
&lt;p&gt;After being used internally for over a year the result of that project, &lt;a href="https://github.com/manahl/okcli"&gt;okcli&lt;/a&gt;, was made publicly available under a &lt;a href="https://github.com/manahl/okcli/blob/master/LICENSE.txt"&gt;BSD-3 license&lt;/a&gt; earlier this week and announced on the company &lt;a href="https://www.ahl.com/man-okcli-an-oracle-database-command-line-interface"&gt;tech blog&lt;/a&gt;. The gif below shows it in action.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://raw.githubusercontent.com/manahl/okcli/master/docs/example.gif"&gt;&lt;/img&gt;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;okcli is is now available on &lt;a href="https://github.com/manahl/okcli"&gt;Github&lt;/a&gt; and &lt;a href="https://pypi.org/project/okcli/"&gt;PyPI&lt;/a&gt;.&lt;/p&gt;</content><category term="sql, python, cli"></category><category term="python"></category><category term="sql"></category><category term="cli"></category></entry><entry><title>Adding icons to i3 workspace names</title><link href="https://boddy.im/i3-workspace-names.html" rel="alternate"></link><published>2018-11-25T00:00:00+00:00</published><updated>2018-11-25T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2018-11-25:/i3-workspace-names.html</id><summary type="html">&lt;p&gt;Show font-awesome icons in the i3-bar for apps running in i3 workspaces.&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/i3-bar-with-icons.png"&gt;&lt;/img&gt;&lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Without getting bogged down in the linux display-manager holy war, I use the &lt;a href="https://i3wm.org/"&gt;i3 window manager&lt;/a&gt; every day at both home and work since... well it's a great display manager!&lt;/p&gt;
&lt;p&gt;Additionally, its design makes it easy to extend.&lt;/p&gt;
&lt;h2&gt;A small gripe&lt;/h2&gt;
&lt;p&gt;By default i3 shows a bar at the bottom of the screen with the workspaces (the i3-bar) where each workspace is identifed by a static number. This is useful but requires you to remember what apps are running in each workspace... which is too much for my perforated memory. &lt;/p&gt;
&lt;h2&gt;And so&lt;/h2&gt;
&lt;p&gt;I wrote a little &lt;a href="https://github.com/cboddy/i3-workspace-names-daemon/blob/master/i3_workspace_names_daemon.py"&gt;script&lt;/a&gt; to update the workspace name dynamically based on what apps are running in it, and since icons are much more succint than a concatenated list of app-names you can also configure it to show an icon instead of a particular app name.&lt;/p&gt;
&lt;h2&gt;Icons&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://origin.fontawesome.com/icons?d=gallery&amp;amp;q=desk"&gt;Font Awesome&lt;/a&gt; icons are freely available &lt;a href="https://origin.fontawesome.com/license/free"&gt;License&lt;/a&gt; and there are thousands of them. (If they seem familar it is because they're included in the &lt;a href="http://getbootstrap.com/2.3.2/"&gt;Bootstrap&lt;/a&gt; library and hence all over the place).&lt;/p&gt;
&lt;h1&gt;Examples&lt;/h1&gt;
&lt;p&gt;There is an example i3-bar image at the top of this article, more screenshots are below.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/i3-full-screenshot-1.png"&gt;&lt;/img&gt;
&lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/i3-full-screenshot-2.png"&gt;&lt;/img&gt;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Finally, one less thing to remember! &lt;/p&gt;
&lt;p&gt;Installation instructions are available on the &lt;a href="https://github.com/cboddy/i3-workspace-names-daemon"&gt;github page&lt;/a&gt; and the package is available on  &lt;a href="https://pypi.org/project/i3-workspace-names-daemon/"&gt;pypi&lt;/a&gt;.&lt;/p&gt;</content><category term="i3"></category><category term="python"></category><category term="i3"></category></entry><entry><title>How I use Vim</title><link href="https://boddy.im/vim-dev-env.html" rel="alternate"></link><published>2017-11-16T00:00:00+00:00</published><updated>2017-11-16T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2017-11-16:/vim-dev-env.html</id><summary type="html">&lt;p&gt;This is my .vimrc file: there are many like it, but this one is mine&lt;/p&gt;</summary><content type="html">&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;This is my .vimrc file. 
There are many like it, but this one is mine.
&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;Outline&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install"&gt;Installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#plugins"&gt;Plugins&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#filesystem"&gt;Navigating the local filesystem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#git"&gt;Version control with Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#status"&gt;Status Bar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#linting"&gt;Linting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#python"&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tagbar"&gt;Tagbar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#persistent_undo"&gt;persistent_undo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#misc"&gt;vim miscellany&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#motivation"&gt;Motivation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name="introduction" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;I've used &lt;a href="http://www.vim.org/"&gt;vim&lt;/a&gt; as my primary editor/IDE for the past 10 years. Back then I was writing data-analysis code over an ssh session to hosts in the &lt;a href="https://duckduckgo.com/?q=SLAC+stanford&amp;amp;t=canonical&amp;amp;ia=web"&gt;SLAC&lt;/a&gt; computing center in California while sitting several thousand miles away in front of a terminal in the UK and a friendly post-doc showed me this nifty looking editor that he was using... &lt;/p&gt;
&lt;p&gt;Since then I've been tempted away by a few shiny IDEs but always give up and come back to the venerable editor (one exception to this is &lt;a href="https://www.jetbrains.com/idea/"&gt;intellij&lt;/a&gt; as it's a wonderful refactoring-engine for Java. By comparison Pycharm is rubbish IMHO).&lt;/p&gt;
&lt;p&gt;And so I thought it might be useful to post about my &lt;code&gt;.vimrc&lt;/code&gt; file explaining what the various plugins and configuration options do. Since I've been writing a lot of python over the past year there's a bias here.&lt;/p&gt;
&lt;p&gt;This scope of this post creeped up but it is mainly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a walk-through of my &lt;code&gt;.vimrc&lt;/code&gt; file (anything not explained is hopefully obvious from the comments) &lt;/li&gt;
&lt;li&gt;a litany of the useful vim-plugins therein and how/why to use them&lt;/li&gt;
&lt;li&gt;some general vim tips&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name="install" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;If you want to skip to the goods you can clone my &lt;a href="https://github.com/cboddy/dot-files"&gt;dot-files repo&lt;/a&gt; and run &lt;a href="https://github.com/cboddy/dot-files/blob/master/vim.sh"&gt;vim.sh&lt;/a&gt; to download and install all of the plugins below. &lt;/p&gt;
&lt;p&gt;Updating to a more recent version of vim is usually trivial though, for Debian/Ubuntu you can do: &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo add-apt-repository ppa:jonathonf/vim
sudo apt update
sudo apt install vim
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If you don't have vim-8 installed all the plugins except ALE will work anyway.&lt;/p&gt;
&lt;p&gt;&lt;a name="plugins" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Plugins&lt;/h2&gt;
&lt;h3&gt;Vundle&lt;/h3&gt;
&lt;p&gt;Let's start with &lt;a href="https://github.com/VundleVim/Vundle.vim"&gt;Vundle&lt;/a&gt;: a plugin manager for vim that also fetches plugins straight from Github. We start by setting the runtime-path (where Vundle will download the plugins files).&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin &amp;#39;gmarik/Vundle.vim&amp;#39;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a name="filesystem" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Navigating the local filesystem&lt;/h2&gt;
&lt;h3&gt;NERDTree&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/scrooloose/nerdtree"&gt;NERDTree&lt;/a&gt; is for exploring the file-system and is sometimes useful for jumping between files in your current project. Personally I don't like this being open on-startup.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Plugin &amp;#39;scrooloose/nerdtree&amp;#39;

&amp;quot; Open/close NERDTree Tabs with 
let NERDTreeDirArrows=0 
&amp;quot; To have NERDTree not open on startup
let g:nerdtree_tabs_open_on_console_startup = 0 
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A few highlights:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;to open a new NERDTree tab use &lt;code&gt;:NERDTree&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;to open a file under the cursor in a v-split pane hit &lt;code&gt;s&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;closes like a normal vim tab&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/nerd_tree.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/nerd_tree.gif" alt="NERD-tree"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;ctrlp&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/ctrlpvim/ctrlp.vim"&gt;ctrlp&lt;/a&gt; is the most useful way to navigate between files while working on a project IMHO.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;ctrlp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ctrlp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vim&lt;/span&gt;&lt;span class="p"&gt;&amp;#39;&lt;/span&gt;

&lt;span class="s"&gt;&amp;quot; search ctrlp with regex by default&lt;/span&gt;
&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="nl"&gt;g:&lt;/span&gt;&lt;span class="n"&gt;ctrlp_regexp_search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="nl"&gt;g:&lt;/span&gt;&lt;span class="n"&gt;ctrlp_clear_cache_on_exit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Quite simply, press &lt;code&gt;Ctrl+p&lt;/code&gt; while in normal mode to open a buffer that will match to filenames in the directory you're in (and recursively in it's sub-directories). The options I've set will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;allow you to use regex to match filenamese&lt;/li&gt;
&lt;li&gt;cache the directory index (&lt;code&gt;F5&lt;/code&gt; to refresh). This is useful if like me you ever have to work with a shared NFS mounts on which the indexing operation can be sluggish&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/ctrlp.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/ctrlp.gif" alt="ctrlp"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a name="git" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Version control with Git&lt;/h2&gt;
&lt;h3&gt;vim-fugitive&lt;/h3&gt;
&lt;p&gt;The &lt;a href="[https://github.com/tpope/vim-fugitive"&gt;vim-fugitive repo&lt;/a&gt; says it better than I could:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;I&amp;#39;m not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;As someone that uses vim-fugitive to interface with git every day I don't consider this an understatement. This is a large topic but my top highlights are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:GCommit, :Gpush, :Gpull&lt;/code&gt; wrap &lt;code&gt;git {commit|push|pull}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:Gblame&lt;/code&gt;: opens a vertical-split window with git-blame info, and you can then open a commit and see the diff in another bugger&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:Gdiff&lt;/code&gt;: see diff output for the current file.&lt;/li&gt;
&lt;li&gt;You can pass any command directly to git by starting a command with &lt;code&gt;:Git&lt;/code&gt;, for example add the current file to the change-set with &lt;code&gt;:Git add path/to/current/file&lt;/code&gt; or just &lt;code&gt;:Git add %&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;we're using fugitive to display the git branch in the status line with the lightline plugin (see below).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Plugin &amp;#39;tpope/vim-fugitive&amp;#39;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/fugitive.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/fugitive.gif" alt="fugitive"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;vim-gitgutter&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/airblade/vim-gitgutter"&gt;vim-gitgutter&lt;/a&gt; complements fugitive by displaying the git sign for lines that have added/removed/updated in the current file (using the output &lt;code&gt;git diff&lt;/code&gt;)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Plugin &amp;#39;airblade/vim-gitgutter&amp;#39;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/gitgutter.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/gitgutter.gif" alt="gitgutter"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Bonus: configure git to use vimdiff&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;vimdiff&lt;/code&gt; is a diff-tool that opens a vertical-split window in vim. I find it much easier to see what's changed than when using git's in-built diff tool. Here we jump to my  &lt;code&gt;.gitconfig&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[diff]&lt;/span&gt;
    &lt;span class="na"&gt;tool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;vimdiff&lt;/span&gt;
&lt;span class="k"&gt;[difftool]&lt;/span&gt;
    &lt;span class="na"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;false&lt;/span&gt;
&lt;span class="k"&gt;[alias]&lt;/span&gt;
    &lt;span class="na"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;difftool&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We can now look at the output of &lt;code&gt;git diff&lt;/code&gt; in &lt;code&gt;vimdiff&lt;/code&gt;. For example, to diff the curreent index with two commits ago you can do &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;git d HEAD~2
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Highlights of this method is that when navigating the file in either window:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the files can be edited as if they were normally opened files in vim&lt;/li&gt;
&lt;li&gt;"dp" will put the change under the current cursor to the other file&lt;/li&gt;
&lt;li&gt;"do" with obtain the change from the other file and apply it to the cursor position in the current file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/vimdiff.png"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/vimdiff.png" alt="vimdiff" /&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a name="status" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Status Bar&lt;/h2&gt;
&lt;h3&gt;lightline&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/itchyny/lightline.vim"&gt;lightline&lt;/a&gt; allows you to configure a snazzy status bar (at the bottom of the window). The snippet below will show:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a color-scheme named &lt;code&gt;wombat&lt;/code&gt; for the status-bar itself&lt;/li&gt;
&lt;li&gt;the vim-mode (&lt;code&gt;INSERT&lt;/code&gt;/&lt;code&gt;NORMAL&lt;/code&gt;/&lt;code&gt;VISUAL&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;the git-branch if the file in the current buffer is part of a git repo (more on this later)&lt;/li&gt;
&lt;li&gt;the python-virtualenv in use (more on this later).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;Plugin&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;itchyny/lightline.vim&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;

&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="s"&gt; set lightline to include git-branch&lt;/span&gt;
&lt;span class="nv"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;g&lt;/span&gt;:&lt;span class="nv"&gt;lightline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; {
      \ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;colorscheme&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;wombat&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;,
      \ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;active&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: {
      \   &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;left&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: [ [ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;mode&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;paste&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; ],
      \             [ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;gitbranch&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;readonly&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;filename&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;modified&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; ] ,
      \             [ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;venv&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;, &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;readonly&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;] ]
      \ },
      \ &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;component_function&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: {
      \   &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;gitbranch&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;fugitive#head&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;,
      \   &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;venv&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;: &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;virtualenv#statusline&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;
      \ },
      \ }

&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="s"&gt; Always show statusbar&lt;/span&gt;
&lt;span class="nv"&gt;set&lt;/span&gt; &lt;span class="nv"&gt;laststatus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This produces the following status bar:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/lightline.png"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/lightline.png" alt="lightline status bar"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a name="linting" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Linting and syntax highlighting&lt;/h2&gt;
&lt;p&gt;Many people use syntastic for syntax highlighting in vim. It has one drawback which is that it runs synchonously in the main UI thread. &lt;a href="https://github.com/w0rp/ale"&gt;ALE&lt;/a&gt; (Asynchronous Lint Engine) is arguably an asynchronous successor.&lt;/p&gt;
&lt;h3&gt;ale&lt;/h3&gt;
&lt;p&gt;ALE let's you specify specific linters for different languages. Below I've specified &lt;code&gt;flake8&lt;/code&gt; for linting and &lt;code&gt;autopep8&lt;/code&gt; for fixing syntax "errors". &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Plugin &amp;#39;w0rp/ale&amp;#39;

&amp;quot; pip install flake8
let g:ale_linters = {&amp;#39;python&amp;#39;: [&amp;#39;flake8&amp;#39;]}
let g:ale_fixers = {&amp;#39;python&amp;#39;: [&amp;#39;remove_trailing_lines&amp;#39;, &amp;#39;trim_whitespace&amp;#39;, &amp;#39;autopep8&amp;#39;]}
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;this assumes flake8 and autopep8 are already installed &lt;/li&gt;
&lt;li&gt;any config for either in &lt;code&gt;~/.config/pep8&lt;/code&gt; or &lt;code&gt;~/.config/flake8&lt;/code&gt; will be respected.&lt;/li&gt;
&lt;li&gt;the linting is done asynchronously &lt;/li&gt;
&lt;li&gt;to apply the fixer (in this case &lt;code&gt;autopep8&lt;/code&gt;) use the command &lt;code&gt;:ALEFix&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This produces:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/ale.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/ale.gif" alt="ale"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a name="python" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Python&lt;/h2&gt;
&lt;p&gt;Here are a few plugins that are great for python specifically.&lt;/p&gt;
&lt;h3&gt;jedi-vim&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/davidhalter/jedi-vim"&gt;jedi&lt;/a&gt; is probably the best auto-completion library for Python that I've ever used (including Pycharm). jedi-vim requires that your vim binary was compiled with the &lt;code&gt;python&lt;/code&gt;/&lt;code&gt;python3&lt;/code&gt; option but that's pretty much guaranteed unless you're compiling vim yourself.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; ------ jedi-python ------&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;Plugin&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;davidhalter/jedi-vim&amp;#39;&lt;/span&gt;

&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;jedi&lt;/span&gt;&lt;span class="c1"&gt;#popup_on_dot = 0&lt;/span&gt;
&lt;span class="nb"&gt;map&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Leader&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="n"&gt;Oimport&lt;/span&gt; &lt;span class="n"&gt;pdb&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;pdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_trace&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# BREAKPOINT&amp;lt;C-c&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Anyway, this is another large topic but here are a few highlights:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;autocomplete (&lt;code&gt;C-x-o&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;jump-to variable/method/function/class definition (&lt;code&gt;leader+g&lt;/code&gt;) &lt;ul&gt;
&lt;li&gt;this works with defined on &lt;code&gt;PYTHONPATH&lt;/code&gt; (including in your virtual-env) but not egg files weirdly)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;find-usages (&lt;code&gt;leader+f&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;jump-to method/class/function/variable declaration (&lt;code&gt;leader+d&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;rename (&lt;code&gt;leader+r&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;show docstring with &lt;code&gt;K&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;As a bonus: &lt;code&gt;leader+b&lt;/code&gt; is remapped to add a pdb-breakpoint. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Below shows a few of these in action:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/jedi.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/jedi.gif" alt="jedi"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;vim-virtualenv&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://github.com/jmcantrell/vim-virtualenv"&gt;vim-virtualenv&lt;/a&gt; allows you to set the python-virtualenv used in vim (and by extension &lt;code&gt;jedi-vim&lt;/code&gt;). You can set/unset it with &lt;code&gt;:VirtualEnvActivate virtual_env_name&lt;/code&gt; or &lt;code&gt;:VirtualEnvDeactivate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a name="tagbar" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;tagbar&lt;/h3&gt;
&lt;p&gt;Personally I find tags of limited use, but they're handy for exploring a new or otherwise un-familiar codebase. Here we use &lt;a href="https://github.com/majutsushi/tagbar"&gt;tagbar&lt;/a&gt;. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;quot; --- C-tags integration --- &amp;quot;
Plugin &amp;#39;majutsushi/tagbar&amp;#39;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note, this requires &lt;code&gt;ctags&lt;/code&gt; or similar to be installed, so for Debian/Ubuntu:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo apt-get install ctags
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then we can toggle the tagbar window with &lt;code&gt;:Tagbar&lt;/code&gt; and navigate code at a higher level of abstraction, as shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/tagbar.gif"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/tagbar.gif" alt="tagbar"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Other useful plugins&lt;/h2&gt;
&lt;p&gt;Honourary mention to &lt;code&gt;vim-go&lt;/code&gt; and &lt;code&gt;rust.vim&lt;/code&gt; which provide great integration for those languages too. &lt;/p&gt;
&lt;p&gt;Also, for keeping a work-log or wiki I can't recommend &lt;a href="http://vimwiki.github.io"&gt;vimwiki&lt;/a&gt; enough: it is like an even-better org-mode ;-)&lt;/p&gt;
&lt;p&gt;&lt;a name="persistent_undo" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;persistent-undo&lt;/h2&gt;
&lt;p&gt;This isn't a plugin but something I find useful for essentially caching the list of updates to a file such that if you close and re-open a file you can undo the last few edits (note, most vim distros in the wild will be compiled with the &lt;code&gt;persistent_undo&lt;/code&gt;") &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="s"&gt; Keep undo history across sessions by storing it in a file&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;has&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;persistent_undo&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
    &lt;span class="nv"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;undo_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;expand&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;$HOME/.vim/undo_dir&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;isdirectory&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;undo_dir&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;call&lt;/span&gt; &lt;span class="nl"&gt;mkdir&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;undo_dir&lt;/span&gt;, &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;, &lt;span class="mi"&gt;0700&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;endif&lt;/span&gt;
    &lt;span class="nv"&gt;set&lt;/span&gt; &lt;span class="nv"&gt;undodir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;$&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;.&lt;span class="nv"&gt;vim&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;undo_dir&lt;/span&gt;
    &lt;span class="nv"&gt;set&lt;/span&gt; &lt;span class="nv"&gt;undofile&lt;/span&gt;
&lt;span class="k"&gt;endif&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h2&gt;Colours&lt;/h2&gt;
&lt;p&gt;It's possible to set the colour-scheme directly in vim but these days most terminals (&lt;a href="https://gnometerminator.blogspot.de/p/introduction.html"&gt;terminator&lt;/a&gt; for linux and &lt;a href="https://www.iterm2.com/"&gt;iTerm2&lt;/a&gt; for mac) have &lt;a href="http://ethanschoonover.com/solarized"&gt;solarized&lt;/a&gt; colour schemes baked in. Once set, vim will use these and the job is done.&lt;/p&gt;
&lt;h2&gt;tmux&lt;/h2&gt;
&lt;p&gt;On a different note, &lt;a href="https://github.com/tmux/tmux/wiki"&gt;tmux&lt;/a&gt; is a wonderful way to multiplex teminal sessions and I find it complements vim very nicely. &lt;/p&gt;
&lt;p&gt;I could probably fill an equally lengthy post about tmux. &lt;/p&gt;
&lt;p&gt;&lt;a name="misc" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;vim miscellany&lt;/h2&gt;
&lt;p&gt;Again, this is a much larger topic but here are a few tricks I find useful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:sp&lt;/code&gt; and &lt;code&gt;:vs&lt;/code&gt; will split the current window horizontally/vertically&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gg=G&lt;/code&gt; will auto-indent the entire file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;e#&lt;/code&gt; navigates to the previously opened file in the current buffer&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vim.wikia.com/wiki/Macros"&gt;vim macros&lt;/a&gt; are pretty rad&lt;/li&gt;
&lt;li&gt;you can use &lt;code&gt;%&lt;/code&gt; as a shortcut for the current file-path in any command in command mode e.g. get it's md5-hash &lt;code&gt;:! md5sum %&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;you can read from stdin via a UNIX pipe with &lt;code&gt;vim -&lt;/code&gt;, e.g.  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;gt;&amp;gt; curl example.com | vim -
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a name="motivation" &gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Motivation&lt;/h2&gt;
&lt;p&gt;Warning: this section is opinionated. &lt;/p&gt;
&lt;p&gt;You might ask: why bother with all this? Surely [insert GUI-based IDE + whatever else] is good enough? &lt;/p&gt;
&lt;p&gt;Well, it may be good enough. But often when working on some data-analysis or building some service what matters far more than the length of time spent working is &lt;strong&gt;how long I can spend in a state of flow&lt;/strong&gt;. This usually means being focussing on one thing; being un-distracted. Using this editor is a great way of staying focussed and minimising the operational overheads of software engineering. &lt;/p&gt;
&lt;p&gt;Things I find good for staying focussed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Keeping my eyes fixed on one application&lt;/li&gt;
&lt;li&gt;Having things like auto-complete and linters&lt;/li&gt;
&lt;li&gt;Using as few keystrokes as possible for common tasks (eg. VCS commands, running tests)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Conversely, these have the opposite effect:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Navigating menus&lt;/li&gt;
&lt;li&gt;Using a mouse at all&lt;/li&gt;
&lt;li&gt;Switching to another terminal window or (much) worse a web-GUI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So in a way these plugins and hotkeys are a way of making it easier to stay in the flow.&lt;/p&gt;
&lt;h2&gt;vim-8 is awesome&lt;/h2&gt;
&lt;p&gt;Most package managers will distribute binary versions of vim 7.4.XXXX which is fine. There are many reasons to update to vim version 8.X is but perhaps the biggest is that it allows tasks to be performed outside the main UI thread. All of the plugins we'll discuss will work fine with either version &lt;strong&gt;except for the ALE plugin that requires version 8+&lt;/strong&gt;. Also, certain commonly-enabled compilation flags (&lt;code&gt;python&lt;/code&gt; and &lt;code&gt;persistent_undo&lt;/code&gt; are assumed).&lt;/p&gt;
&lt;h2&gt;Wrapping up&lt;/h2&gt;
&lt;p&gt;Putting it altogether, what I focus on while working usually looks something like this. &lt;/p&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/fullshot.png"&gt;
    &lt;img style="max-width:100%" src="https://raw.githubusercontent.com/cboddy/_vim_gifs/master/fullshot.png" alt="full working environment"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you've made it this far I hope found it useful.&lt;/p&gt;</content><category term="editor"></category><category term="vim"></category><category term="editor"></category><category term="python"></category></entry><entry><title>Muting the news</title><link href="https://boddy.im/android-mute-scheduler.html" rel="alternate"></link><published>2017-02-04T00:00:00+00:00</published><updated>2017-02-04T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2017-02-04:/android-mute-scheduler.html</id><summary type="html">&lt;p&gt;Scheduling times to mute the music-stream on Android&lt;/p&gt;</summary><content type="html">&lt;h1&gt;TL; DR&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://play.google.com/store/apps/details?id=im.boddy.MuteTime3"&gt;Mute the news&lt;/a&gt; when listening to the radio on a thing running Android.&lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;As someone who listens to a lot of &lt;a href="http://www.bbc.co.uk/6music"&gt;BBC Radio 6&lt;/a&gt;, I highly recommend pretty much all of the weekend shows, they're usually full of really great music. &lt;/p&gt;
&lt;p&gt;As part of the radio service, the &lt;a href="https://en.wikipedia.org/wiki/BBC_News"&gt;BBC News&lt;/a&gt; butts-in with a 2-3 minute broadcast at hourly intervals, full of current events to help keep the public informed. Now, aside from the known &lt;a href="https://www.theguardian.com/media/2013/apr/12/news-is-bad-rolf-dobelli"&gt;adverse effects of consuming too much news&lt;/a&gt;, the tone of the broadcast is  usually completely at odds with what I'm doing at the time. Why should I be made aware of what someone said in London or the latest tweet of a large-tangerine with small hands? Why must the minds of millions be made aware of minor crimes in major cities? At times during the run up to the Brexit referendum it felt like listening to the Nigel Farage hate-trumpet.&lt;/p&gt;
&lt;p&gt;In consuming media this way a person acquiesces control to the broadcaster, allowing them to shape your reality  with great subtlety, often making you morbidly aware of seemingly endless minutiae for the political or commercial gain.&lt;/p&gt;
&lt;p&gt;But I digress.&lt;/p&gt;
&lt;p&gt;For some time I've just reached over and muted the radio when the news jingle starts. But last weekend I had a few hours to kill in a pub before meeting Sarah to play &lt;a href="https://boardgamegeek.com/boardgame/2655/hive"&gt;Hive&lt;/a&gt;. So obviously I wrote an Android App (below) to mute the streaming-music volume at set times of the day for a configurable period of time. Note this doesn't affect the phone-ringer or alarm volumes, only streaming music like playing the radio through a web-browser and can be (de) activated with a toggle.&lt;/p&gt;
&lt;h3&gt;mute.time&lt;/h3&gt;
&lt;p&gt;The source-code is on &lt;a href="https://github.com/cboddy/mute.time"&gt;github&lt;/a&gt;, and the (free, open-source, ad-free) app is published on the &lt;a href="https://play.google.com/store/apps/details?id=im.boddy.MuteTime3"&gt;Android play-store&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/mute_time_screenshot.png"&gt;
    &lt;img style="max-width:100%" src="/images/mute_time_screenshot.png" alt="Screenshot of the mute-time utility."/&gt;
&lt;/a&gt;&lt;/p&gt;</content><category term="android"></category><category term="android"></category><category term="mute"></category><category term="java"></category></entry><entry><title>2016 in Books (part 2)</title><link href="https://boddy.im/books-2016-part-2.html" rel="alternate"></link><published>2017-01-09T00:00:00+00:00</published><updated>2017-01-09T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2017-01-09:/books-2016-part-2.html</id><summary type="html">&lt;p&gt;Some other books I've read in the second half of 2016&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Anyone looking for a book?&lt;/p&gt;
&lt;p&gt;Below is a brief review of some books I've read in the second half of 2016.&lt;/p&gt;
&lt;p&gt;This makes just over 40 books read in 2016, next year I'm tempted to include some graphs and maybe a few journal articles.&lt;/p&gt;
&lt;h1&gt;Non Fiction&lt;/h1&gt;
&lt;h3&gt;Dreams of a Final Theory: Steven Weinberg&lt;/h3&gt;
&lt;p&gt;In the late 80s a particle-physics experiment called the Superconducting Super Collider (SSC) had it's funding cut, despite the fact that construction was well under way. This was most likely because Texas (where it was being built) also had a lot of money being spent there as part of the International Space Station project and the ensuing political difficulties that followed the concentration of resources into just one state. Over many years a gradual but consistent decline in the Department of Energy budget put them at odds and the SSC lost. &lt;/p&gt;
&lt;p&gt;The main thrust of this book is Weinberg (who won part of the Nobel Prize for the theory of Electroweak Symmetry Breaking) arguing for the SSC over the scientifically bereft ISS, along with a now standard popular-science-level Particle Physics introduction and a lot of less-standard ranting about religion and philosophers of science. &lt;/p&gt;
&lt;p&gt;There are many parallels between then and now and you can almost replace Tevatron/LEP with LHC and the arguments for building the next-generation of particle physics experiments after the LHC and the existential crisis facing Particle Physics experiments and theory in the absence of significant new physics from the LHC (except for a SM-like Higgs of course) are very relevant.&lt;/p&gt;
&lt;h3&gt;The Elements of Computing Systems: Building a Modern Computer from First Principles: Noam Nisson &amp;amp; Simon Schocken&lt;/h3&gt;
&lt;p&gt;This book/course (that also goes by the moniker 'From Nand to Tetris') took a month but what a rewarding endeavour. The first chapter engages the reader to derive logic operators (AND, NOT, OR) purely in terms of NAND (like a transistor) and gives a scaffolding to build:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;an ALU that runs on (a provided) emulator;&lt;/li&gt;
&lt;li&gt;a 16-bit assembler for a somewhat simplified instruction set that runs on said emulator;&lt;/li&gt;
&lt;li&gt;a stack based VM that compiles to said 16-bit instruction-set;&lt;/li&gt;
&lt;li&gt;a high level Java/.Net style compiler/language spec to run on the stack VM;&lt;/li&gt;
&lt;li&gt;something between a light-weight OS and a library for the high level language for interacting with memory mapped input devices, allocating memory etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I can't recommend this book enough for understanding each level of abstraction in a running computer.&lt;/p&gt;
&lt;h3&gt;Boss Fight Books: Spelunky: Derek Yu&lt;/h3&gt;
&lt;p&gt;Spelunky is a game with which I became somewhat obsessed years ago, logging many, many hours of play. Having studied (and read quite a bit about) its procedural level generation in the past there was still plenty of things to learn in this book by its designer. Absolutely fascinating.&lt;/p&gt;
&lt;h3&gt;Surreal Numbers: Donald Knuth (Yes, that Donald Knuth.)&lt;/h3&gt;
&lt;p&gt;This is a rather strange book full of proofs about a branch of mathematics called Conway's numbers. It's also the first work of fiction to feature a new result before being published in any journal. Frankly, the love story is somewhat laughable for its lack of credibility but the ambition here is very noble: in wrapping up Number Theory derivations in a fictional narrative Knuth really, really wants to reach people that a math journal cannot. A+&lt;/p&gt;
&lt;h3&gt;Eyes on the Sky: Francis Graham-Smith&lt;/h3&gt;
&lt;p&gt;A whirlwind tour across the telescopes of the electromagnetic spectrum from Gamma-Ray bursts to Radio wavelengths and from the classic lenses of antiquity to the cutting edge of astronomy. This is probably a bit specialist but as a nerd who did an undergraduate courses on modern telescopes I loved it. A+&lt;/p&gt;
&lt;h3&gt;Weapons of Math Destruction: Cathy O'Neil&lt;/h3&gt;
&lt;p&gt;A somewhat alarmist review of the ways in which tasks formerly performed by humans are now being done by (usually quite rubbish) automation. The author is quite opinionated and makes quite a few un-substantiated claims but the basic thesis that automation tends to affect those who are poor and un-represented far more than the wealthy elite thus exacerbating wealth inequality in society is well researched and argued for. For example, when getting insurance or a bank loan if you go to an expensive, boutique service you'll probably still be seen by a human, rather than an algorithm that can make mistakes or codify the (hopefully subconscious) biases and prejudices of those who made it.&lt;/p&gt;
&lt;h3&gt;Effective Python&lt;/h3&gt;
&lt;p&gt;A good complement to 'the Hackers guide to Python' this book really helped me think more like a python-ista before starting a new role in which I get to be one.&lt;/p&gt;
&lt;h3&gt;The 59 Icosahedra: H.S.M. Coxeter, P. Du Val, H.T. Flather, J.F. Petrie&lt;/h3&gt;
&lt;p&gt;This charity shop gem is really an extended journal article exploring the maths of the Icosahedra (20-sided 3d-shapes) group members and operation, complete with a full enumeration of each many diagrams and in some cases pictures of paper models made by the great Coxeter. It's on my to-do list to hijack a 3-d printer and get it to print some of these.&lt;/p&gt;
&lt;h3&gt;Myth of a Strong Leader: Archie Brown&lt;/h3&gt;
&lt;p&gt;This was on Bill Gates winter reading-list and so far I'm loving it. It's sort of a history of politics in the 20th Century analysing the party leaders. Strangely haven't found any references to former psuedo-reality-tv-show-hosts.&lt;/p&gt;
&lt;h1&gt;Fiction&lt;/h1&gt;
&lt;h3&gt;Johnny Mnemonic: William Gibson&lt;/h3&gt;
&lt;p&gt;Reading this made me appreciate the 80s Keanu Reeves film, given that it was only a short story.&lt;/p&gt;
&lt;h3&gt;The Dispossessed : Ursula LeGuin&lt;/h3&gt;
&lt;p&gt;A thinly veiled and slightly exaggerated metaphor about the differences between Capitalist and Communist societies. &lt;/p&gt;
&lt;h3&gt;Left Hand of Darkness : Ursula LeGuin&lt;/h3&gt;
&lt;p&gt;Another sci-fi classic that's set on a distant world in which the human inhabitants periodically change sex and spend most of the time as an a-sexual hemaphrodite. Not only that, but they make first contact with a more technologically advanced portion of humanity.&lt;/p&gt;
&lt;h3&gt;Zones of Thought: Vernon Vince&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A Fire Upon the Deep&lt;/li&gt;
&lt;li&gt;A Deepness in the Sky&lt;/li&gt;
&lt;li&gt;Children of the Sky&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This trilogy sort of snuck up on me. The first two are very reminiscent of the Culture novels by Iain M Banks (which I also loved) and thoroughly explore some very interesting ideas such as a feudal society of dog-like creatures that can only think coherently (and collectively) in small packs, and get screwed up when two packs get too physically close together. 
The second book I actually preferred, focusing on a race of meter-tall spiders in a just-post-industrial-revolution-society undergoing a world-scale conflict. Not only that, but they collectively hibernate several hundred years at a time and are set for first contact with a more technologically advanced humanity. I feel a strange affinity to spiders after reading this book. 
The third ties up the story nicely but is otherwise miss-able in my humble opinion.&lt;/p&gt;
&lt;h3&gt;Howls Moving Castle: Diana Wynne Jones&lt;/h3&gt;
&lt;p&gt;A cute kids book I read on Sarah's recommendation. Certainly richer than the (excellent) film.&lt;/p&gt;
&lt;h3&gt;Call of Cuthulu: H P Lovecraft&lt;/h3&gt;
&lt;h3&gt;The Colour of Space: H P Lovecraft&lt;/h3&gt;
&lt;h3&gt;Solaris: Stanislav Lem&lt;/h3&gt;
&lt;p&gt;A superb sci-fi great that discusses metaphysics. A lot.&lt;/p&gt;
&lt;h3&gt;The Dark Tower series: Stephen King&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The Gunslinger&lt;/li&gt;
&lt;li&gt;The Drawing of Three&lt;/li&gt;
&lt;li&gt;The Wastelands&lt;/li&gt;
&lt;li&gt;Wizard and Glass&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What to say about this series? Clearly I can't stop reading them, but in the same way that it's difficult to stop eating junk food full of Mono-sodium-Glutemate. The writing is not superb and you have to be quite forgiving about the plot in places but I can see this making a pretty good HBO show later this year.&lt;/p&gt;</content><category term="books"></category><category term="books"></category><category term="review"></category></entry><entry><title>2016 in Books (part 1)</title><link href="https://boddy.im/books-2016-part-1.html" rel="alternate"></link><published>2016-06-14T00:00:00+01:00</published><updated>2016-06-14T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2016-06-14:/books-2016-part-1.html</id><summary type="html">&lt;p&gt;Some books I've read in the first half of 2016&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Who doesn't like books? &lt;/p&gt;
&lt;p&gt;Below is a brief review of some books I've read in the first half of 2016. &lt;/p&gt;
&lt;p&gt;This would probably have come out sooner but apparently I like to write book reviews during the 15-30 second crunch-time gaps between Counter-Strike (Source) rounds.&lt;/p&gt;
&lt;h1&gt;Non Fiction&lt;/h1&gt;
&lt;h3&gt;No Logo: Naomi Klein&lt;/h3&gt;
&lt;p&gt;Is it a manifesto and primer for the culture jammer movement?
Is it a catalogue of heart-breaking corporate mis-deeds? 
Yes! But what's more it's a thoroughly researched (both primary research and review) of corporate behaviour across the 80s and the 90s that leaves you feeling uncomfortable and ready to boycott something. Fascinating and well written.&lt;/p&gt;
&lt;h3&gt;Structured Interpretation of Computer Programs: Abelman, Sussman and Sussman&lt;/h3&gt;
&lt;p&gt;Ever wanted to learn computer science from scratch exclusively with a purely functional language (Lisp)? This book is for you! Requiring a lot from the reader in places, very interesting.&lt;/p&gt;
&lt;h3&gt;Designing BSD Rootkits: Joseph Kong&lt;/h3&gt;
&lt;p&gt;Ever wanted to know how vulnerable c-code is to buffer-overflow attacks?&lt;/p&gt;
&lt;h3&gt;Building Microservices: Sam Newman&lt;/h3&gt;
&lt;p&gt;I think this book should be titled "Building Services" since almost all the advice applies equally to SOA but buzzwords aside, it's a pretty decent guide to the practicalities and traps of building services and SOA instead of a monolithic, n-tier application.&lt;/p&gt;
&lt;h3&gt;Algorithm Design Manua: Steven Skiena&lt;/h3&gt;
&lt;p&gt;This was actually a re-re-reading of my favourite CS book.&lt;/p&gt;
&lt;h3&gt;Sapiens: A Brief History of Humankind: Yuval Harari&lt;/h3&gt;
&lt;p&gt;Focusing on three revolutions in human history:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;cognitive ~ 70,000 years ago;&lt;/li&gt;
&lt;li&gt;agricultural ~ 10,000 years ago;&lt;/li&gt;
&lt;li&gt;scientific ~ 500 years ago.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A compelling read with many erudite observations and a satisfyingly high density of sources. This book is worth it alone for the insight that humanity's ability to invent abstract concepts (language, religion, money, government etc.) not only allowed it to co-exist in groups of size larger than the largest chimpanzee band, but is to a large extent responsible for civilisation. To me, this is the most interesting book on this list.&lt;/p&gt;
&lt;h3&gt;The Hackers Guide to Python: Julien Danjou&lt;/h3&gt;
&lt;p&gt;After writing python for years I decided to shore up my knowledge for a particular project. This book is a cracking guide to some corners of the language that are easily missed (package distribution, scalability and ORMs to mention but a few) from a prominent OpenStack dev including interviews with others from that project.&lt;/p&gt;
&lt;h1&gt;Fiction&lt;/h1&gt;
&lt;h3&gt;Stranger in a Strange Land: Robert Heineman&lt;/h3&gt;
&lt;p&gt;Where to begin? A 500 page behemoth full of the sort of dialogue one would expect in a video game side quest. Not to mention the casual sexism through-out (is good-natured sexism a thing?) or the thinly veiled fantasies of the author. Still though, this book has a lot to say about sex, politics and religion (albeit via the proxy of fringe cults) and gave us the concept of "grokking". &lt;/p&gt;
&lt;p&gt;Long tracts of this book are sort-of dreadful but to quote a certain Martian: "I grok it is a goodness."&lt;/p&gt;
&lt;h3&gt;The Man in the High Castle: Philip K Dick&lt;/h3&gt;
&lt;p&gt;I'll admit I came to this one after exposure to advertising for the TV Show with the same title. I found this to be a somewhat voyeuristic novel in which the author explores a San Francisco that may have been, set in a parallel universe in which the USA has been conquered and colonised by Axis powers that grow increasingly antagonistic towards each other. Most of the execution of this story was pretty meh but then out of nowhere the finale was utterly sublime.&lt;/p&gt;
&lt;h3&gt;Purity: Jonathan Franzen&lt;/h3&gt;
&lt;p&gt;With all of the same qualities of his previous work "The Corrections" including an uncanny similarity to the style of Milan Kundera, Purity tells the intimate story of a few believable characters with serious issues around (among other things) trust. This one requires a more willing suspension of disbelief in places than his previous works (that I greatly enjoyed).&lt;/p&gt;
&lt;h3&gt;Equal Rites, Wyrd Sisters and Small Gods: Terry Pratchett&lt;/h3&gt;
&lt;p&gt;Terry Pratchett was brilliant. As night-time reads, Discworld novels are perfect: there are always more of them. Not only that, they have a built-in negative feedback mechanism in which after finishing one you're always ready for another, but experience tells you reading more than one in a row will be disappointing and they will all sort of blur into each other.&lt;/p&gt;
&lt;h3&gt;Count Zero: William Gibson&lt;/h3&gt;
&lt;p&gt;More focused and compelling than it's predecessor Neuromancer and set in the same universe, this book continues the dark, noir-ey sci fi of William Gibson.&lt;/p&gt;
&lt;h3&gt;Mona Lisa Overdrive: William Gibson&lt;/h3&gt;
&lt;p&gt;Concluding the tale of Neuromancer and Count Zero with more of the same pulp-ey sci-fi goodness. Being stuck in an airport lounge for most of a day gave me the great opportunity to read this almost in one sitting. &lt;/p&gt;
&lt;h3&gt;Wool Omnibus pt. 1 &amp;amp; 2: Hugh Howey&lt;/h3&gt;
&lt;p&gt;The short story on which these are based is quite beautiful, but the next few parts of this post-apocalyptic-everyone-now-lives-in-a-silo-underground series are decidedly meh.&lt;/p&gt;
&lt;h3&gt;The Lady Astronauts of Mars: Mary Kowal&lt;/h3&gt;
&lt;p&gt;A charming, poignant little short story set in a parallel-world in which Mars was colonised shortly after the moon landings.&lt;/p&gt;</content><category term="books"></category><category term="books"></category><category term="review"></category></entry><entry><title>A sunrise-alarm-clock-web-service using a Raspberry-Pi</title><link href="https://boddy.im/sunrise-alarm-clock-web-service.html" rel="alternate"></link><published>2016-01-09T00:00:00+00:00</published><updated>2016-01-09T00:00:00+00:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2016-01-09:/sunrise-alarm-clock-web-service.html</id><summary type="html">&lt;p&gt;Adventures in soldering&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;&lt;a href="/images/alarm.small.jpg"&gt;
    &lt;img style="max-width:100%" src="/images/alarm.small.jpg" alt="Jar-alarm-clock"/&gt;
&lt;/a&gt;
Waking up can be tricky. I'd heard good things about alarm clocks that light up gradually over about 30 minutes mimicking the sunrise from dull red to bright yellow light. &lt;/p&gt;
&lt;p&gt;Many retail models are available with huge variation in price and review strength but for one with a respectable lumen count at the time of writing the price was ~ £100. What's worse, they all had garish front displays that you couldn't turn off and a very limited selection of wake-up music (or radio). &lt;/p&gt;
&lt;p&gt;£100 seems an lot for something that's not quite right, surely? &lt;/p&gt;
&lt;h1&gt;Requirements&lt;/h1&gt;
&lt;p&gt;So, what are we building? &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A powerful lamp with a full range of colours and variable output&lt;/li&gt;
&lt;li&gt;A web-interface for setting the time, light profile, etc.&lt;/li&gt;
&lt;li&gt;A web-server for interacting with the light&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Hardware&lt;/h1&gt;
&lt;h3&gt;Host&lt;/h3&gt;
&lt;p&gt;There are various options for small boards running full linux distributions. I happened to have a slightly spurned but otherwise serviceable &lt;a href="https://www.raspberrypi.org/products/model-b/"&gt;Raspberry Pi Model B&lt;/a&gt; lying around (it was replaced as a media server some time ago by a beefier &lt;a href="https://www.raspberrypi.org/products/raspberry-pi-2-model-b/"&gt;B+ model&lt;/a&gt;) so I used that, but a cheaper option would be a &lt;a href="https://www.raspberrypi.org/products/pi-zero/"&gt;Pi-zero&lt;/a&gt; that somehow will eventually cost $5! &lt;/p&gt;
&lt;h3&gt;Lights&lt;/h3&gt;
&lt;p&gt;At first I tried using some LED arrays that were powered directly from the Pi's GPIO pins, but that limited the choice to devices like the (otherwise super cool) &lt;a href="https://www.piborg.org/ledborg"&gt;LedBorg&lt;/a&gt; which wasn't nearly bright enough to wake me up.&lt;/p&gt;
&lt;p&gt;This had two consequences:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A more powerful led-strip was going to ~ double the budget. &lt;/li&gt;
&lt;li&gt;It would also require power source external to the Pi which would probably mean soldering. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Eventually I found the &lt;a href="http://www.amazon.co.uk/gp/product/B00EFYW028"&gt;LPD8806 led-strip&lt;/a&gt; for £29 which like the Pi take a 5V supply, got a super cheap &lt;a href="http://www.amazon.co.uk/gp/product/B00ZWLTI64"&gt;usb-wifi dongle&lt;/a&gt; for £2.47 and decided to try and power both the Pi and the led-strip from the same power supply (see diagram) using a &lt;a href="http://www.amazon.co.uk/gp/product/B005JO0F52"&gt;5V, 2A DC supply&lt;/a&gt; power supply for £5.99 using this &lt;a href="http://www.amazon.co.uk/gp/product/B0182WA908"&gt;converter&lt;/a&gt; for £2.26. &lt;/p&gt;
&lt;h3&gt;Soldering&lt;/h3&gt;
&lt;p&gt;Of course, the led-strip didn't have any connector, just four bare wires. This necessitated getting my hands dirty (and mildly singed) to create a very simple circuit connecting the rasberry-pi and the led-strip in parallel with the power supply, as shown below.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/sunrise1.jpg"&gt;
    &lt;img style="max-width:100%" src="/images/sunrise1.jpg" alt="Soldering goodness"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Be super careful when soldering not to create any short circuits or burn yourself. If you don't know what you're doing here learn about that first!&lt;/strong&gt;&lt;/p&gt;
&lt;h1&gt;Software&lt;/h1&gt;
&lt;p&gt;I've made the project to control the led array, host the webserver, web-app and runtime management &lt;a href="https://github.com/cboddy/sunrise-light-alarm"&gt;available here&lt;/a&gt;. If you don't care about software you can skip over to the &lt;a href="#install"&gt;install&lt;/a&gt; section.&lt;/p&gt;
&lt;h3&gt;Web-server&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://github.com/cboddy/sunrise-light-alarm/blob/master/sunrise.py"&gt;web-server&lt;/a&gt; is a super simple &lt;a href="https://pypi.python.org/pypi/Flask"&gt;Flask&lt;/a&gt; service which stores the application state (ie. what time and days of the week to go off) as a json document. It also hosts the web-app and directly controls the led-array. &lt;/p&gt;
&lt;h3&gt;Web-app&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://github.com/cboddy/sunrise-light-alarm/blob/master/public/js/app.js"&gt;web-app&lt;/a&gt; uses &lt;a href="https://facebook.github.io/react/"&gt;React&lt;/a&gt; and &lt;a href="http://getbootstrap.com/"&gt;Bootstrap&lt;/a&gt; to show the, uh, minimal (and responsive) web-ui shown below. Clearly web design is very important to me. &lt;/p&gt;
&lt;p&gt;&lt;a href="/images/sunrise-webui.png"&gt;
    &lt;img style="max-width:100%" src="/images/sunrise-webui.png" alt="Web UI"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Runtime-management&lt;/h3&gt;
&lt;p&gt;Some minimal runtime-management is needed to make sure the web-server start when the raspberry-pi is powered up and restarts if it's crashed. The &lt;a href="http://www.raspbian.org/"&gt;Raspbian&lt;/a&gt; distribution still uses sys-v-init (since it's based on Debian-Jessie) so we use a &lt;a href="https://github.com/cboddy/sunrise-light-alarm/blob/master/sunrise"&gt;sys-v-init script&lt;/a&gt; to do exactly that. &lt;/p&gt;
&lt;p&gt;Generally sys-v-init is much fiddlier than more modern boot systems like the now deprecated Ubuntu &lt;a href="http://upstart.ubuntu.com/"&gt;upstart&lt;/a&gt; (which was great) or the much maligned &lt;a href="https://en.wikipedia.org/wiki/Systemd"&gt;systemd&lt;/a&gt; that will replace it in later debian distros but whatever, this works. &lt;/p&gt;
&lt;p&gt;&lt;a name="install"&gt; &lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Installation&lt;/h1&gt;
&lt;h3&gt;Enable SPI&lt;/h3&gt;
&lt;p&gt;By default the &lt;a href="https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus"&gt;SPI&lt;/a&gt; bus on a raspberry-pi is disabled. Since we'll use to control the led-strip, first &lt;a href="https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md"&gt;enable the SPI bus&lt;/a&gt; in the raspi-config which can be opened by:&lt;/p&gt;
&lt;pre&gt;
sudo raspi-config
&lt;/pre&gt;

&lt;h3&gt;Project&lt;/h3&gt;
&lt;p&gt;To install all the project software (including dependencies) run the &lt;a href="https://github.com/cboddy/sunrise-light-alarm/blob/master/install.sh"&gt;install script&lt;/a&gt; passing in the user and remote host at which your raspberry-pi is available on the network. For example, I have a user "pi" and the device has the hostname "raspberrypi" so to install server etc. I would do&lt;/p&gt;
&lt;pre&gt;
&gt; source install.sh pi@raspberrypi
&lt;/pre&gt;

&lt;p&gt;If you now browse to &lt;a href="http://raspberrypi"&gt;http://raspberrypi&lt;/a&gt; on that same network you should now see the web-ui show above.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Disclaimer: in a more formal setting I'd be using &lt;a href="http://www.ansible.com/"&gt;Ansible&lt;/a&gt; for this sort of thing but somehow it didn't feel right given how janky the rest of the project is ;-)&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;Result&lt;/h1&gt;
&lt;p&gt;In case you think I'm making all this up here it is.&lt;/p&gt;
&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/9P10_nMiUQY" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;I really enjoyed this Christmas project and would highly recommend it to anyone who feels like doing some hardware for a change. The total hardware cost was under £65, but using a pi-zero would reduce that by ~ £20 and now I have a sweet alarm-clock-in-a-jar!&lt;/p&gt;
&lt;p&gt;I also believe it would serve as a good starting point for building something bigger with more lights with cooler animations since it hooks up a web-ui to the leds directly. &lt;/p&gt;</content><category term="sunrise-alarm"></category><category term="electronics"></category><category term="raspberry-pi"></category><category term="react"></category><category term="flask"></category></entry><entry><title>A JVM client for IPFS</title><link href="https://boddy.im/ipfs-scala.html" rel="alternate"></link><published>2015-09-27T00:00:00+01:00</published><updated>2015-09-27T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2015-09-27:/ipfs-scala.html</id><summary type="html">&lt;p&gt;IPFS from the JVM&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;The &lt;a href="https://ipfs.io/"&gt;inter-planetary file-system (IPFS)&lt;/a&gt; is a super exciting open-source project that, among other things, fixes several problems with current data storage protocols combining ideas used in version control systems, and decentralised peer-to-peer protocols like bit-torrent. The primary IPFS implementation efforts are (so far) in Go and JavaScript and the rapid development pace aside, the IPFS HTTP client API is stable enough to be used by projects like &lt;a href="https://peergos.org/"&gt;Peergos&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, using IPFS from the JVM would be immensely easier with a JVM client that wraps the IPFS REST API...&lt;/p&gt;
&lt;h1&gt;scala-ipfs-api&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/ipfs/scala-ipfs-api"&gt;And lo, there is now an IPFS client for the JVM&lt;/a&gt;.  &lt;/p&gt;
&lt;p&gt;Although the client's written in Scala, it's written with Java projects in mind requiring a &lt;a href="https://github.com/ipfs/scala-ipfs-api/blob/master/ipfs.api.jar"&gt;single jar&lt;/a&gt; in your Java project class-path (made possible with the &lt;a href="https://github.com/sbt/sbt-assembly"&gt;sbt-assembly&lt;/a&gt; plugin).&lt;/p&gt;
&lt;p&gt;Writing this client has certainly improved my understanding of the project, and using IPFS as a storage engine for Peergos is now a giant step closer.  &lt;/p&gt;</content><category term="ipfs"></category><category term="ipfs"></category><category term="scala"></category><category term="jvm"></category></entry><entry><title>Remote file-system browser web-app</title><link href="https://boddy.im/file-browser-web-app.html" rel="alternate"></link><published>2015-05-23T00:00:00+01:00</published><updated>2015-05-23T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2015-05-23:/file-browser-web-app.html</id><summary type="html">&lt;p&gt;Building a file-browser web-app using React &amp;amp; Bootstrap&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Work with Ian on &lt;a href="https://github.com/ianopolous/Peergos"&gt;Peergos&lt;/a&gt; is progressing well, to the point where our distributed-secure-file-system finally needs a remote file-system browser (like Explorer, Finder etc.) and despite my standing revulsion for all things Javascript, I plunged in.&lt;/p&gt;
&lt;h1&gt;Requirements&lt;/h1&gt;
&lt;p&gt;Specifically, we required a web-app file-system browser which could support file-upload &amp;amp; download, deletion, sharing and so on. I immediately wanted  to use &lt;a href="http://getbootstrap.com/"&gt;Bootstrap&lt;/a&gt; to make the design responsive (look different on different sized screens) but there was still one problem...&lt;/p&gt;
&lt;p&gt;Let's face it: web UIs are tricky. I attribute most of this to the weak-typing and general difficulty to create invariants in Javascript. For example, what do you think this expresson:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;["10", "10", "10"].map(parseInt)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;evaluates to? Props if you were expecting this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[10, NaN, 2]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But I digress. For this reason, I decided to try something new: Facebook's &lt;a href="https://facebook.github.io/react/"&gt;React&lt;/a&gt; Javascript UI library. At first I was skeptical but after four hours I had a working prototype and after two working days (integrated over a week) the task was feature complete. Essentially within React's model you tend to write more modular, composable JS code... and that's something the world desperately needs.&lt;/p&gt;
&lt;h1&gt;A web-app file-system browser&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/cboddy/react-filesystem-browser"&gt;The project is open-source and available on Github&lt;/a&gt;. To simulate the backend filesystem I created a simple &lt;a href="http://flask.pocoo.org/"&gt;Flask&lt;/a&gt; server that supports filesystem operations in a chroot environment with cookie-based session management and password-based authentication (specified as a server command-line parameter)  but bear in mind this is little more than a mock for the web-ui, albeit a functional one supporting:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Grid and list views; &lt;/li&gt;
&lt;li&gt;File upload and download; &lt;/li&gt;
&lt;li&gt;Context menu (right / long click) with rename and delete options; &lt;/li&gt;
&lt;li&gt;Navigation buttons (back, up etc.);&lt;/li&gt;
&lt;li&gt;Sorting on file attributes (size, name, last-modified time); &lt;/li&gt;
&lt;li&gt;Directory creation;&lt;/li&gt;
&lt;li&gt;Cookie-based session management and simple password authentication;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A few screen-grabs on a large / small screen are shown below.&lt;/p&gt;
&lt;h3&gt;Desktop grid-based view&lt;/h3&gt;
&lt;p&gt;&lt;a href="/images/grid_view1.png"&gt;
    &lt;img style="max-width:100%" src="/images/grid_view1.png" alt="Desktop grid-view of my local / dir."/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Desktop list-based view&lt;/h3&gt;
&lt;p&gt;&lt;a href="/images/list_view1.png"&gt;
    &lt;img style="max-width:100%" src="/images/list_view1.png" alt="Desktop list-view of my local / dir."/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mobile grid-based view&lt;/h3&gt;
&lt;p&gt;&lt;a href="/images/grid_view2.png"&gt;
    &lt;img style="max-width:100%" src="/images/grid_view2.png" alt="Mobile grid-view ."/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mobile list-based view&lt;/h3&gt;
&lt;p&gt;&lt;a href="/images/list_view2.png"&gt;
    &lt;img style="max-width:100%" src="/images/list_view2.png" alt="Mobile list-view."/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;This web-app is now feature complete and destined to be the Peergos front-end but please feel free to fork it or submit a pull request. Also a disclaimer, although there is password authentication it is still pretty far from being "secure" without proxying it through a local HTTPS server and auditing the Flask server security. &lt;/p&gt;</content><category term="file-browser"></category><category term="peergos"></category><category term="file-browser"></category><category term="react"></category><category term="bootstrap"></category></entry><entry><title>RSS Repo: Yet another RSS aggregator</title><link href="https://boddy.im/rss-repo-live.html" rel="alternate"></link><published>2015-04-12T00:00:00+01:00</published><updated>2015-04-12T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2015-04-12:/rss-repo-live.html</id><summary type="html">&lt;p&gt;Announcing RSS Repo&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;I have a confession to make: I still use &lt;a href="http://en.wikipedia.org/wiki/RSS"&gt;RSS&lt;/a&gt; to navigate the web... even now! &lt;/p&gt;
&lt;p&gt;Years after the fabulous RSS aggregator service &lt;a href="http://www.google.com/reader/about/"&gt;Google Reader&lt;/a&gt; went the way of the HAL 9000 there are still those that feel its absence, myself included. Of course, many alternative services and browser plugins tried to fill the gap but frankly, I've never found one that was quite right. Some modest requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No advertisements of any kind; &lt;/li&gt;
&lt;li&gt;A simple way to import / export my data (feed-list) in standard &lt;a href="http://en.wikipedia.org/wiki/OPML"&gt;OPML&lt;/a&gt; format;&lt;/li&gt;
&lt;li&gt;No third party cookies; &lt;/li&gt;
&lt;li&gt;No default, ever-present feeds; &lt;/li&gt;
&lt;li&gt;A secure connection;&lt;/li&gt;
&lt;li&gt;A single-button to fetch updates from all of my feeds;&lt;/li&gt;
&lt;li&gt;Render HTML article content in a cross-platform (including mobile) client;&lt;/li&gt;
&lt;li&gt;And of course, it should be open-source :-)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That sounds pretty easy, right? Well with that in mind I started building &lt;a href="http://rss.boddy.im"&gt;RSS Repo&lt;/a&gt; (&lt;a href="https://rss.boddy.im"&gt;HTTPS&lt;/a&gt;). After a few weekends it is now fairly usable, and so I thought I'd write a post about it and see if anyone else is interested... so feel free to sign-up!&lt;/p&gt;
&lt;h1&gt;Architecture&lt;/h1&gt;
&lt;p&gt;&lt;a href="http://rss.boddy.im"&gt;RSS Repo&lt;/a&gt; is a single-page application written in regular HTML and Javascript, using the &lt;a href="http://getbootstrap.com/"&gt;Bootstrap&lt;/a&gt; CSS-library to render in a mobile-friendly way. On the other side is a pretty simple &lt;a href="http://flask.pocoo.org/"&gt;Flask&lt;/a&gt; server backed by SQL. &lt;/p&gt;
&lt;p&gt;In this model, the server is fetching / storing the RSS updates and the browser is rendering the article-HTML directly in the single-page application.&lt;/p&gt;
&lt;p&gt;Originally I thought this would be a web-view sitting inside a mobile app built with something like &lt;a href="http://cordova.apache.org/"&gt;Cordova&lt;/a&gt; so you could read cached articles without a web-connection but I think actually browser local storage or &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API"&gt;IndexedDB&lt;/a&gt; would be easier of the mobile browser coverage were good enough. &lt;/p&gt;
&lt;p&gt;For now the HTTPS certificate is self-signed since I didn't want to shell out for one from a certificate authority. Of course, once the EFF initiative &lt;a href="https://www.eff.org/deeplinks/2014/11/certificate-authority-encrypt-entire-web"&gt;Let's encrypt&lt;/a&gt; is available I'll switch to that.&lt;/p&gt;
&lt;h1&gt;What it looks like&lt;/h1&gt;
&lt;p&gt;The simple UI is shown in the screen-grabs below; in one table sit the added / imported RSS feeds with a count of the unread articles, and in the other a list of articles (those in bold are currently unread). &lt;/p&gt;
&lt;p&gt;&lt;a href="/images/rss_repo_with_menu.png"&gt;
    &lt;img style="max-width:100%" src="/images/rss_repo_with_menu.png" alt="Desktop shot"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/rss_repo_wide.png"&gt;
    &lt;img style="max-width:100%" src="/images/rss_repo_wide.png" alt="Another Desktop shot"/&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And here is what a mobile browser view looks like (although this is actually a small desktop Firefox window).&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/rss_repo_small.png"&gt;
    &lt;p align="center"&gt;&lt;img style="max-width:100%" src="/images/rss_repo_small.png" alt="Mobile shot"/&gt;&lt;/p&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Well, that's it: the site is live and open to &lt;a href="http://rss.boddy.im/"&gt;signing-up&lt;/a&gt; so please let me know if you have any suggestions. The project isn't yet on Github but the plan is to do so and use parts of the site as tutorials of stuff like user sessions, automated emails for sign up and best practices for password storing... watch this space.&lt;/p&gt;</content><category term="rss-repo"></category><category term="rss-aggregation"></category><category term="google-reader"></category><category term="rss-repo"></category></entry><entry><title>Porting the NaCl cryptography library</title><link href="https://boddy.im/jvm-tweet-nacl.html" rel="alternate"></link><published>2015-04-06T00:00:00+01:00</published><updated>2015-04-06T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2015-04-06:/jvm-tweet-nacl.html</id><summary type="html">&lt;p&gt;Pure Java Tweet-NaCl&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;&lt;a href="http://nacl.cr.yp.to/"&gt;NaCl&lt;/a&gt; is one of the most widely used cryptography libraries currently available. &lt;a href="http://tweetnacl.cr.yp.to/"&gt;Tweet-NaCl&lt;/a&gt; distills it into an entirely understandable, auditable and portable 100-tweets worth of C code (no really: it is even on &lt;a href="https://twitter.com/tweetnacl"&gt;Twitter&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;As part of &lt;a href="https://github.com/ianopolous/Peergos"&gt;Peergos&lt;/a&gt;, Ian and I really needed a set of crypto primitives that could be used in both a Javascript environment (ie. a browser) and in the JVM. Tweet-NaCl was already available in &lt;a href="https://github.com/dchest/tweetnacl-js"&gt;Javascript&lt;/a&gt; but we could not find a stable, working version written in pure Java...&lt;/p&gt;
&lt;h1&gt;Pure Java Tweet-NaCl&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/ianopolous/tweetnacl-java"&gt;Java Tweet-NaCl&lt;/a&gt; is a pure Java port of the Tweet-NaCl cryptography library. The actual port was pretty easy except when it briefly turned into a regex-olympics competition to turn as much of the C to Java automatically.  &lt;/p&gt;
&lt;p&gt;To verify the correctness of our pure-Java port, we wrapped the pure-C Tweet-NaCl library in the Java Native Interface (JNI). This allowed us to directly test the various Tweet-NaCl API calls in the C-source and our Java port. &lt;/p&gt;
&lt;p&gt;To verify that our port is compatible with the Javascript port we're using in Peergos, we also tested the entire API running the Javascript version in &lt;a href="http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/"&gt;Nashorn&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So there you go: three implementations of the Tweet-NaCl library running in the same JVM: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The original C running in the JNI;&lt;/li&gt;
&lt;li&gt;A Javascript port of the original C running in Nashorn;&lt;/li&gt;
&lt;li&gt;Our new pure-Java port running directly.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And best of all, all tests are now passing!&lt;/p&gt;</content><category term="tweet-nacl"></category><category term="java"></category><category term="jvm"></category><category term="jni"></category><category term="tweet-nacl"></category><category term="cryptography"></category></entry><entry><title>Profiling the Raspberry PI network I/O rate on the JVM</title><link href="https://boddy.im/rpi-network-test.html" rel="alternate"></link><published>2014-09-06T00:00:00+01:00</published><updated>2014-09-06T00:00:00+01:00</updated><author><name>Chris Boddy</name></author><id>tag:boddy.im,2014-09-06:/rpi-network-test.html</id><summary type="html">&lt;p&gt;Raspberry PI network  I/O benchmark&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;It is a fact universally ackowledged that the &lt;a href="http://www.raspberrypi.org/"&gt;Raspberry PI&lt;/a&gt; is a thing of beauty. I recently stumbled across some performance test data I collected earlier this year concerning the network performance of the little things, in particular when using the (Oracle) Java Virtual Machine (JVM) versus native.&lt;/p&gt;
&lt;h1&gt;Context&lt;/h1&gt;
&lt;p&gt;At the time we were building a distributed NoSQL database built on the JVM and the &lt;a href="http://www.raspberrypi.org/archives/4920"&gt;Rasbian folks had recently added the Oracle JVM to the Raspian repositories&lt;/a&gt;. To demonstrate how a cluster of machines running the database would fare, we needed a &lt;strong&gt;cluster&lt;/strong&gt;. We used AWS to build a cluster in their Ireland availability zone but I thought it would be much more fun to demonstrate a physical cluster and designed a 64-node Raspberry PI cluster demo that we could show off with and would be reasonably portable. I was convincing enough to secure a few Raspberry PIs to test but the company didn't survive long enough to publish anything about either the database or build the cluster. &lt;/p&gt;
&lt;p&gt;In theory, the network card on a Raspberry PI model B should be able to deliver a bandwidth of about about 100 Mbits per second. This would certainly handle many database transactions per second (or a bunch of web traffic or make for a decent media server), but sometimes there is a semantic gap between what is advertised and the reality. I'd also heard various horror stories regarding former JVM network-stack implementations. The question I wanted to know was how good the Oracle JVM would be at performing network I/O operations on a Raspberry PI. &lt;/p&gt;
&lt;h1&gt;Setup&lt;/h1&gt;
&lt;p&gt;Specifically I wanted to benchmark the network I/O performance between two Raspberry PI units and also between one Raspberry PI and a conventional server over TCP. &lt;/p&gt;
&lt;p&gt;Our inventory for the test is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Two Raspberry PI model B units;&lt;/li&gt;
&lt;li&gt;A beefy server with a 1 Gbps network card;&lt;/li&gt;
&lt;li&gt;A switch capable of delivering 1 Gbps uncontended between two endpoints.&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="center" &gt;&lt;img src="/images/rpi-config.png" alt="setup"/&gt;&lt;/p&gt;

&lt;p&gt;To measure the native network bandwidth (as seen by an application), I used a free-and-open-source benchmarking tool called &lt;a href="http://iperf.fr/"&gt;iPerf&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;For the JVM I used a simple Java I/O test-harness (available on my &lt;a href="https://github.com/cboddy/iotester"&gt;Github&lt;/a&gt;) that I had previously built to profile the network and disk performance of various cloud providers (Amazon, Rackspace etc.).&lt;/p&gt;
&lt;h1&gt;Results&lt;/h1&gt;
&lt;p&gt;The transfer rate over a few minutes for each of the four scenarios is shown in the plot. &lt;/p&gt;
&lt;p align="center" &gt;&lt;img src="/images/network-rate.jpg" alt="setup" width="640"/&gt;&lt;/p&gt;

&lt;p&gt;The key features I see reading this plot are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;From RPI to the server the transfer rate is stable using both the iPerf and my JVM code and pretty close to the advertised maximum of 100 Mbps.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;There is a small but non-neglibible overhead using the JVM, compared to native. This was expected but it's also of the order 1% which is pretty good, props to Oracle. I didn't try too hard to optimise the JVM tests but if you see something that can be improved let me know.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The transfer rate is less stable when the RPI is &lt;strong&gt;receiving&lt;/strong&gt; the traffic, particularly on the JVM.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The RPI can received a good deal less than the Network card is specced for. I tried fiddling various buffer sizes to improve the iPerf results but they seemed fairly stable at 64KB and similarly with my JVM code. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;None of these results are too surprising but I was satisfied that they would do the job.&lt;/p&gt;</content><category term="rpi"></category><category term="raspberry-pi"></category><category term="java"></category><category term="jvm"></category><category term="network profiling"></category></entry></feed>