Skip to content

Instantly share code, notes, and snippets.


Ben Schwartz benschw

View GitHub Profile
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']}"


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

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
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 / pipeline.go
Created Sep 15, 2014
concurent pipeline processing in go
View pipeline.go
package main
import (
var _ = log.Print
pushd ~
wget -q -O go1.3.linux-amd64.tar.gz
tar -xzf go1.3.linux-amd64.tar.gz
export GOROOT=~/go
export PATH=$GOROOT/bin:$PATH
rm -rf ~/go/src/pkg/appengine
rm -rf ~/go/src/pkg/appengine_internal
View gist:44ab89627c4d3fd713bf
# echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool
alias jsonprint="python -m json.tool"
benschw /
Created Jul 9, 2015
ubild a gif from a screencast in linux
sudo apt-get install imagemagick mplayer gtk-recordmydesktop
mplayer -ao null output.ogv -vo jpeg:outdir=output
convert output/* output.gif
convert output.gif -coalesce -repage 0x0 -crop 1200x630+22+60 +repage output-crop.gif
convert output-crop.gif -fuzz 10% -layers Optimize output-crop-opt.gif
# from (
# (fork campoy/cooltool on github)
go get
cd $GOHOME/src/campoy/cooltool
git remote add fork
# git commit