Skip to content

Instantly share code, notes, and snippets.

View armon's full-sized avatar

Armon Dadgar armon

View GitHub Profile
@armon
armon / facebook.py
Created May 20, 2011 07:17
Facebook interface to get posts and perform hierarchical user clustering
from collections import defaultdict
from math import sqrt
import httplib2
import json
import re
import threadpool
import threading
from PIL import Image,ImageDraw
ACCESS_TOKEN = "..."
# -*- mode: ruby -*-
# vi: set ft=ruby :
$setup = <<SCRIPT
# Update apt
apt-get update
# Install the things we need to build
apt-get install -y autoconf
apt-get install -y automake
#!/bin/bash
set -e
CONTAINER=`docker run -d ubuntu:precise echo test`
OUTPUT=`docker logs $CONTAINER`
echo \"$OUTPUT\" should be \"test\"
CONTAINER=`docker run -d ubuntu:precise echo test`
sleep 1
OUTPUT=`docker logs $CONTAINER`
@armon
armon / security.md
Last active December 26, 2015 13:29
@armon
armon / benchmark.go
Created November 1, 2013 00:26
scrypt parameter benchmarks
package main
import "code.google.com/p/go.crypto/scrypt"
import "fmt"
import "time"
func main() {
n_vals := []int{4 * 1024, 8 * 1024, 16 * 1024, 32 * 1024}
r_vals := []int{6, 7, 8, 9, 10}
p_vals := []int{1, 2, 3, 4}
package main
import (
"github.com/miekg/dns"
"log"
"net"
"time"
)
const (
package main
import (
"fmt"
"github.com/armon/mdns"
"os"
"time"
)
func main() {
# gosrc package to quickly cd into folder
function gosrc() {
cd $GOPATH/src
cd ./$1
}
export -f gosrc
package main
import (
"fmt"
"net"
"os"
"time"
)
const udpAddr = "127.0.0.1:10000"
package main
import (
"fmt"
"github.com/miekg/dns"
"net"
"time"
)
const domain = "consul."