Skip to content

Instantly share code, notes, and snippets.

View mattsta's full-sized avatar
🐢
Moving slowly and fixing things

Matt Stancliff mattsta

🐢
Moving slowly and fixing things
View GitHub Profile
@mattsta
mattsta / useragents_sorted_by_count
Created July 12, 2011 04:10
1567 unique user agents hitting http://matt.io/entry/uq today
1250 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
620 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
558 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
409 Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
395 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0
363 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
354 -
307 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1
271 Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
244 Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
@mattsta
mattsta / referrers_sorted_by_count
Created July 12, 2011 04:14
237 unique referrers hitting http://matt.io/entry/uq today
5345 -
4793 http://news.ycombinator.com/
738 http://news.ycombinator.com/news
343 http://news.ycombinator.com/item?id=2752136
180 http://twitter.com/
120 http://www.google.com/reader/view/
78 http://news.ycombinator.org/
56 http://hckrnews.com/
46 http://hackerne.ws/
42 http://www.google.com/ig
@mattsta
mattsta / gist:1107824
Created July 26, 2011 19:56
Fix Lion DNS Search Domains
How To Fix DNS Search Domains in OS X Lion
==========================================
Edit the mDNSResponder Config
------------------------------
sudo vim /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
Add <string>-AlwaysAppendSearchDomains</string> below <string>-launchd</string>.
Reload mDNSResponder
@mattsta
mattsta / gist:1652084
Created January 21, 2012 09:06
My frigging HDV->FCP->Motion->Internet workflow

How to HDV->FCP X->Motion 5->Internet

Importing

First, import your video: dvgrab -rewind -f mpeg2/hdv -showstatus -a timestamp

Next, convert your hdv mpeg2 stream to a mov container so Final Cut Pro can import it: ffmpeg -i timestamp001.m2t -vcodec copy -acodec copy -f mov timestamp001.mov

FCP X is buggy, so we need to export the audio from our movie individually: ffmpeg -i timestamp001.m2t timestamp001.aiff

@mattsta
mattsta / compile-mustache-from-pipe.js
Created January 23, 2012 07:29
server-side stdin/stdout mustache template compiler for hogan.js
#!/bin/env node
/*****************
* After getting your compiled template, you re-instantiate it client side by:
* var myTemplate = new Hogan.Template(compiledTemplateEvaledFunction);
* var renderedTemplate = myTemplate.render({field1: "someVal"});
*****************/
/* open le stdin */
@mattsta
mattsta / GETEX.lua
Last active August 29, 2015 13:57
Sample "GETEX" Redis function returning GET values as multibulk instead of a simple string. Returns a Redis error on error or a 1.) Value when given a string key.
local val,err = redis.pcall('get', KEYS[1])
if err then
return err
else
return {val}
end
@mattsta
mattsta / PGETEX.lua
Last active August 29, 2015 13:57
Sample "PGETEX" Redis function returning GET values combined with PTTL. Returns error if non-string key, nil on no key, or a multi-bulk reply of 1.) Value 2.) PTTL.
local val = redis.call('get', KEYS[1])
if val then
return {val, redis.call('pttl', KEYS[1])}
else
return false
end
@mattsta
mattsta / hn-comments-on-death.txt
Last active August 29, 2015 13:57
Word frequency of comments about a post about someone dying soon. Words obtained from this comment thread: https://news.ycombinator.com/item?id=7390638
(world)matt@ununoctium:~/repos/wf% python text.py
Words occuring more than 3 times:
Number is the count of times the word occured in the data.
3: gdp, limited, cobra, :(, global, cheap, soon, rest, produced, kill, looks,
earth, disease,, saved, worked, party,, happiness., certainly, work., pray,
$500k, months., either., 0, preparing, asking, stefantalpalaru, 300bps, easy,
inherited, folks, sorry, full,, disproportionate, opt, ago,, sick, ilovecookies,
little,, dependent, celebrities, advocate, begging, choice, young., joint,
suffering, wishes, example, one., fall, report, using, more., chongli, kids,,
massively, about,, loss, term, crops, problems,, problems., solution, anything,,
@mattsta
mattsta / hn-comments-on-work-drama
Last active August 29, 2015 13:57
Word frequency of comments about a post about someone being mentally abused at work. Words obtained from this comment thread: https://news.ycombinator.com/item?id=7408055
(world)matt@ununoctium:~/repos/wf% python text.py drama | fold -s
===============================================================================
Count of sentence ending words:
72: it.
35: sexism.
31: them.
24: people.
@mattsta
mattsta / redis-cluster-solaris-11-bring-up
Created March 21, 2014 15:40
Solaris 11 Redis Cluster Bring-Up
# Bring in dependencies if needed:
sudo pkg install ruby
sudo gem install redis
# Start 9 servers on 127.0.0.1 and 9 servers on net0's IP address
cd redis/src
for dir in {1..9}; do mkdir $dir; pushd $dir; rm -f *.conf *.rdb; ../redis-server --bind 127.0.0.1 --cluster-enabled yes --port 700$dir & popd; done
IP=`/sbin/ifconfig net0 |grep inet |awk '{printf $2}'`
for dir in {21..29}; do mkdir $dir; pushd $dir; rm -f *.conf *.rdb; ../redis-server --bind $IP --cluster-enabled yes --port 70$dir & popd; done