Skip to content

Instantly share code, notes, and snippets.

@csanz
csanz / whattobuy.md
Created November 22, 2012 16:30
Drone Specs

#Drone Specs

Space Specs

  • Flat Area
  • Great wifi
  • Hopefully High ceilings without any crazy wires (eg. 120ft high ceilings in Berlin)

Spare parts

@pprett
pprett / grid_search.py
Created October 31, 2012 19:42
Parallel grid search for sklearn Gradient Boosting
"""Parallel grid search for sklearn's GradientBoosting.
This script uses IPython.parallel to run cross-validated
grid search on an IPython cluster. Each cell on the parameter grid
will be evaluated ``K`` times - results are stored in MongoDB.
The procedure tunes the number of trees ``n_estimators`` by averaging
the staged scores of the GBRT model averaged over all K folds.
You need an IPython ipcluster to connect to - for local use simply
@johnantoni
johnantoni / mysql.txt
Created August 7, 2012 18:57
mysql + vagrant + remote access
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@dblock
dblock / mongoid_criteria.rb
Created May 24, 2012 19:38
Mongoid::Criteria each_by iterator
module Mongoid
class Criteria
def each_by(by, &block)
idx = 0
total = 0
set_limit = options[:limit]
while ((results = ordered_clone.limit(by).skip(idx)) && results.any?)
results.each do |result|
return self if set_limit and set_limit >= total
gonz@bamboo:~ > git clone git://github.com/maccman/juggernaut.git
Cloning into juggernaut...
remote: Counting objects: 558, done.
remote: Compressing objects: 100% (258/258), done.
remote: Total 558 (delta 309), reused 481 (delta 255)
Receiving objects: 100% (558/558), 576.74 KiB | 135 KiB/s, done.
Resolving deltas: 100% (309/309), done.
gonz@bamboo:~ > cd juggernaut
@zh
zh / redis-em-patch
Created September 12, 2011 10:07 — forked from gregorymostizky/redis-em-patch
Patch redis and em-redis to work together
require 'em-redis'
require 'redis'
require 'redis/distributed'
require "fiber_pool"
class Redis
class Distributed
def initialize(urls, options = {})
@tag = options.delete(:tag) || /^\{(.+?)\}/
@IPrism
IPrism / gist:1010289
Created June 6, 2011 13:46 — forked from matiaskorhonen/gist:420880
startup script for unicorn with rvm global installation
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@carlosantoniodasilva
carlosantoniodasilva / post-receive
Created February 9, 2011 01:28
Basic git post-receive hook file to deploy a Rails app.
#!/bin/bash
APP_NAME="your-app-name-goes-here"
APP_PATH=/home/deploy/${APP_NAME}
# Production environment
export RAILS_ENV="production"
# This loads RVM into a shell session. Uncomment if you're using RVM system wide.
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"