RSSAmplifier

Blog

Caius Theory

Recent content on Caius Theory

caiustheory.comRSS feed ↗132 posts

Latest posts

Opening Streetka Boot without Key

For the Ford StreetKA 1.6 convertible (first generation), presumably sold anywhere but this one is from the UK. One day you shut the boot and as it clicks home, you realise you’ve just locked the only car key you have with you inside the boot. The spare is 80+ miles away at home. The car is otherwise unlocked, but the boot is an electronic release. The handbook lists two ways to open the…

jj jj jj jj jj

In a similar vein to git git git git git , if you&rsquo;re using jj and find you&rsquo;ve accidentally typed one jj too many in the command line, it errors at you. In this case we&rsquo;re trying to pull the id of the current changeset we&rsquo;re editing: $ jj jj show -T 'change_id.short()' error: unrecognized subcommand 'jj' Usage: jj [ OPTIONS ] <COMMAND> For more information, try '--help' .…

Apple Watch Band Mnemonic

I&rsquo;ve been wearing an Apple Watch pretty regularly for nearly a decade at this point (October 2015), and have picked up a few bands over time that I swap between. Commonly I&rsquo;ll swap from a fabric based band to a rubber/silicone based band when doing DIY or sports as they seem to stand up better over time to those activities. Without fail every single time I swap the band I have to think…

Set Up Rails Activestorage With Azure Securely

Ruby on Rails has built-in support for managing uploaded files with ActiveStorage , which both cleans up your application code and acts as an abstraction over different storage backends. Azure Storage is one of the supported backends, but configuring it securely can take a little figuring out. The most sensible way I&rsquo;ve found to have it configured is with files stored having no public…

Programatically invoke rake task with --trace enabled

Rake is a Make-like program implemented in Ruby (to quote the website.) It contains tasks written in ruby code you can invoke from the command line. These can run prequisite tasks first too, in this case we configure the setup task to be invoked before the work task is ever invoked. task :setup do puts 'Setting up' end task work : :setup do puts 'Doing work' end $ rake work Setting up Doing work…

Running OmniOS via UTM on Apple Silicon

Wanted to fire up OmniOS to play with and didn&rsquo;t have any spare x86 hardware to hand so decided to figure out running it in UTM on Apple Silicon, meaning it needs emulation as OmniOS is x86 only. Grab the ISO from the OmniOS downloads page , I used the LTS release but the current stable should work too. Just make sure it&rsquo;s the ISO version, not USB, etc. Open UTM and click &ldquo;Create…

Upgraded Dekoni Earpads for Sony WH-1000XM3 Headphones

Back in 2019 I picked up a pair of Sony WH-1000XM3 Headphones for using in the office. Very useful and work well in an office and on public transport. After a while I was finding my ears were getting quite hot when wearing them all day, especially on hotter days in the summer. The original earpads had a shiny synthetic surface, after some research I happened across Dekoni&rsquo;s Synthetic Suede…

`asdf install ruby` on macOS

Installing ruby through asdf on Apple Silicon Macs 1 will attempt to build a custom OpenSSL for each install because it can&rsquo;t find OpenSSL from homebrew in /usr/local , as that&rsquo;s now installed in /opt/homebrew . This means your brew update no longer pulls in security fixes for your ruby runtimes, as well as wasting disk space. Ruby 2.6.10 & 2.7.x need OpenSSL 1.1, and are unsupported…

@fediverse@twitter via ///

An amusing idea from @xor@mastodon.xyz for Mastodon instance names (which form part of your username) has been taking three word phrases from Moby Dick and trying to find available domain names, so you could host your instance at famous.whaling.house for example. Parker has since blogged his idea and some examples which is well worth a read and explains it in more depth, as well as explaining how…

iLO 4 Firmware Upgrade

HP Microserver Gen8 machines have a HP iLo 4 built in for remote hands management. These are effectively a separate, embedded computer inside the server 1 , which also means it has its own software (firmware) running on it and needs updating separately. HP are still releasing firmware updates for the iLo 4, and whilst it&rsquo;s possible to update them from inside the host OS on the server, you…

Shawbury 10km 2021

RAF Shawbury host an annual 10km running race, and I entered this time because a friend suggested it as an event to aim for over the summer. Given the run is along runways/taxiways it&rsquo;s going to be one of the flattest courses on offer. Seemed like a good idea at the time. Got there with plenty of time to register, figure out where the important things—coffee & ice cream vans—were and go for…

Fix Edgerouter DHCP ? entries

Occasionally I end up with devices on the local network that don&rsquo;t emit their hostname over DHCP, so when listing the current leases on the EdgeRouter&rsquo;s cli, they just appear as &ldquo;?&rdquo;. 1 These usually just irritate me, but occasionally when I&rsquo;m looking for a machine on the network it means I can&rsquo;t find it and end up poking the different &ldquo;?&rdquo; IPs using…

Cleaning BODUM Bistro Coffee Grinder

I&rsquo;ve owned a BODUM Bistro Coffee Grinder for a number of years, and aside from occasionally running rice through to clean the grinding surfaces haven&rsquo;t had any issues with it. Recently bought some new beans which are much oilier than ones I usually get, and after running most of them through ended up with the grinder failing to work. The failure was the mechanism sounding like it was…

Disable Google Autoupdater on macOS

From reading Chrome is Bad , it seems in some situations the updater (also known as keystone) can chew up CPU cycles. Whilst I&rsquo;m not 100% convinced keystone continuously chews CPU, its launchctl configuration suggests it runs at least once an hour. Given I don&rsquo;t use Chrome as my main browser, this is undesirable behaviour for me. With that in mind, I&rsquo;ve decided to disable the…

Let's Peek: A tale of finding "Waypoint"

Following a product launch at work earlier this year, I theorised if someone was watching the published lists of SSL Certificates they could potentially sneak a peak at things before they were publicised. Probably far too much noise to monitor continuously, but as a potential hint towards naming of things with a more targeted search it might be useful. Sites like https://crt.sh/ and…

Tailscale, RFC1918, and DNS Rebinding Protection

Edit: Originally this post was written to be a workaround for Tailscale routing all DNS traffic over its own link when you configured it to push out existing DNS Server IPs. This turned out to be a bad assumption on my part. Thanks to apenwarr for helping me understand that shouldn&rsquo;t be the case, and encouraging me to debug it properly rather than making assumptions. Naturally it turned out…

RSpec Given/When/Then with symbols

Having a need to write some BDD-esque tests without the need of putting them in front of non-technical people, I was recently playing around with rspec feature specs . Where I&rsquo;ve used these previously we&rsquo;ve eventually run into curation issues where the specs are outdated, brittle and require so much maintenance we&rsquo;ve generally ended up lobbing cucumber into the project as a…

curl --resolve

Sometimes it&rsquo;s useful to be able to craft a request to one server, using a DNS name that&rsquo;s either not defined or currently pointed to a different IP. (Migrating webservers, testing a new webserver config out, etc.) Historically for HTTP calls this was easy, just set the Host header as you make the http request to the IP directly: curl -H "Host: caiustheory.com" http://10.200.0.1/…

Cheaper Oil for Mini One R50

My Mini One 2003 R50 1.6 litre petrol engine takes specific BMW 5w30 Longlife-04 oil. (I believe the R52 and R53 models take the same oil too.) The oil is 5w30 fully synthetic made to BMW&rsquo;s exacting standards. The cheapest I&rsquo;ve found to buy currently is a GM (Vauxhall/Opel) manufactured one, made to BMW&rsquo;s specifications. Searching for something like &ldquo;dexos 2 5w30 gm&rdquo;…

Download All Your Gists

Over time I&rsquo;ve managed to build up quite the collection of Gists over at Github, including secret ones there&rsquo;s about 1200 currently. Some of these have useful code in, some are just garbage output. I&rsquo;d quite like a local copy either way, so I can easily search 1 across them. Install the gist command from Github brew install gist Login to your Github Account through the gist tool…

Prefixing Git Branch With Initials

Working somewhere where we prefix our branches with the creator&rsquo;s initials, I sometimes forget to do so. 1 This leads to me having to rename the branch, typing out the whole name again after adding cd/ to the start of it. Computers are meant to solve repetitive problems for us, so let&rsquo;s put it to work in this case too. My ~/bin contains git current-branch , which returns the current…

Struct-uring your data

In Ruby it&rsquo;s easy to structure data in hashes and pass it around, and usually that leads to errors with calling methods on nil , or misspelling the name of a key, or some such silly bug that we might catch earlier given a defined object with a custom Class behind it. But it&rsquo;s so much work to create a Class just to represent some grab bag of data we&rsquo;ve been handed, right? Well,…

Running rails tests under CircleCI 2.0 with MariaDB

CircleCI have released their version 2.0 platform, which is based on top of docker and moves the configuration for each project into a config file in the git repository. They have a bunch of documentation at https://circleci.com/docs/2.0/ . Basic gist is the config file lives at .circleci/config.yml and defines which images to run a series of commands in. You can either specify jobs to run in…

Overcommit git hooks: puppet validate

Computers are great at automatically checking things, and git has a mechanism for running hooks before events happen. Bosh these two things together and you can have git trigger anything you like before you&rsquo;re allowed to commit, which in turn means you can sanity check exactly what you&rsquo;re committing to make sure it meets whatever criteria you have. To make it easy to manage my git…

Cleaning up locally installed Rubies & Gems

Given the following is broadly true: Rubies installed to ~/.rubies (via ruby-install most likely) Gems for each ruby version installed under ~/.gem (via chruby most likely) What to do when you want to reclaim some disk space? Delete unused ruby versions of course! Pretty straight forward, look in ~/.rubies for ones you want to remove, then delete them. $ ls ~/.rubies ruby-2.0.0 ruby-2.1.7…

Something Goes Here

Something goes here and something else over there slowly wrapping lines a little each time oh no, you fucked up one little comma and now everything is running away drastically from you End it.

git git git git git

Ever found you&rsquo;ve accidentally entered too many git s in your terminal and wondered if there&rsquo;s a solution to it? I quite often type git then go away and come back, then type a full git status after it. This leads to a lovely (annoying) error out the box: $ git git status git: 'git' is not a git command. See 'git --help' . What a git. My initial thought was overriding the git binary in…

Upgrading Microserver G8 CPU

My home server is a HP Proliant Microserver Gen 8 , which is modestly powerful and runs everything I need at home in a fairly compact footprint without being too noisy or power hungry. Both the G8 and the previous revision, the G7, are moderately expandable in terms of memory & storage devices. (Not least of which is an internal USB port, which is useful plugging the SmartOS boot device into, no…

Wenlock Olympian Triathlon 2017

Second year in a row doing this Tri, last year I came away feeling like I hadn&rsquo;t given it my best and wanted to return to complete unfinished business. (Spoilers: I managed better this year.) 500m Swim: 00:10:37 ( Strava ) Started last in a lane of three, didn&rsquo;t get overtaken which meant swimming at my own pace without being under pressure was easily achieved. Failed to exit the pool…

Raspberry Pi 3 as an emergency router

Given a dead router, how do you get back online whilst you wait for the replacement part to arrive? Grab a Raspberry Pi 3 off the shelf, along with a USB to Ethernet adapter and hey presto the internet works again. This is with a fibre modem (FTTC), using PPPoE to connect out. Plug the modem (WAN) into the RPi&rsquo;s ethernet port, and plug the LAN switch into the USB adapter. First thing is to…

Finding cheap Microserver G8 memory

I&rsquo;ve been wanting to drop more memory in my HP Microserver G8 , but hoping to find a cheaper alternative to buying new sticks from Crucial . I needed one or two 4GB sticks, but they had to be ECC of course. At the time of writing (May 2017), Crucial&rsquo;s offering for the G8 shows a 4GB stick to be £43.19, and an 8GB stick to be £81.59. This was a little more than I wanted to pay, but I…

Bash script setup

Recently I&rsquo;ve been writing a bunch of bash scripts for various things. As some up-front safety checks I&rsquo;ve taken to opening every script with the following: #!/usr/bin/env bash [[ ' $TRACE ' ]] && set -o xtrace set -o errexit set -o nounset set -o pipefail set -o noclobber Other things I&rsquo;m also trying to be good about doing: using readonly when declaring variables which…

BMW 328i crankshaft sensor issue

My 1996 e36 BMW 328i Convertible was having trouble starting, and it&rsquo;s always broken up slightly at idle since I took ownership of the car. On a couple of hot days last summer it also stalled during idle, then started doing it again recently (even though the ambient temperature was much colder.) The main sympton at the point I took notice was it struggling to start, then hunting at idle…

Stop HealthKit causing SIGABRT

You have some crazy idea for an iOS app that uses HealthKit so you fire up Xcode, create a new project & add the HealthKit entitlement. Follow the tutorial to request authorization from the HKHealthKitStore . Hit run to make sure the app compiles and find that it instantly crashes with a SIGABRT in AppDelegate . Puzzled by this you go over the minimal amount of code you&rsquo;ve added and pare it…

Remove OS X Disk Password

I recently reinstalled a laptop and in doing so setup full disk encryption in a slightly strange fashion. The basic flow I followed was: Boot into Recovery mode (hold ⌘-R at boot) Erase the internal HD as HFS+ (Journaled, Encrypted) and set a disk password Install OS X onto the internal disk During setup, use Migration Assistant to copy clone containing previous install data from backup disk This…

Find dependencies blocking rails upgrades

The initial pain point when upgrading a rails app is figuring out which of your dependencies are blocking you upgrading the actual rails gem (& immediate dependencies, actionpack, etc.). One way to start this is to update the rails dependency in your Gemfile and run bundle update rails . Then check the error output (it never works first time…) to see which gems are blocking the upgrade. Repeat,…

SmartOS Recovery mount /usbkey

Recently I managed to hose a box in a perfectly self-inflicted storm of idiocy. Imagine a SmartOS server with the following issues: Root password not noted down anywhere /usbkey/config edited badly, meaning the network settings are wrong Rebooting the server to apply some other settings Needless to say, this caused a tiny issue in the server doing what it&rsquo;s supposed to. Luckily I had access…

Much Wenlock Triathlon 2016

500m Pool Swim: 00:11:34 Felt good setting off, within a couple of lengths felt like I had no energy. Didn’t have enough to eat/drink during the morning before starting, really makes a huge difference once you set off. Must remember to replace my goggles at some point too, the strap comes loose without warning. Transition 1: 00:03:06 Rough time for transition. Legs felt good as soon as I was out…

Setup DHCP interface in FreeBSD

Given a FreeBSD instance without a configured network interface that you&rsquo;d like to configure, first check what the name of the interface you want to configure is with ifconfig . (Mine is em0 in this instance.) Then we need to add the configuration telling services that we want to use DHCP for this interface, and setting up our default router (use your IP, not mine!) too: cat >> rc.conf…

SoundCloud RSS Feeds

SoundCloud appears to have gained popularity in recent times for hosting podcasts on. As a consumer of their service they&rsquo;re pretty good at everything except having a visible RSS feed on a profile page for a show! If I want to listen to a show in my podcast app of choice, an RSS feed is the easiest way for me to achieve that. Turns out SoundCloud do have RSS feeds, they&rsquo;re just well…

exec(3) in Go

Using exec(3) from Go is simple enough, once you figure out to look in the syscall package and how to pass arguments to the new command. As a simple example, I&rsquo;m going to exec /bin/echo with a hardcoded string from the go binary. The program built here is in the gecho (Gecko, geddit?) git repo, which each stage as a commit. In our main function lets setup some variables we&rsquo;re going to…

Changing hostname in SmartOS Zone

Given a non-global zone in SmartOS that we want to change the hostname of, we need to make sure to edit the following files to change it: /etc/hosts /etc/nodename A quick way to do that is with sed (renaming &ldquo;fred&rdquo; to &ldquo;beth&rdquo; here) : sed -e 's/fred/beth/g' -i /etc/hosts /etc/nodename Then shutdown & start the zone (from my testing a restart doesn&rsquo;t apply it) .

Install Rubinius on OS X

Using ruby-install , homebrew building it for use with chruby , here&rsquo;s how I install Rubinius under Yosemite (works for Mavericks as well.) Make sure llvm is installed $ brew install llvm Prepend the homebrew-installed llvm tools to your path $ export PATH="$(brew --prefix llvm)/bin:$PATH" # Or, for ZSH $ path=( $(brew --prefix llvm)/bin $path ) Install rubinius, v2.3.0 at the time of…

Changing root password in global zone

SmartOS mounts /etc/shadow from /usbkey/shadow so we can change the root password for the global zone after install. Here&rsquo;s how: Fire up a console or ssh session as root in the global zone Check the existing permissions on the file $ ls -l /usbkey/shadow -r-------- 1 root root 560 Oct 19 16:45 /usbkey/shadow Make the file writable $ chmod 600 /usbkey/shadow Fire up vi to edit the file $ vi…

Compiling SmartOS for AMD processors

There&rsquo;s a few community-provided patches for SmartOS that enable KVM on AMD processors amongst other things, and given the HP Microserver has an AMD processor, that&rsquo;s quite useful for turning it into a better lab server. The main list of so called &ldquo;eait&rdquo; builds was hiccuping when I tried to download the latest, and all I could find was a 20140812T062241Z image here . The…

The People's Triathlon 2014

My first Olympic distance triathlon, and the first time I&rsquo;ve ever run 10km to boot. 1500m Open Water (Freshwater Lake) Swim: 00:38:08 Equally happy and upset with my swim. Basically everything went well except my wetsuit, must get a proper swimming one (possibly sleeveless) before my next wetsuit event. Having to get out at the end of each lap and run down the bank to re-enter the water was…

Solve volume down button not working on iPhone 5

I noticed this morning that my volume down button (-) wasn&rsquo;t working on my iPhone 5 running iOS 7. Pushing the physical button in didn&rsquo;t change the volume. The volume up button increased the volume successfully still. As is my normal first step debugging iPhone weirdness, I rebooted the phone by turning it off, leaving it off for a few seconds, then booting it back up with the power…

Compile & run swift files directly

Turns out you can run a swift file without having to compile it into a binary somewhere and then run that binary. Makes swift behave a bit more like a scripting language like ruby or python when you need it to. Using the xcrun binary, we can reach into the current Xcode /bin folder and run binaries within there. So xcrun swift lets you run the swift binary to compile files for instance. If you…

Cheshire Triathlon 2014

Successfully completed my second Sprint Triathlon of the season in Nantwich. 500m Swim - 00:10:49 Felt good swimming this. Mixed up my usual breaststroke with some front crawl to overtake and use my legs less towards the end. Think I need to put a shorter time down on paper next time though, was in with people who were swimming much slower than me. (Including one chap who was doing doggy paddle in…

York April 2014 Triathlon

Completed the York sprint distance tri in 1:28:37 total, and didn&rsquo;t die in the process. Split times & my thoughts below.. 400m Swim: 00:08:08 T1: 00:03:47 18km Bike: 00:38:43 T2: 00:00:58 5km Run: 00:38:08 (Amusingly the official time for my swim was 00:10:10, which then makes my official time for T1 00:00:38; Fastest Swim/Bike transition time in the tri on paper! Ahem.) Happy with my swim,…