Skip to content

Instantly share code, notes, and snippets.

@rjp
rjp / gist:1422845
Created December 2, 2011 11:16
openresty configuration that doesn't work
#user nobody;
worker_processes 1;
## safe for use under daemontools
daemon off;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
@rjp
rjp / gist:1400641
Created November 28, 2011 14:42
Move certain posts from my primary Posterous to my instagram Posterous
#!/usr/bin/env ruby
require "rubygems"
require "posterous"
require ENV['HOME'] + "/.apikeys.rb"
Posterous.config = $apikeys[:posterous]
include Posterous
@rjp
rjp / gist:1400429
Created November 28, 2011 13:39
Top 10 domains in the scribots
scribot=# select count(1) as c, 'http://' || domain || '/' as url from (select substring(url from '.*://([^/]*)') as domain from url) as monkey group by domain order by c desc limit 10;
c | url
------+----------------------------
8578 | http://news.bbc.co.uk/
3014 | http://www.flickr.com/
2260 | http://t.co/
2069 | http://en.wikipedia.org/
1934 | http://www.guardian.co.uk/
1293 | http://www.bbc.co.uk/
1277 | http://twitter.com/
@rjp
rjp / readme-outline.md
Created November 16, 2011 16:12 — forked from indexzero/readme-outline.md
A quick outline of a README.md

README.md Outline

  • Header and a Brief description (should match package.json)
  • Example (if applicable)
  • Motivation (if applicable)
  • API Documentation: This will likely vary considerably from library to library.
  • Installation
  • Tests
  • Contributors
  • License
@rjp
rjp / robohash.js
Created July 8, 2011 15:04
Replace twitter avatars with robohash robots
// ==UserScript==
// @name RoboHash Your Twitters
// @namespace rjp
// @description Replace twitter avatars with RoboHash avatars
// @include http://twitter.com/
// ==/UserScript==
// linkifyContainer idea gratefully and wholly stolen from
// http://arantius.com/misc/greasemonkey/linkify-plus.user.js#
// with minor reformatting by me to make a nicer gist
@rjp
rjp / gist:1040461
Created June 22, 2011 16:16
ribot url counts
scribot=# select id, wh from url where id in (select min(id) from url union select max(id) from url union select id from url where id % 5000 = 0) order by id asc;
id | wh
-------+-------------------------------
135 | 2002-08-13 15:15:20+01
5000 | 2003-05-07 11:28:34+01
10000 | 2003-11-12 13:14:19+00
15000 | 2004-05-15 10:31:01+01
20000 | 2004-12-10 10:18:29.182655+00
25000 | 2005-06-08 14:34:57.188951+01
30000 | 2005-11-08 13:50:39.732762+00
scribot=# select * from (select id, wh from url where id % 10000 = 0 union select id, wh from url where wh=(select min(wh) from url) union select id, wh from url where wh=(select max(wh) from url)) as bishop;
id | wh
-------+-------------------------------
136 | 2002-08-05 15:19:59+01
10000 | 2003-11-12 13:14:19+00
20000 | 2004-12-10 10:18:29.182655+00
30000 | 2005-11-08 13:50:39.732762+00
40000 | 2006-10-17 14:24:55.249109+01
50000 | 2008-02-12 14:11:37.847876+00
60000 | 2009-02-20 22:13:40.305826+00
:>slicefiles
i=0
for j in $(jot 256 1); do
curl http://placekitten.com/$j/500 > $j.jpg
convert -crop 1x500+$i+0 $j.jpg slice-$j.jpg
echo slice-$j.jpg >> slicefiles
sleep 1
done
montage -tile x1 -geometry 1x500 @slicefiles mri-kitten.jpg
# scp mri-kitten.jpg [email protected]:somewhere/mri-kitten.jpg
@rjp
rjp / jshow.rb
Created February 22, 2011 23:44
require 'rubygems'
require 'json'
require 'open-uri'
$base = ENV['UA_BASE'] || 'http://localhost:3000'
$user = ENV['UA_USER'] || 'user'
$pass = ENV['UA_PASS'] || 'pass'
# {"folder":"test2","to":"rjp","id":2035015,"body":"FLANGES","inReplyTo":2034051,"subject":"Ainsley","epoch":1298383425,"read":false,"annotations":[{"body":"*mutter*","epoch":1298384919,"from":"rjp"}],"from":"rjp","inReplyToHierarchy":[{"folder":"test1","id":2034051,"from":"rjp"}],"replyToBy":[{"folder":"test1","id":2035371,"from":"rjp"}]}
@rjp
rjp / gist:833546
Created February 18, 2011 11:11
Turn clover-C of a bunch of iTunes tunes into a nice HTML table
awk -F\\t 'BEGIN{print"%html\n %body\n %table\n %tr\n %th Track\n %th Artist\n %th Album"}{printf(" %%tr\n %%td %s\n %%td %s\n %%td %s\n",$1,$3,$4)}' | recode utf8..html | haml