Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Schwartz benschw

View GitHub Profile
@benschw
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
==Prepare==
===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
benschw / gist:9762183
Created Mar 25, 2014
Build multithreaded mplayer
View gist:9762183
Build multithreaded mplayer so HD x264 videos won't crap out
==Dependancies==
$ sudo apt-get install build-essential checkinstall
===x264===
View mplayer-notes.md

Player

Change audio / subtitles in mplayer

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

Encoder

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']}"
end
@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.

@benschw
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://192.168.1.52:6379 will forward the local 1234 port to the remote IP and port - in this case 192.168.1.52:6379.
#
#
# first you need to build the docker-ut image using ./contrib/mkimage-unittest.sh
# then
@benschw
benschw / golang-install.sh
Last active Dec 30, 2015
install golang 1.1
View golang-install.sh
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
bashrc