Is macOS online?

I revisited another previous project, msnciasm. I hadn’t used it in a while and wanted to again, but it threw up a EXC_BAD_ACCESS error.

The eventual fix was trivial (literally one character):

- mov r14d, [eax]
+ mov r14d, [rax]

However, I had not touch this particular project or assembly in so long it was daunting to know where to start. Basically like debugging someone else’s code in a language you don’t read. Fortunately, I had done a lot of reverse engineering binaries for Capture the Flag events, that was helpful to get me stepping through the code to troubleshoot and eventually worked out the fix.

Now I had a new problem, OSX is not a thing anymore, this is macOS. Just enough had changed that the binary wouldn’t build. Getting a working compile probably took longer than the actual fix. But got there in the end.

Updated msnciasm project on GitHub.

New life patterns

I revisited my arduino project that displayed the game of life on an 8x8 display to be slightly more interesting to watch. Since it starts with a random grid, a lot of games end very quickly and so the display is “off” more than I’d like while it pauses between games.

The new version will still use a random grid, but now will also mix in pre-configured grids with known plays. To start off the pre-configured grids I found some well-known stable or interesting patterns. I also poked at the pixels myself to come up with a few custom grids of my own.

Updated gameoflife-arduino project on GitHub.


I’ve created a repository for the minimum dotfiles I would like to use across pretty much any host.

This includes configuration for things like bash, vim, git, fzf, golang, wget, etc.

On any new host, I just need to run:

$ git clone https://github.com/tobyoxborrow/dotfiles ~/.dotfiles/
$ bash ~/.dotfiles/dotfiles.sh

dotfiles project on GitHub.

8x8 game of life

I got an 8x8 display for my Arduino without any plan. After displaying some simple shapes, I remembered my Java-based game of life project from 2006, and had a go at making it run on the 8x8 display.

Due to the limited size the games end very quickly. It will detect when the game has ended (everything dying or no further growth) and will reset after a while, so it will keep itself active.

gameoflife-arduino project on GitHub.

From 000 to ZZZ

So there’s this kids app Shopkins Chef Club that uses barcodes on physical toys (purchased separately) to unlock characters in the app.

I don’t really know the value of unlocking the characters, that is not so important to me. When I saw the functionality I assumed it should be possible to enumerate the code space with some code. This was just for fun to try out some things I’ve not worked with much (barcodes and GUIs).

I found some example barcodes online and scanned them with a barcode scanner app to see what value was stored. After trying a few I noticed they use the format [a-zA-Z0-9]{3}. I guess since they have to print the code on small physical toys they didn’t have the luxury to use longer codes with more possible combinations.

This project displays a window on a computer screen that will show codes one after another, slideshow style. It cycles from 000 to ZZZ.

A separate device is pointed at the computer displaying the codes with the ChefClub app loaded and in its scanning mode.

It is hardly practical since the search space contains over 200,000 codes and the app requires about 1 second to recognise a code. It would take more than two days to verify every code at best. In reality, the process needs to be monitored by someone to stop when a code is valid and start again after clearing the message in the app. Requiring a human operator means it’ll require closer to a week.

chefcodes project on GitHub.

Am I online?

As part of an effort to teach myself assembly, I created a tiny command-line tool that checks if you are online and sets its exit code appropriately. Then this can be called from scripts that want to know.

The program will perform two tests using Microsoft’s NCSI (Network Connectivity Status Indicator) service.

  1. GET request for http://www.msftncsi.com/ncsi.txt
  2. DNS request for dns.msftncsi.com

If the GET request succeeded and the content was correct, it stops there and will exit with 0. If the GET request succeeded, but the content was not correct, it will perform the second test. If the second test succeeds, it will stop there and exit with 1 (to differentiate). Otherwise, it will exit with a non-zero exit status.

The command has no input and provides no output except its exit status. Usage example from a bash script:

if ./msncsi; then
    echo "I'm online :-)"
    echo "I'm offline :-("

msnciasm project on GitHub.

Small World

For work I was going linter crazy, adding linters for all the code in a particular project and wondered, is there was a linter for git messages? Very quickly I found gitlint. With this your git messages could be checked and rejected according to your requirements.

However, it didn’t have tests for some issues I was concerned about and I wanted the features! I reached out to the owner Joris and realised we both worked for Cisco. In fact, in the same business unit, though we’d not met or worked together yet. He rightly suggested I create PRs for the changes I want and if they are good enough they’ll get merged. They were and they did.

My PR added three new tests:

  • TitleLeadingWhiteSpace - Leading whitespace in the title.
  • BodyTooShort - Body message doesn’t contain enough detail.
  • BodyMissing - No body message at all.

gitlint project on GitHub.

Password Generator

I often need new passwords, for employees, services, servers, VPN pre-shared-keys and so on. Each have slightly different requirements. Humans would prefer easy to read/remember/write passwords, while computers can handle longer, less user-friendly passwords. I’ve created a script to generate a whole bunch of passwords in different formats, letting me pick the one that suits my needs.

The script can also use a wordlist to bash words together with some numbers and symbols. Plus just randomly selected words - in case I just want to make a password manually. I use a custom wordlist that has short and very long words removed. As an extra idea, I also filtered out words that matched the LulzSec password list.

$ passwords.pl --all
  jnmq49B9wnsW7Ass  pkF2Evu5chh9wMV4  wjy3Jw8CBzpN4JeT  uVu8Ms6iJbmZzaX4
  wS9hnCbmULJz8aDx  o3YFjWZ7gfaXrgzh  iHCZ2Vt3M2xcsH4A  so9Ndqj7Z5YdgBwh
   fNmemuKGBwWxaGqDh3wwaGsJr5fFEaHg    vbsJ9xcQ28yrKsgFdTeWKqb2b8rF4kPb
   sVs3buaTyjV2kZoa9fCzXdeD9n2J7ctQ    xgNg5Q7crqYiPc8LGztrbMp54j5P2aEe
  cq4sdiYG7Gs7/a=W  rte887qCiHxawJXr  wDgf3,2nwg/A\NfZ  brs.4D/GtGb,f=bG
  c uWetQ/ap7iWFD4  zqkr\Tj6kxfP86/w  ovE745hdV\xZL;nJ  q=NxSxvqjnvocuP9
  n4U.vQz{,8k4joAR  ghuX2sr`|Biv(\iK  yi`YhuokLy#\sJ\m  c+xJd=\Nn9nsBCd,
  q~iVY3oVerKB\xzv  fLzQbd.b`6R8rog8  z87WtMTrsgx%\v2j  hEJPbz-\RfpmdT%v
   8c24ef693f06837c11be61062e847668    a6faaf0feb28221d6490f11fc21dd49c
   4f77488566ab78a7cd44c9dd5df5797c    1fe9cd09977163976a2691e7622f41b4
     abaser82Backup's        Female5*circuity            Upsets5vim's
    Kimble'sNaiad's5%        RussianInstead32        catchingCrosser7
      antTalmud's263          caughtFoggier8         Jugged89goddess
bandiest duffer sunburn pottered Watling fantasy Rent's Fortiori
Planers poorly Glowed Honers mesas moon Irked Thayer's Intrigue
bullock hasp Involves spoons Manley Unisys's Worksop Gregorio Skysails
Celestas SMSA's Sanskrit uncheck docked humorist Mom's Tomlin target

PasswordGenerator project on GitHub.


My website was getting a lot of probes for vulnerable software.

For example (simplified): [16/Mar/2009:17:31:07 +0000] "GET /wp-login.php" [16/Mar/2009:21:19:32 +0000] "GET /config.php" [16/Mar/2009:09:26:32 +0000] "GET /phpinfo.php"

I don’t have these files or the software they are looking for so there was no risk. But it was starting to clog the logs, especially since I don’t get much traffic these requests take up the vast majority of the logs.

To do something about it I created a new project:

  1. Bot queries known trigger URL (e.g. /wp-login.php)
  2. .htaccess forwards the request to my logging php script
  3. The script logs the client IP and replies HTTP 200 to mess up their scan results
  4. fail2ban reads the log and adds an iptables entry to deny the IP
  5. Bot can no longer make requests to my site

httpscan2ban project on GitHub.


I work with iptables a lot to manage firewall rules. So to help me, I’ve created a script to manage iptables rules - automatically saving and restoring from files. Too many times I’ve lost rules when the server restarted and I forgot to save the rules first. So this script will register as a service and save rules automatically when the system shuts down and load them at boot.

Firewall rules are kept in a separate file, /etc/fireloader.conf in iptables-save format.

Fireloader project on GitHub.

Simple Solutions

{cycle} tag for the Smarty template system

Allows you to alternate between values. Useful for the common practice of highlighting every other row in data tables. E.g.: <tr class="{cycle values="odd,even"}">

Table row show/hide problem

Cross-browser solution to showing a table row since display: table-row does not appear so well supported.

Game of Life

During the first weeks of the course when there was plenty of time to spare I made myself a Game of Life in Java out of curiosity.

Amazing features included:

  • Start/stop
  • Random placement
  • Difference display (red shows cells that will die, green, those that will be born)

Source code

Toby's Huffman Compression


As I’m sure no one has noticed, recently a lot of C++ programming guides and articles have made their way into my del.icio.us bookmarks. My University’s bridging course’s algorithm project made itself the perfect cause to pick up a new language.

After various unfocused dabbling, I sat down to something more adventurous. So for my big first adventure, I choose to write an implementation Huffman’s Compression. I had just made my first binary trees and wanted something useful to do with one. Soon I found a descriptive article on the algorithm (with pictures!). Actually the pictures really helped, as I didn’t know if I was constructing the tree in a suitable way. One problem I faced was handling all the bits correctly and how to write a suitable header. I toyed with the bitset object, but in the end I wrote a wrapper for the string class to handle a stream of binary data in bit form.

For those interested, the code is available.

I wanted my version to be as much as my own code as possible, so I didn’t consult other people’s while coding. As such my code almost certainly differs from others and would not be compatible either. The only other version I have checked out is a python version. What he does in just 6k blew me away. Scripting languages have a habit of undermining compiled languages like that. However my goliath 160k compiled app (24k of code) out performed his in both speed and compression so in the end I wasn’t too put off. I think his problem with compression was more due to using cPickle to store the header as this makes it quite large.

To store a number, the smallest value C will allow you to write is 1 byte in the form of a char. This was too much for me, so I expanded my bit buffer class to write numbers even smaller! The numbers I wanted to store was the length of the character bit code (as it was variable) before the bit code, so I knew how much to use. The method I ended up using was a tally system, “[multiples-of-5]0[remainder]0”. The ones act as a tally and zero is the terminator. So, 1 would be “010”, 6 would be: “1010”, 22 would be “110110” and so on. This works well at storing small numbers (0 - 25) in less than a byte.

As x86 computers won’t let you write individual bits, you must pad up to the nearest byte. And since my output dealt with bits, it was likely the output would not round exactly to a byte, so I would need to add some empty space to make the computer happy. Other implementations put the padding at the very end. I figured this would require me to know where the body ends and ignore the rest, which might require a byte or two for storing a number. I instead stuck my padding between the header and body. I knew where the header ended as I stored how many letters as the first value. Then if I generate the body early I know it’s length. Adding the two values together I would know how much padding to pad. My method was to use 0s, terminated by a 1. When decoding it ignores the 0s, only waiting until it gets a 1 then passes control to the body decoder. The body decoder can then loop until it runs out of bits, instead of testing for a pseudo EOF. So, padding of 5 bits would be “00001” and 1 would be “1”. Sadly, the worse case is if no padding is needed, in this case a whole byte has to be added to provide padding for the 1 bit.

Encoded structure:



ogg to mp3

There are quite a few MP3->OGG converters, but I could find no ideal OGG->MP3 converters. Fortunatly, most of my music I have the original CDs for, so reripping to MP3 to put on the iPod wasnt such a big deal (with iTunes even less of a deal, one click, copied from CD to my computer, one more click and it’s on the iPod). But I have some OGGs that I don’t have the original source for, namely UT2k3’s soundtrack which was provided as OGG on the CDs, then there’s music freely available by Pajama Crisis and that Swedish band I forget. Thus, I wrote a Perl script to do the hard work of converting each one for me.

It goes something like this…

  • ogginfo to get the bitrate and tags (title, album etc)
  • oggdec to decode to WAV
  • lame to encode to MP3, using ABR (average bitrate, the same method used by ogg) and the id3v1/2 tags

You too can enjoy the wonders of ogg2mp3.pl. Requires vorbis-tools and lame.

And speaking of iTunes, as far as I’m concerned it’s very nifty. It’s ability to manage multiple id3 tags beats all the shareware apps I’ve tried. Plus having auto complete when filling in tags helps reduce typos. Since the iPod relys on the tags so much, it’s immensely usful. And then you can create smart playlists, with SQL like expressions, which I can plonk onto the iPod (they dont stay smart on the iPod, they only update when you sync, which is a shame). And that search gizmo in the top right is hella useful (not to mention damn smart).

boring post

My ACPI events handler script and my ACPI power mode toggler (call it, it’ll determine what power mode you’re in (using simple test that WFM) and be more power saving accordingly) for use with ACPID.

I have master plans for rewriting my CMS for this site, remove sections I never update (network), redo sections I never update but get looked at a lot (code) and bring and make WrapDBI, my perl DBI er… wrapper up-to-date with my ASP version.

After playing with HTML::Template I find it’s lack of includes a huge bad point, keeping multiple templates in sync (eg. the content between to ) a real nightmare if I was to use it in anything more than my test. I will look into other templating options, there’s still others out there, or write my own, but I’d rather not.

I also have plans to make a ’lite’ theme for my site (for small devices like ipaq, just for neuro) and one other which hopefully should look good, if not you’ll never see it :p


This script will open a specified URL into a new Mozilla tab, or if Mozilla isn’t running, it will start it then load the URL. This overcomes a little oddity where you can’t just call “mozilla $url” and expect it to handle it this way. I originally created this for my Logitech iTouch keyboard so I something to bind to the “homepage” key.

This program requires Perl to run and Mozilla.

mozilla-remote.pl (Plain text file)

Save the file with a .pl name, You can then assign keys to it in your Window Manager, set programs (eg. X-Chat) to use it to load URLs or run it straight from the console. All use the same syntax:

perl mozilla-remote.pl http://www.google.com/



On my Logitech iTouch keyboard I have some “media” buttons, one being mute. After assigning the keycode for it to XF86AudioMute I then created this little script to handle the action of turning mute on or off depending on it’s current state. Then its just a matter of editing your Window Managers key bindings to assining XF86AudioMute to alsa-mute.pl.

For fluxbox this meant editing “~/.fluxbox/keys” and adding the line:

None XF86AudioMute :ExecCommand perl ~/alsa-mute.pl

This program requires Perl to run and ALSA (Advanced Linux Sound Architechture) installed. You will also need to edit your Window Manager’s key bindings. An excersise left to the reader.

alsa-mute.pl (Plain text file)

Save the file with a .pl name, Edit your Window Manager’s key bindings to call it for the key you want, You can also call this straight from the console:

perl alsa-mute.pl


He's no use to me dead

I haven’t worked on the ExB project half as much as I should have recently. Today bse asked me wtf SROMMod (a plugin module for the bot) was, and I hadn’t the foggiest, I racked my brains for a few moments, I knew I had made it, it was the last thing I had done, but what on earth was it. Just as I loaded up Mozilla to rummage around the online cvs repository I remembered. SROMMod, or Sucks-Rules O’Meter, inspired by this website which fellow workmate graham pointed me at.

Basically SROMMod finds out what is better of two items. You give the bot two terms, it then googles them with the words “sucks” and “rules OR rocks” and counts the results, does a little (flawed) calculation on them and spits out a pretty graph.

I feel a little demonstration is in order:

[19:43:01] [wataru] ExB: srom leon nikita
[19:43:03] [ExB] nikita pwnz!
[19:43:04] [ExB] leon:   [--------##|#######---]
[19:43:04] [ExB] nikita: [--------##|##########]

[19:53:26] [wataru] ExB: srom starbucks suicide
[19:51:54] [ExB] suicide pwnz!
[19:51:56] [ExB] starbucks: [--########|##--------]
[19:51:56] [ExB] suicide:   [-------###|##########]

[19:53:26] [wataru] ExB: srom computers girls
[19:53:32] [ExB] computers wins!
[19:53:36] [ExB] computers: [----------|###-------]
[19:53:36] [ExB] girls:     [##########|#######---]

[19:54:56] [wataru] ExB: srom linux windows
[19:55:00] [ExB] linux wins!
[19:55:02] [ExB] linux:   [-------###|#######---]
[19:55:02] [ExB] windows: [##########|----------]

[19:55:43] [Jeff] ExB: srom wataru jeff
[19:55:46] [ExB] jeff pwnz!
[19:55:46] [ExB] wataru: [----------|----------]
[19:55:46] [ExB] jeff:   [--------##|##########]

Jeff trys to reassure me with this comment: “it’s okay, you do own though, just no one knows it”.

Mathilda 8ball

I’ve got a new (second hand) pc, which I’ve named Mathilda. It will probably end up as my fileserver, but until I can get the network card recognised, it aint gunna be nothing.

And I havent uploaded a screenshot in a while, so I did (300k) :P.

On the ExB front, I’ve made another module cause I was bored, a simple 8Ball module, ask it a question and it will answer it with near 100% accuracy :). Here is a little example of 8BallMod in use, utilising the new IKnowTheAnswer(tm) Technology.

[09:05:43]<Xenith> ExB: does wataru love me?
[09:05:44]<ExB> My reply is no.
[09:05:46]<Xenith> Hmm
[09:05:52]<Xenith> That'd be why I'm not getting email from him
[09:05:59]<Xenith> ExB: do people love me anymore?
[09:05:59]<ExB> Yes.
[09:06:07]<Xenith> ExB: then why aren't they sending me email?
[09:06:07]<ExB> Who knows?

We recently released version 0.2 of ExB, we have big plans for 0.3.


I’m still coding away on the ExB project. I’ve re-done the site so that it is now powered by PHP and XML. It was a nice learning experience teaching myself PHP, although it seems something of an odd mix (eg. the function names are somewhat inconsistant strlen and str_replace, why isnt it str_len or strreplace?). So Perl still remains my prefered web server side language.

XML is just blooming marvelous. I’m finding lots of uses for that, Java and PHP have built in support, Perl has some great extensions (which I havnt tried). XML is quite simply a file format, just like comma seperated or databases. Its power lies in the fact its highly portable (it can be used on mulitple operating systems), is easy to debug (its in plain text, so you can open up a text editor to find any problems), lots of languages are moving to have built in support.

Pinky ponder server

I was bored so I tweaked my BOFH excuse server and made myself a Pinky Ponder server.

Are you pondering what I’m pondering?

Uh, I think so, Brain, but where will we find a duck and a hose at this hour?


ExB http://exb.sf.net/ is an IRC bot that’s abilities can be expanded by adding modules. It’s written entirely in Java, which means it is fully OS independent (a great feature in any program). I’ve been coding like crazy making modules for this, which has allowed me to learn a great deal about the Java language, for which I had no previous experience.

I hope to use Java in the future instead of MICROS~1 Visual Basic.

Password list maker

I’ve created a password list maker that can be used to replace randomly generated passwords, eg: “j5DxaE”, which are tricky to remember, with bunched up words like “AegeonBagot” that are far easier.

My first VRML

VRML (Virtual Reality Modelling Language) is used to create 3D worlds that can be downloaded and viewed in a web browser, however the technology never really caught on, that did not stop me making a world.

For my Mutlimedia HND (Higher National Diploma) today I made a simplistic model of our solar system.

It is purly to demonstrate VRML, much better things can be achieved with more time. The whole world is 36.8kb so should take about 5-10s to download on a 56k modem.

To view VRML worlds you need a plug-in for your browser.

If you dont already have a VRML (version 1.0 compatible) viewer, and you are using either Internet Explorer or Netscape I recommend you get Cortona (there are others, but this is the best I have found, quick and easy to install).

To get the required parts of Cortona:

  • First visit this page to get the plug-in (984kb, 2m33s on 56k modem).
  • Then you need to get it’s 1.0 converter here (32kb, 5s on 56k modem).

Cortona is compatible with VRML 2.0 by default, this 1.0 converter lets it read the older format. The only reason I coded this in 1.0 format is because its quicker to write and learn.

related links