Skip to content

Instantly share code, notes, and snippets.

@pauladam
pauladam / ad-creation-spec.yaml
Last active August 29, 2015 14:07
Ad creation spec
ad-account id: id
page id: id
post id: id
message: message
campaign:
id: id
objective: objective
name: name
@pauladam
pauladam / est.json
Created November 21, 2014 17:42
ex. estimates json doc
{
"estimates": {
"post_impressions": 38760.211670480545
},
"id": "135249540516_10153617542060517",
"predictions": {
"post_impressions": {
"series_high": [
[
1387211207,
@pauladam
pauladam / prepare-commit-msg
Created February 18, 2015 21:17
cc recommender
#!/bin/sh
user=`git st | grep 'modified' | cut -d ":" -f 2 | tr -d ' ' | while read fn; do
git --no-pager blame $fn
done | cut -d " " -f 2- | cut -d ')' -f 1 | sed 's/[0-9].*//' | tr -d '(' | sort | uniq -c | sort -n | tail -r | head -n 1 | cut -d ' ' -f 3-`
echo $user
cat $1 > /tmp/commit-msg
echo '\n' > $1
echo "cc: $user" >> $1
cat /tmp/commit-msg >> $1
@pauladam
pauladam / scribe.go
Last active August 29, 2015 14:23
Scribe
// tree
// .
// ├── bin
// │   └── scribe
// └── src
// └── scribe
// └── scribe.go
// $ gb build all; bin/scribe
// Jesse
@pauladam
pauladam / git-reviewer
Created July 6, 2015 17:54
git-reviewer
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Usage: git reviewer filename"
exit
fi
git blame $1 | cut -d "(" -f 2 | ruby -ne 'puts $_.split(/\d{4}/).first' | sort | uniq -c | sort -n | tail -r | head -n 1 | cut -d ' ' -f 3-
https://beta.socialcode.com/advisor/#audience-profiler?|hvac:act_321764907982593,hvad:6018552247870,hvsc:y,connection_frac:0.8659861889250815-0.88324|
// ex
// $ gb build all; bin/scribe
// scribe
// Jesse
package main
import "os"
import "fmt"
import "time"
import "bufio"
@pauladam
pauladam / sc-interview-notes.md
Last active August 29, 2015 14:27
SC Interview notes
@pauladam
pauladam / gist:226467
Created November 4, 2009 22:59
Simple script for remotely shutting down your DS nas device. Im lazy so I like to avoid logging into the web ui and clicking around.
#!/usr/bin/python
import urllib,urllib2, sys
BASE_URL = 'http://192.168.100.101:5000'
ADMIN_PASS = 'YOUR ADMIN PASS'
# Login to admin interface
parameters = {'username' : 'admin', 'passwd':ADMIN_PASS,'service_type':'1'}
request = urllib2.Request(BASE_URL+'/webman/modules/login.cgi', urllib.urlencode(parameters))
@pauladam
pauladam / gist:304295
Created February 14, 2010 22:03
Random choice with weighted probabilities
# typical to sum over your list of items perhaps
# performing some calculation on each item
normalizing_constant = \
sum([calc(item) for item in items if filter(item)])
r = random.random()
for item in items:
prob = get_probability(item) / normalizing_constant