Skip to content

Instantly share code, notes, and snippets.


Ben Schwartz benschw

View GitHub Profile
benschw / gist:9762196
Created Mar 25, 2014
how to rip a dvd
View gist:9762196
==Get Utilities==
sudo apt-get install mplayer mencoder mpeg4ip-utils mpeg4ip-server subtitleripper ogmtools mkvtoolnix
===Detect Cropping===
mplayer dvd://1 -frames 4 -vf cropdetect -sb 50000000 -nosound -vo null 2>/dev/null | grep CROP
[CROP] Crop area: X: 8..719 Y: 0..479 (-vf crop=704:480:12:0).
[CROP] Crop area: X: 7..719 Y: 0..479 (-vf crop=704:480:12:0).
*Skip first ~50mb, this is the title screen and is often a different size
benschw / gist:9762183
Created Mar 25, 2014
Build multithreaded mplayer
View gist:9762183
Build multithreaded mplayer so HD x264 videos won't crap out
$ sudo apt-get install build-essential checkinstall


Change audio / subtitles in mplayer

  • Press V to toggle the subs on and off
  • Press J to cycle languages
  • Press # to cycle the audio


Join two avi files in mencoder

View vagrant - pass in env vars.rb
config.vm.provision "shell" do |s|
s.inline = "VAR1 is $1 and VAR2 is $2"
s.args = "#{ENV['VAR1']}, #{ENV['VAR2']}"
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.

benschw / gist:7980697
Created Dec 16, 2013
socat docker ambassador
View gist:7980697
The svendowideit/ambassador Dockerfile
The svendowideit/ambassador image is a small busybox image with socat built in. When you start the container, it uses a small sed script to parse out the (possibly multiple) link environment variables to set up the port forwarding. On the remote host, you need to set the variable using the -e command line option.
-expose 1234 -e REDIS_PORT_1234_TCP=tcp:// will forward the local 1234 port to the remote IP and port - in this case
# first you need to build the docker-ut image using ./contrib/
# then
benschw /
Last active Dec 30, 2015
install golang 1.1
sudo apt-get install python-software-properties # 12.04
sudo add-apt-repository ppa:duh/golang
sudo apt-get update
sudo apt-get install golang
$ mkdir $HOME/go