Skip to content

Instantly share code, notes, and snippets.

Going underground

Dominic Sayers dominicsayers

Going underground
View GitHub Profile
dominicsayers / gist:9746698
Created Mar 24, 2014
Keybase proof of identity
View gist:9746698
### Keybase proof
I hereby claim:
* I am dominicsayers on github.
* I am dominicsayers ( on keybase.
* I have a public key whose fingerprint is CF56 1682 3C17 C7F2 58E0 85BC D60F 652E ADD7 362A
To claim this, I am signing this object:
dominicsayers / gist:75878d76c0aa6f4a3c15
Created Dec 21, 2014
Add a "dev" command to go to the correct project folder
View gist:75878d76c0aa6f4a3c15
# At the end of .bashrc
dev () {
cd "$HOME/Development/$1"
View gist:83bca1974457faa71fb5
Verifying that +dominicsayers is my openname (Bitcoin username).
dominicsayers / registerable.rb
Last active Aug 29, 2015
Registerable concern
View registerable.rb
module Registerable
extend ActiveSupport::Concern
module ClassMethods
# Register a new record or return an existing one. This version will work
# in a highly-concurrent environment where multiple process are updating
# this model, but it's slower than `fast_register`.
def safe_register(attributes = {})
create! unique_values(attributes)

Removing all secrets from the repo

  1. Deployment to production is from CircleCI.
  2. The deployment command is configured in circle.yml, which is checked into the repo and cannot contain any secrets.
  3. CircleCI can have env vars configured
  4. circle.yml is passed through ERB [check], so we can add secret parameters to the deployment command using erb, e.g. foreplay deploy production -u <%= ENV['DEPLOYMENT_USERNAME'] %> -p <%= ENV['DEPLOYMENT_PASSWORD'] %>
  5. The secret credentials can be used to connect to a remote service and download the remainder of the production secrets.
  6. The secrets can be included in the .env file created by Foreplay and become part of the production runtime environment.
dominicsayers / cloudmailin-mailapp.json
Created Jun 6, 2015
JSON sent by Cloudmailin (sent from OS X Mail app - Bcc header not set)
View cloudmailin-mailapp.json
"headers": {
"Return-Path": "",
"Received": [
"by wibut5 with SMTP id ut5so50815534wib.1 for <>; Sat, 06 Jun 2015 14:31:21 -0700",
"from [] ( []) by with ESMTPSA id q4sm16773563wju.14.2015. (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 06 Jun 2015 14:31:20 -0700"
"Date": "Sat, 06 Jun 2015 22:31:18 +0100",
"From": "Dominic Sayers <>",
"To": "To1 <>, To2 <>",
dominicsayers / cloudmailin-gmail.json
Last active Aug 29, 2015
JSON sent by CloudMailin (sent from Gmail - Bcc header is set)
View cloudmailin-gmail.json
"headers": {
"Received": [
"by lbio15 with SMTP id o15so1647431lbi.1 for <>; Sat, 06 Jun 2015 08:19:30 -0700",
"by with HTTP; Sat, 06 Jun 2015 08:19:30 -0700"
"Date": "Sat, 06 Jun 2015 16:19:30 +0100",
"From": "Dominic Sayers <>",
"To": "To1 <>, To2 <>",
"Cc": "Cc1 <>, Cc2 <>",
dominicsayers / preferences.js
Last active Aug 29, 2015
Sublime Text preferences
View preferences.js
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
// Set to true to removing trailing white space on save
"trim_trailing_white_space_on_save": true,
dominicsayers / gist:4217521
Last active Oct 13, 2015
Configuring BIND using Webmin
View gist:4217521
  1. I installed BIND during the Ubuntu setup process by selecting DNS Server when asked for package selections.
  2. Click Create Master Zone
  3. Enter for Domain Name/Network and click Create
  4. Add A-records
  5. Apply Zone
  6. Apply configuration
dominicsayers /
Last active Dec 12, 2015
Cloning an Ubuntu guest machine in Virtualbox

Cloning an Ubuntu guest on Virtualbox

Cloning a VM is easy in theory but if you don't set up networking properly in the newly cloned machine it can kill all networking on the host.

In particular, Virtualbox gives your cloned machine a new NIC with a new MAC code. This is probably what you want since you don't want multiple machines on your network with the same MAC address. But Ubuntu still has the NIC from the original machine in one of its configuration files, so there's a clash between the hardware created by Virtualbox and the Ubuntu VM's own view of the world.*

Simple but tedious to fix. Here goes, on the Virtualbox host machine:

  1. su vbox
  2. VBoxManage clonevm original_vm_name --name new_vm_name --register
You can’t perform that action at this time.