Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Schwartz benschw

View GitHub Profile
@benschw
benschw / git-origins.md
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.
View git-origins.md

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

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

@benschw
benschw / consul-bootstrap.sh
Created Jun 26, 2015
script to bootstrap a single node consul service (e.g. for vagrant)
View consul-bootstrap.sh
#!/bin/bash
if [ ! -f /tmp/provisioned ]; then
apt-get update
apt-get install -y daemon wget unzip
touch /tmp/provisioned
fi
@benschw
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 http://archive.ubuntu.com/ubuntu 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 Contexts.md

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

View keybase.md

Keybase proof

I hereby claim:

  • I am benschw on github.
  • I am benschw (https://keybase.io/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
export GO15VENDOREXPERIMENT=1
go get github.com/tools/godep
godep save ./...
@benschw
benschw / commit-guidelines.md
Last active Jan 4, 2016
fork of angular's commit guidelines
View commit-guidelines.md

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
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
#cloud-config
ssh_import_id: [steve-stevebaker]
apt_sources:
- source: "ppa:steve-stevebaker/heat-cfntools"
runcmd:
- [ apt-get, heat-cfntools ]
View deluge-install.md

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
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.