Skip to content

Instantly share code, notes, and snippets.

View dominicsayers's full-sized avatar
☣️
I'm back

Dominic Sayers dominicsayers

☣️
I'm back
View GitHub Profile
@dominicsayers
dominicsayers / gist:9746698
Created March 24, 2014 18:54
Keybase proof of identity
### Keybase proof
I hereby claim:
* I am dominicsayers on github.
* I am dominicsayers (https://keybase.io/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
dominicsayers / gist:75878d76c0aa6f4a3c15
Created December 21, 2014 10:58
Add a "dev" command to go to the correct project folder
# At the end of .bashrc
dev () {
cd "$HOME/Development/$1"
}
@dominicsayers
dominicsayers / gist:83bca1974457faa71fb5
Created March 11, 2015 09:38
OneName verification
Verifying that +dominicsayers is my openname (Bitcoin username). https://onename.com/dominicsayers
@dominicsayers
dominicsayers / registerable.rb
Last active August 29, 2015 14:17
Registerable concern
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 = {})
begin
create! unique_values(attributes)
@dominicsayers
dominicsayers / production_credentials.md
Last active August 29, 2015 14:19
Production credentials

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
dominicsayers / cloudmailin-gmail.json
Last active August 29, 2015 14:22
JSON sent by CloudMailin (sent from Gmail - Bcc header is set)
{
"headers": {
"Received": [
"by lbio15 with SMTP id o15so1647431lbi.1 for <smartangel@xenapto.me>; Sat, 06 Jun 2015 08:19:30 -0700",
"by 10.112.72.99 with HTTP; Sat, 06 Jun 2015 08:19:30 -0700"
],
"Date": "Sat, 06 Jun 2015 16:19:30 +0100",
"From": "Dominic Sayers <dominic.sayers@gmail.com>",
"To": "To1 <to1@xenapto.com>, To2 <to2@xenapto.com>",
"Cc": "Cc1 <cc1@xenapto.com>, Cc2 <cc2@xenapto.com>",
@dominicsayers
dominicsayers / cloudmailin-mailapp.json
Created June 6, 2015 21:34
JSON sent by Cloudmailin (sent from OS X Mail app - Bcc header not set)
{
"headers": {
"Return-Path": "dominic@xenapto.com",
"Received": [
"by wibut5 with SMTP id ut5so50815534wib.1 for <smartangel@xenapto.me>; Sat, 06 Jun 2015 14:31:21 -0700",
"from [192.168.1.75] (host86-150-30-216.range86-150.btcentralplus.com. [86.150.30.216]) by mx.google.com with ESMTPSA id q4sm16773563wju.14.2015.06.06.14.31.20 (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 <dominic@xenapto.com>",
"To": "To1 <to1@xenapto.com>, To2 <to2@xenapto.com>",
@dominicsayers
dominicsayers / preferences.js
Last active August 29, 2015 14:22
Sublime Text preferences
{
// 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
dominicsayers / gist:4217521
Last active October 13, 2015 15:37
Configuring BIND using Webmin
  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 al.gy for Domain Name/Network and click Create
  4. Add A-records
  5. Apply Zone
  6. Apply configuration
@dominicsayers
dominicsayers / Virtualbox_clone_Ubuntu_guest.md
Last active December 12, 2015 09:19
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