Skip to content

Instantly share code, notes, and snippets.


Ben Schwartz benschw

View GitHub Profile
benschw /
Last active Jul 9, 2021
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from

List curent remotes

$ git remote -v

origin (fetch)
origin (push)

Rename origin to upstream and add our new empty repo as the origin.

benschw /
Created Jun 26, 2015
script to bootstrap a single node consul service (e.g. for vagrant)
if [ ! -f /tmp/provisioned ]; then
apt-get update
apt-get install -y daemon wget unzip
touch /tmp/provisioned
benschw / Dockerfile
Last active Oct 1, 2018
MySQL Docker Container
View Dockerfile
FROM ubuntu
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install mysql-client mysql-server
View Loose Coupling with Bounded

A good microservice should encapsulate a bounded context. A bounded context is a concept that comes from Domain-Driven Design (or DDD). In DDD, the components of an application are organized around the various contexts or domains in which your software can be interpreted.

As software gets larger, it becomes harder and harder to describe it with a unified model. Your software might serve three different departments in your company that each have their own definition for what a product is, or it might be used by two different types of customers. Describing all of these situations in a unified model is confusing and


Keybase proof

I hereby claim:

  • I am benschw on github.
  • I am benschw ( on keybase.
  • I have a public key whose fingerprint is 60D0 8AEE 4A44 9E1A E5A6 4111 5AB8 F227 980A 076C

To claim this, I am signing this object:

View vendor experiment with godep
go get
godep save ./...
benschw /
Last active Jan 4, 2016
fork of angular's commit guidelines

Git Commit Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the AngularJS change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

benschw / heat-cfn-user_data.txt
Created Jan 21, 2014
clout init user_data to add heat-cfntools to a base image; script to apply it
View heat-cfn-user_data.txt
ssh_import_id: [steve-stevebaker]
- source: "ppa:steve-stevebaker/heat-cfntools"
- [ apt-get, heat-cfntools ]

install daemon, webui, etc

$ sudo aptitude install deluge deluged deluge-web

run it

$ sudo service deluged start
$ screen -fa -d -m -S deluge-web deluge-web
benschw / gist:8017402
Created Dec 18, 2013
remove Ghosted docker containers
View gist:8017402

to remove a container that docker doesn't know isn't running:

  • take note of the container ID
  • service stop docker
  • modify the config.json file in /var/lib/docker/containers/$CONTAINER_ID to have "Running":false
  • service start docker
  • docker rm $CONTAINER_ID

Unfortunately, this makes all the other containers turn into ghosts, so you can only do it when there's only a single container. Plus it's really hacky.