Skip to content

Instantly share code, notes, and snippets.

View codeinthehole's full-sized avatar
🌏
The main difference between dinosaurs and us is we're building our own meteor.

David Winterbottom codeinthehole

🌏
The main difference between dinosaurs and us is we're building our own meteor.
View GitHub Profile
@codeinthehole
codeinthehole / .bashrc
Created February 3, 2017 11:24
Prompt in bashrc
# ======
# PROMPT
# ======
# Set the prompt
# - Specify colors using \e[31;40m where 31 is the color and 40 is the background or
# - Select 1 for bold.
# - Wrap color specifiers in \[ and \] to ensure they don't affect word wrapping
# - Colours 30=black, 31=red, 32=green, 33=yellow, 34=blue, 35=purple, 36=teal, 37=white
@codeinthehole
codeinthehole / .gitconfig
Last active March 9, 2023 11:27
Git config
[user]
name = David Winterbottom
email = david.winterbottom@gmail.com
[alias]
# SHORT VERSIONS
co = checkout
ci = commit
@codeinthehole
codeinthehole / boo
Created April 15, 2016 08:20
Notifier script to use with long-running commands
#!/usr/bin/env bash
#
# Show an OSX alert
#
# This is useful when used in conjunction with a long-running script. Use this script to
# get a notification when te long-running script finishes.
#
# Eg:
#
# $ ./someprocess ; boo
@codeinthehole
codeinthehole / userdata.sh
Created February 2, 2016 21:21
Terraform config for an EC2 instance with a replaceable EBS volume
#!/bin/bash
DEVICE=/dev/$(lsblk -n | awk '$NF != "/" {print $1}')
FS_TYPE=$(file -s $DEVICE | awk '{print $2}')
MOUNT_POINT=/data
# If no FS, then this output contains "data"
if [ "$FS_TYPE" = "data" ]
then
echo "Creating file system on $DEVICE"
@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active May 19, 2024 20:47
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@codeinthehole
codeinthehole / prettytitle.sh
Created August 20, 2014 15:16
Bash function for print pretty titles
#!/usr/bin/env bash
# Pretty printing function for Bash output
#
# Example usage:
#
# $ notify "hello world"
#
# +-------------+
# | hello world |
@codeinthehole
codeinthehole / user-data.sh
Created August 18, 2014 12:41
Get the value of an EC2 instance's tag
#!/usr/bin/env bash
#
# Get the value of a tag for a running EC2 instance.
#
# This can be useful within bootstrapping scripts ("user-data").
#
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy
# JSON for this looks like:
#
# {
@codeinthehole
codeinthehole / .gitconfig
Created August 14, 2014 11:06
Git aliases for quickly opening Github pages
[alias]
# Open the Github page for the...
# ...repo homepage (included for consistency)
open = !hub browse --
# ...repo commits
opencommits = !hub browse -- commits
# ...commit page for HEAD
@codeinthehole
codeinthehole / .bashrc
Last active February 12, 2019 09:07
Bash functions for private Docker registries
# Add these functions to your ~/.bashrc in order to be able to query private
# Docker registries from the commandline. You'll need the JQ library
# (http://stedolan.github.io/jq/) to be installed. Alternatively, you can just
# pipe to " python -mjson.tool" to get pretty JSON formatting
# TODO Enter the correct details here
DOCKER_REGISTRY_HOST=docker.yourcompany.com
DOCKER_REGISTRY_AUTH=someuser:somepassword
function _docker_fetch() {
@codeinthehole
codeinthehole / user-data.sh
Created August 1, 2014 14:32
Minimal "user-data" for an AWS EC2 instance
#!/bin/bash
BUCKET=tangent-boilerplate
# Install AWS CLI
apt-get update
apt-get install -y python-pip
pip install awscli
# Fetch and run bootstrap file. For this to work, the EC2 instance needs to have an IAM role