Skip to content

Instantly share code, notes, and snippets.

View inactivist's full-sized avatar
💭
fixing things

Michael Curry inactivist

💭
fixing things
View GitHub Profile
@bhang
bhang / install_graphite_statsd_ubuntu_precise.sh
Created May 15, 2012 17:41
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
/*
Example that utilizes FileSystem API and Web Workers.
Creates a lib.js and worker.js in a temporary file system, then creates a web worker for worker.js that imports lib.js from the local filesystem.
The start of something beautiful?
*/
var fs, liburl, worker = null;
@jboner
jboner / latency.txt
Last active July 31, 2026 23:21
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
@GarrettS
GarrettS / tco no
Created June 21, 2012 23:46
tco no
document.addEventListener("mouseover", function(e) {
var t=e.target, u;
if(!t.href) t = t.parentNode;
if(t.href) {
if(t.host=="t.co"){
u=t.getAttribute("data-expanded-url");
if(!u && t.search) {
u=(u=t.search.match(/\burl=(.+)?&/))&&unescape(u[1]);
} else if(!u && t.title.indexOf("http") == 0) {
u = t.title;
@jsyeo
jsyeo / power_now.py
Created July 20, 2012 07:28
Python Script To Print Current Laptop Battery Power
#!/usr/bin/python
def main():
power_now = open("/sys/class/power_supply/BAT0/energy_now", "r").readline()
power_full = open("/sys/class/power_supply/BAT0/energy_full", "r").readline()
print float(power_now)/float(power_full) * 100 , "%"
if __name__ == "__main__":
main()
@DazWorrall
DazWorrall / app.py
Created July 26, 2012 07:54
Flask maintenance mode
from flask import Flask, redirect, url_for, request
app = Flask(__name__)
is_maintenance_mode = True
# Always throw a 503 during maintenance: http://is.gd/DksGDm
@app.before_request
def check_for_maintenance():

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)

@mikepfirrmann
mikepfirrmann / install-uniconvertor.sh
Created September 26, 2012 19:05
Install Uniconvertor from source
#!/bin/bash
# http://ubuntuforums.org/showthread.php?t=1865589 says to do this
sudo apt-get install build-essential python-all-dev liblcms1-dev libjpeg62-dev libpaps-dev
# Uniconvertor packages do not seem to install properly on Ubuntu 12.04, so
# I installed from source.
svn co https://sk1.svn.sourceforge.net/svnroot/sk1/trunk/sk1libs /tmp/sk1libs
sudo python /tmp/sk1libs/setup.py install
@crccheck
crccheck / README.md
Last active May 19, 2025 20:42
Python Packaging

What the Hell? -- A Journey Through the Nine Circles of Python Packing

Writing a setup.py

map

I am no Virgil, but having stumbled my way through Python packaging a few times already, I'm documenting the things I learn as I go here.

To help me learn, I took a survey of the top 15 Python packages on Github along with 12 other commonly referenced packages. I thought... if there are any best

@mikluko
mikluko / gist:3897117
Created October 16, 2012 03:37
Basic monit config to monitor CPU, memory and disk usage
set daemon 30 with start delay 60
set logfile syslog facility log_daemon
set httpd port 2812
allow localhost
set mailserver localhost
set alert alert@example.com but not on { instance }
mail-format {
From: noreply@example.com