Skip to content

Instantly share code, notes, and snippets.

View mackstann's full-sized avatar

Nick Welch mackstann

View GitHub Profile
ventilation_cfm = 5
minutes = 60
room_volume_cu_ft = 140
# this is for a human at rest.
o2_to_co2_cu_ft_per_minute = 0.009*2
# starting/natural conditions -- typical
# see http://www.molecularproducts.com/pdf/technical-library/A%20Guide%20to%20Breathing%20Rates%20in%20Confined%20Environments%20Technical%20Article.pdf
co2_percent_start = 0.000314
building_volume_cu_ft = 8*8*20
natural_ventilation_cfm = 1
# this is for a human at rest.
o2_to_co2_cu_ft_per_minute = 0.009
# starting/natural conditions -- typical
# see http://www.molecularproducts.com/pdf/technical-library/A%20Guide%20to%20Breathing%20Rates%20in%20Confined%20Environments%20Technical%20Article.pdf
co2_percent_start = 0.000314
o2_percent_start = 0.2095
@mackstann
mackstann / gist:4229933
Created December 7, 2012 01:16
Gigantic recursive directory lister
// http://www.olark.com/spw/2011/08/you-can-list-a-directory-with-8-million-files-but-not-with-ls/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
@mackstann
mackstann / gist:661754
Created November 3, 2010 21:30
my kinesis thumb keys
Win Home End
Alt PgUp
BS shift Ctrl PgDn Enter Space
# zshrc is for interactive shells only
setopt no_beep
setopt no_hup
setopt no_check_jobs
setopt no_bg_nice
setopt no_menu_complete
setopt no_auto_menu
setopt no_no_match
setopt no_auto_remove_slash
@mackstann
mackstann / gist:282440
Created January 20, 2010 23:50
Content negotiation via XMLHttpRequest
// This will change every link on a page with a *type* attribute
// to go through XMLHttpRequest, setting the Accept header, so
// that content negotiation can be used to get an alternate
// content type without having to put the content type in the URL.
$("a[type]").click(
function() {
$.ajax({
url: $(this).attr("href"),
async: false,
gen = self._conn_request(request_uri, method, body, headers)
for iter in gen:
try:
yield
except Exception, e:
gen.throw(e)
>>> BS.BeautifulSoup(u'\u201cnext generation\u201d').renderContents()
'\xe2\x80\x9cnext generation\xe2\x80\x9d'
for url in urls:
for attempt in 1, 2:
try:
resp, content = http.request(url)
break
except blah:
pass
else:
continue