This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
T_START=01:00:00 | |
T_END=${FROM} | |
FNAME=sample.mp4 | |
cvlc --video-filter scene -V image --start-time ${T_START} --stop-time ${T_END} --scene-format jpg --scene-ratio 24 --scene-prefix snap ${FNAME} vlc://quit 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ARCHFLAGS="-arch x86_64" | |
gem install mysql \ | |
-- \ | |
--with-mysql-dir=/usr/local/mysql \ | |
--with-mysql-config=/usr/local/mysql/bin/mysql_config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set heroku account credentials where each account file is named ~/.heroku/credentials_XXX | |
# http://www.mail-archive.com/[email protected]/msg03850.html | |
function hset() { | |
ln -s ~/.heroku/credentials_$1 ~/.heroku/credentials | |
} | |
# Clear current Heroku account | |
function hclear() { | |
[ -L ~/.heroku/credentials ] && rm ~/.heroku/credentials | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# forward my local port (e.g., 3000) to REMOTE_HOST's port | |
# and run top to keep tunnel from closing | |
ssh -t -g -R :$REMOTE_PORT:0.0.0.0:$LOCAL_PORT $REMOTE_HOST "top d 15" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Use mencoder to create a video from image and audio files | |
# http://fmtyewtk.blogspot.com/2009/10/how-to-create-video-from-mp3-using.html | |
# suggests that we cannot use just 1 image file but the following seems to work (though | |
# vlc reports the video codec is NOT h264) | |
mencoder "mf://$1" -mf fps=1/60 -audiofile "$2" -oac mp3lame -ovc lavc -lavcopts vcodec=libx264 -noskip -mc 0 -ovc copy -o "$3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# personal account | |
# | |
Host personal.repositoryhosting.com | |
Hostname personal.repositoryhosting.com | |
IdentitiesOnly yes | |
IdentityFile ~/.ssh/id_dsa | |
# | |
# corporate account | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java snippet for GWT to trap keyboard keyUp events at the document level. | |
// In other words, no KeyUpHandler needed (nor does Document provide a hook). | |
Event.addNativePreviewHandler(new Event.NativePreviewHandler() { | |
@Override | |
public void onPreviewNativeEvent(NativePreviewEvent event) { | |
if (event.getTypeInt() == Event.ONKEYUP) { | |
// do something with the key code | |
// doSomething(event.getNativeEvent().getKeyCode()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This RoR controller uses "protect_from_forgery" declaration to let anyone | |
# perform a POST to create another instance of an UnsafeObject. | |
# | |
class UnsafeObjectsController < ApplicationController | |
protect_from_forgery :except => :create | |
# ... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Transcode an MMS into an H.264 in an .mp4 container. | |
# Usage: transcode_vlc.sh mms://foo.com/bar.wmv bar.mp4 | |
vlc $1 :sout '#transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a,ab=128,channels=2}:duplicate{dst=std{access=file,mux=mp4,dst=$2}}' :sout-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# git-zip.sh | |
# | |
# Creates a zip file of the HEAD of the current git repository | |
CWD=`basename $PWD` | |
git archive --format=zip --prefix=${CWD}/ -9 HEAD > ../${CWD}.zip |