Skip to content

Instantly share code, notes, and snippets.

View trongthanh's full-sized avatar
🎈
Keep calm and code on

Thanh Tran trongthanh

🎈
Keep calm and code on
View GitHub Profile
@trongthanh
trongthanh / gist:1196596
Created September 6, 2011 04:37
Emulate slow Internet connection speed on localhost with netem (Ubuntu)
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
@trongthanh
trongthanh / gist:954886
Created May 4, 2011 07:43
Create Flash context menu
public function createContextMenu(versionString: String): void {
if (!contextMenu) contextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
var versionMenu: ContextMenuItem = new ContextMenuItem("v." + versionString, false, false);
contextMenu.customItems = [versionMenu];
}
@trongthanh
trongthanh / gist:819927
Created February 10, 2011 04:05
Log my computer IP to a file shared on Ubuntu One
# log my computer IP to a file shared on Ubuntu One
/sbin/ifconfig $1 | grep "inet addr" | gawk -F: '{print $2}' | gawk '{print $1}' > "/home/thanh/Ubuntu One/office_ip"
@trongthanh
trongthanh / gist:799860
Created January 28, 2011 05:05
convert video to mp4 format
# convert to MP4 video
ffmpeg -i output.mov -s 1280x720 -b 2000k -ab 128k -vcodec libxvid -acodec libmp3lame -sws_flags +bitexact final.mp4