Skip to content

Instantly share code, notes, and snippets.

View bertrandom's full-sized avatar

Bertrand Fan bertrandom

View GitHub Profile
Read permissions:
email
read_friendlists
read_insights
read_mailbox
read_requests
read_stream
user_online_presence
friends_online_presence
@bertrandom
bertrandom / gist:5017613
Created February 23, 2013 00:20
Trip Advisor venue URL -> ID regex
(.*)(d[0-9]+)(.*)
$2
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
@bertrandom
bertrandom / storedata.sh
Created April 12, 2013 20:31
tourbillion performance testing
#!/bin/bash
i=0
while true
do
i=$(($i+1))
status=$(curl -H 'Content-Type: application/json' --request POST --data '{"data":"Goodbye world!"}' --write-out %{http_code} --silent https://tourbillon.herokuapp.com/dev/null)
if [ "$status" -eq 200 ]
then
echo "$i Discarded successfully."
else
@bertrandom
bertrandom / private.xml
Created November 14, 2013 19:32
KeyRemap4Macbook config to remap Caps Lock to Ctrl-Shift-Eject (Lock computer), after setting Caps Lock to PC Application Key with PCKeyboardHacks
<?xml version="1.0"?>
<root>
<item>
<name>CAPSLOCKTOLOCK</name>
<appendix>this is to remap caps lock to CtrlShiftEject</appendix>
<identifier>private.swap_capslock</identifier>
<autogen>
--KeyToKey--
KeyCode::PC_APPLICATION,
KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
@bertrandom
bertrandom / gist:7508762
Created November 17, 2013 03:38
Resize a bunch of images to exactly 640x480 with black borders if they don't fit the dimensions
ls *.jpg | xargs -n1 sh -c 'convert $0 -resize 640x480 -background "#000000" -gravity center -extent 640x480 fixed/$0'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
void setup() {
background(255, 255, 255);
size(1120, 860);
translate(50, height - 15);
scale(0.1,-0.1);
frameRate(30);
$ mkvinfo Seinfeld.S01E01.The.Seinfeld.Chronicles.mkv
...
|+ Segment tracks
...
| + A track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 17434673961305370787
| + Track type: subtitles
| + Lacing flag: 0
| + Codec ID: S_TEXT/UTF8
1
00:00:01,266 --> 00:00:03,366
Do you know what this is all
about? Why we're here?
2
00:00:03,400 --> 00:00:06,366
To be out. This is out.
[AUDIENCE LAUGHS]