Skip to content

Instantly share code, notes, and snippets.

View kristjan's full-sized avatar

Kristján Pétursson kristjan

View GitHub Profile
@kristjan
kristjan / fb_uname_to_id.rb
Created April 11, 2011 22:43
Convert a Facebook username to its ID
#!/usr/bin/env ruby
require 'net/http'
require 'rubygems'
require 'json'
username = ARGV.first
if username.nil?
puts "Usage: #{__FILE__} <fb_username>"
@kristjan
kristjan / tokbox_demo.html
Created September 8, 2011 23:33
Minimal Tokbox recording demo
<!DOCTYPE html>
<head>
<title>Tokbox Demo</title>
<script type="text/javascript"
src="http://staging.tokbox.com/v0.91/js/TB.min.js"></script>
</head>
<body style="text-align: center;">
<h1>Tokbox Demo</h1>
@kristjan
kristjan / gist:1249597
Created September 28, 2011 23:41
Facebook's funny redirect behavior
# Curling some Facebook users' IDs at http://fb.me will send you to their profile
$ curl fb.me/6 -D -
HTTP/1.1 302 Found
Location: http://www.facebook.com/6
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.52.92.83
X-Cnection: close
Date: Wed, 28 Sep 2011 23:38:26 GMT
Content-Length: 0
@kristjan
kristjan / client.erl
Created October 6, 2011 21:55
An example of loading code over the network. See https://github.com/kristjan/erlang_playground for the full code.
{echo, Server} ! {netload, fun run_faster/0, self()}.
@kristjan
kristjan / .functions
Created February 11, 2012 01:27
Print a green line before running ack for easy scrollback
#!/bin/bash
function lack() {
echo -ne "\033[32m"
for i in $(seq $(tput cols)); do echo -n "="; done
echo -e "\033[0m"
ack $@
}
{
"author": "Singly <nerds@singly.com>",
"name": "gowalla",
"description": "Gowalla Connector",
"version": "0.0.1",
"repository": {
"title": "gowalla",
"handle": "gowalla",
"author": "nerds",
"update": "auto",
Broken
npm http 304 http://registry.singly.com/beaugunderson-meta-me/0.0.2
---
Working
npm http 200 http://registry.singly.com/beaugunderson-playground/0.0.2
npm http GET
@kristjan
kristjan / setup.md
Created June 19, 2012 22:15
New computer setup

System

  • Map Caps Lock -> Control
  • Turn on keyboard tabbing through all elements

Env

  • Clone kristjan/.dotfiles
  • Run .dotfiles/install.rb
  • Clone kristjan/.vim
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxmUUlrjOCvO0IzLU8Cgz48RViroBoiBMlNi2EqqCMZqlylyLfqrReAt+BEkVwk/Jboc3cEX+6vwK19e3TJi4lWKZxMR0kWofsgno2j83PrwOATXaxOvZoCr3+5JTYUT/SZNPyhF4d+U00ThwLAcZSGS4FD4FC/5YU86tNDQrYImRc2bYFMggc8lkbM/x5VMEVL0QdxkikmOKYWTneWtqtGbXN8X7pO5zGotodBv1fx7sxTSM9JmY3ygxqd+UaIgSvqTes6y8UIjKoIkvRk4ChIataCuOLcnKALfK3QjTYFD34AuWD3kcF7UAH/XBYh2KpLvY8jWH9+ZfcVmnZTOZNQ==
var domain = require('domain');
process.on('uncaughtException', function(err) {
console.log('Pre caught', err.message);
});
var d = domain.create();
d.on('error', function(err) {
console.log("Domain caught", err.message);