Skip to content

Instantly share code, notes, and snippets.

@motemen
motemen / git-remove-old-branches
Created December 29, 2011 07:48
remove old remote git branches interactively
#!/bin/sh
git fetch
for branch in `git branch --remote --merged origin/master | sed 's/ *origin\///' | grep -v ' ' | grep -v 'master$'`
do
MERGE_EPOCH=$(git --no-pager log -1 --pretty='%ct' $(git merge-base origin/master origin/$branch))
CURRENT_EPOCH=$(git --no-pager log -1 --pretty='%ct' origin/master)
if [ $(expr $(expr $CURRENT_EPOCH - $MERGE_EPOCH) / 60 / 60 / 24) -ge 14 ]; then
@wari
wari / convert720p.rb
Created October 31, 2011 06:58 — forked from czj/gist:1263872
Script to encode with HandbrakeCLI (x264) 720p, high image quality, low file size
#!/usr/bin/env ruby
# encoding: utf-8
# x264 presets guide : https://forum.handbrake.fr/viewtopic.php?f=6&t=19426
X264 = "b-adapt=2:rc-lookahead=50:me=umh:bframes=5:ref=6:direct=auto:trellis=2:subq=10:psy-rd=1.0,0.10:analyse=all"
FORMAT = "--optimize --format mp4"
QUALITY = "--ab 64 --mixdown mono --quality 23 -e x264 -x '#{X264}'"
SIZE = "--width 1280 --height 720"
ARGV.each do |param|
@yenliangl
yenliangl / gist:559257
Created August 31, 2010 16:00
Use jdb to debug Android application
# Use jdb to debug Android application
# Run ddms and select application to forward port.
ddms
# Execute jdb and attach to the listening application
jdb -attach localhost:8700
# Or in windows, need to specify connector explicitly
jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8700