Quick hack: extracting the contents of a Docker image to disk

Hello! Please note I've written a little python tool called Occy Strap which makes this a bit easier, and can do some fancy things around importing and exporting multiple images. You might want to read about it? For various reasons, I wanted to inspect the contents of a Docker image without starting a container. Docker makes it easy to get an image as a tar file, like this: docker save -o foo.tar image But if you extract that tar file you'll find a configuration file and manifest as JSON files, and then a series of tar files, one per image layer. You use the manifest to determine in what order you extract the tar files to build the container filesystem. That's fiddly and annoying. So I wrote this quick python hack to extract an image tarball into a directory on disk that I could inspect: #!/usr/bin/python3 # Call me like this: # docker-image-extract tarfile.tar extracted import tarfile import json import os import sys image_path = sys.argv[1] extracted_path = sys.argv[2] image = tarfile.open(image_path) manifest = json.loads(image.extractfile('manifest.json').read()) for layer in manifest[0]['Layers']: print('Found layer: %s' % layer) layer_tar = tarfile.open(fileobj=image.extractfile(layer)) for tarinfo in layer_tar: print(' ... %s' % tarinfo.name) if tarinfo.isdev(): print(' -->…

Continue ReadingQuick hack: extracting the contents of a Docker image to disk

Mastermind in JavaScript

I've been learning JavaScript for the last few days, and I figured I'd implement Jacqui's favourite board game as a learning exercise. Jacqui loves a simple colour guessing game called Mastermind. In the game someone picks four coloured pins and then the player has to progressively guess what those colours are. In my JavaScript version the computer picks four colours, and you need to work out what they are. Click on the white squares to cycle through colours and then hit the "guess" button when you're ready to see how many you got right. The gray boxes in the top row will progressively reveal their colours as you guess them. The code is here, and the game can be played here.

Continue ReadingMastermind in JavaScript

A nerd snipe, in which I reverse engineer the Aussie Broadband usage API

  • Post author:
  • Post category:AussieBB

I was curious about the newly available FTTN NBN service in my area, so I signed up to see what's what. Of course, I need a usage API so that I can graph my usage in prometheus and grafana as everyone does these days. So I asked Aussie. The response I got was that I was welcome to reverse engineer the REST API that the customer portal uses. So I did. I give you my super simple implementation of an Aussie Broadband usage client in Python. Patches of course are welcome. I've now released the library on pypi under the rather innovative name of "aussiebb", so installing it is as simple as: $ pip install aussiebb

Continue ReadingA nerd snipe, in which I reverse engineer the Aussie Broadband usage API

Raspberry Pi HAT identity EEPROMs, a simple guide

I've been working on a RFID scanner than can best be described as an overly large Raspberry Pi HAT recently. One of the things I am grappling with as I get closer to production boards is that I need to be able to identify what version of the HAT is currently installed -- the software can then tweak its behaviour based on the hardware present. I had toyed with using some spare GPIO lines and "hard coded" links on the HAT to identify board versions to the Raspberry Pi, but it turns out others have been here before and there's a much better way. The Raspberry Pi folks have defined something called the "Hardware On Top" (HAT) specification which defines an i2c EEPROM which can be used to identify a HAT to the Raspberry Pi. There are a couple of good resources I've found that help you do this thing -- sparkfun have a tutorial which covers it, and there is an interesting forum post. However, I couldn't find a simple tutorial for HAT designers that just covered exactly what they need to know and nothing else. There were also some gaps in those documents compared with my experiences, and…

Continue ReadingRaspberry Pi HAT identity EEPROMs, a simple guide

Trail run: the base of Urambi Hill

  • Post author:
  • Post category:Trail run

This one has been on my list for a little while -- a nice 10km loop around the bottom of Urambi Hill. I did it as an out and back, although there is a loop option if you cross the bridge that was my turn around point. For the loop option cross the bridge, run a couple of hundred meters to the left and then cross the river again at the ford. Expect to get your feet wet if you choose that option! Not particularly shady, but nice terrain. There is more vertical ascent than I expected, but it wasn't crazy. I haven't posted pictures of this run because it was super foggy when I did it so the pictures are just of white mist. [kml: 20190609-1]

Continue ReadingTrail run: the base of Urambi Hill

What is Gang Scan?

  • Post author:
  • Post category:Gang Scan

Gang Scan is an open source (and free) attendance tracking system based on custom RFID reader boards that communicate back to a server over wifi. The boards are capable of queueing scan events in the case of intermittent network connectivity, and the server provides simple reporting.

Continue ReadingWhat is Gang Scan?

1-Wire home automation tutorial from linux.conf.au 2019, part 3

This is the third in a set of posts about the home automation tutorial from linux.conf.au 2019. You should probably read part 1 and part 2 before this post. In the end Alistair decided that my home automation shield was defective, which is the cause of the errors from the past post. So I am instead running with the prototype shield that he handed me when I started helping with the tutorial preparation. That shield has some other bugs (misalignments of holes mainly), but is functional apart from that. I have also decided that I'm not super excited by hassos, and just want to run the orangepi with the OWFS to MQTT gateway into my existing home assistant setup if possible, so I am going to focus on getting that bare component working for now. To that end, the gateway can be found at https://github.com/InfernoEmbedded/OWFS-MQTT-Bridge, and is a perl script named ha-daemon.pl. I needed to install some dependancies, which in my case were for armbian: $ apt-get install perl libanyevent-perl cpanminus libdist-zilla-perl libfile-slurp-perl libdatetime-format-strptime-perl $ dzil listdeps | cpanm --sudo Then I needed to write a configuration file and put it at ha.toml in the same directory as the daemon.…

Continue Reading1-Wire home automation tutorial from linux.conf.au 2019, part 3

Mount Bimberi on a Scout Bushwalking Course

Julian Yates kindly ran a bushwalking course for Scouts Australia over the last five days, which covered walking in Uncontrolled Terrain (the definition in the Australian VET scheme for the most difficult bushwalking -- significant off track navigation in areas where emergency response will be hard to get). I helped with some of the instruction, but was also there working on my own bushwalking qualifications. The walk was to Mount Bimberi, which is the highest point in the ACT. We started with a short night walk into Oldfield's Hut on Friday night after a day of classroom work. The advantage of this was that we started Saturday at Oldfield's Hut, which offered morning views which did not suck. [kml: 20190524-1] On Saturday morning we walked up to Mount Bimberi via Murray's Gap. This involved following the ACT / NSW border up the hillside, which was reasonably well marked with tape and cairns. Our route on the way to Bimberi: [kml: 20190525-1] And the way back: [kml: 20190525-2] On Sunday we walked back out to the cars and did the three hour drive back to Canberra. I'll include the walk out here for completeness: [kml: 20190526-1]

Continue ReadingMount Bimberi on a Scout Bushwalking Course

A nerd snipe, in which I learn to read gerber files

So, I had the realisation last night that the biggest sunk cost with getting a PCB made in China is the shipping. The boards are about 50 cents each, and then its $25 for shipping (US dollars of course). I should therefore be packing as many boards into a single order as possible to reduce the shipping cost per board. I have a couple of boards on the trot at the moment, my RFID attendance tracker project (called GangScan), and I've just decided to actually get my numitrons working and whipped up a quick break out board for those. You'll see more about that one later I'm sure. I decided to ask my friends in Canberra if they needed any boards made, and one friend presented with a set of Gerber CAM files and nothing else. That's a pain because I need to know the dimensions of the board for the quoting system. Of course, I couldn't find a tool to do extract that for me with a couple of minutes of Googling, so... I decided to just learn to read the file format. Gerber is well specified, with a quite nice specification available online. So it wasn't too hard…

Continue ReadingA nerd snipe, in which I learn to read gerber files

Gangscan 0.6 boards

  • Post author:
  • Post category:Gang Scan

So I've been pottering away for a while working on getting the next version of the gang scan boards working. These ones are much nicer: thicker tracks for signals, better labelling, support for a lipo battery charge circuit, a prototype audio circuit, and some LEDs to indicate status. I had them fabbed at the same place as last time, although the service was much faster this time around. I haven't got as far as assembling a board yet -- I need to get some wire thin enough for the vias before I can do that. I'll let you know how I go though.

Continue ReadingGangscan 0.6 boards

End of content

No more pages to load