Skip to content

Instantly share code, notes, and snippets.

Avatar

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

@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===
@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 / pipeline.go
Created Sep 15, 2014
concurent pipeline processing in go
View pipeline.go
package main
import (
"log"
"strconv"
"time"
)
var _ = log.Print
View go1.3-on-drone.sh
pushd ~
wget -q -O go1.3.linux-amd64.tar.gz http://golang.org/dl/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
popd
View gist:44ab89627c4d3fd713bf
# echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool
alias jsonprint="python -m json.tool"
@benschw
benschw / screen2gif.sh
Created Jul 9, 2015
ubild a gif from a screencast in linux
View screen2gif.sh
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
View golang-fork-howto.sh
# from (http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html)
# (fork campoy/cooltool on github)
go get github.com/campoy/cooltool
cd $GOHOME/src/campoy/cooltool
git remote add fork https://github.com/benschw/cooltool.git
# git commit