Skip to content

Instantly share code, notes, and snippets.

"""
Created on 2011-02-10
@author: Bohdan Mushkevych
@author: Brian Curtin
http://code.activestate.com/lists/python-ideas/8982/
"""
from datetime import datetime
import threading

Keybase proof

I hereby claim:

  • I am chrisvaughn on github.
  • I am chrisvaughn (https://keybase.io/chrisvaughn) on keybase.
  • I have a public key whose fingerprint is 110A 5110 2196 C077 937E 368D C2B9 B0FE 87F7 2C8E

To claim this, I am signing this object:

@chrisvaughn
chrisvaughn / mongo_dups.js
Created August 19, 2011 20:49
count dups in mongo with mapReduce
//count dups in mongo with mapReduce
m = function() { emit(this.user_id, 1); };
r = function (k, vals) { return Array.sum(vals); };
res = db.tasks.mapReduce(m, r, { out : {replace : "results", db : "mr"}});
// more difficult
function map() {
var sorted = this._keywords.sort();
key = sorted.join(" ");
var ret = {title : this.title, id : this._id, total: 1};
for i in {99..1}
do
let l=i-1
say "$i bottles of beer on the wall. $i bottles of beer. Take 1 down, pass it arround, $l bottles of beer on the wall."
done
@chrisvaughn
chrisvaughn / areopress.yaml
Created March 17, 2012 16:08
Coffee Recipes
ingredients:
- coffee:
amount : 17g
grind : fine (10 clicks on Hario MSS-1B)
- water:
amount : 200g
temp : 200° (30 seconds off boil)
prep:
- preheat aeropress with hot water
- rinse filter with hot water
@chrisvaughn
chrisvaughn / setup_rstudio.sh
Last active November 11, 2015 12:58 — forked from briandconnelly/setup_rstudio.sh
Setup RStudio Server on a Google Compute Engine Instance (Ubuntu)
#!/bin/bash
# Install RStudio Server on a Google Compute Engine instance running Ubuntu Trusty
CRAN_MIRROR='cran.rstudio.com'
pushd /tmp
# Install up-to-date version of R ---------------------------------------------
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
protected function getallheaders()
{
$headers = array();
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
#!/bin/bash
wget "https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable/
./configure
make
make verify
sudo make install
@chrisvaughn
chrisvaughn / gist:7f4456ee004cf13c8faf78e5978056b2
Created June 23, 2016 10:00 — forked from slank/gist:df395a38ae26149f17c2
Launchd Config for on-demand SSH tunnel
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.openssh.port-forwards</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>

Keybase proof

I hereby claim:

  • I am chrisvaughn on github.
  • I am chrisvaughn (https://keybase.io/chrisvaughn) on keybase.
  • I have a public key ASDE0TDzs5l13DLOsN-LqLbuFmQC5ZWkoxxubvHR78DNqgo

To claim this, I am signing this object: