This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for url in urls: | |
for attempt in 1, 2: | |
try: | |
resp, content = http.request(url) | |
break | |
except blah: | |
pass | |
else: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> BS.BeautifulSoup(u'\u201cnext generation\u201d').renderContents() | |
'\xe2\x80\x9cnext generation\xe2\x80\x9d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gen = self._conn_request(request_uri, method, body, headers) | |
for iter in gen: | |
try: | |
yield | |
except Exception, e: | |
gen.throw(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Win Home End | |
Alt PgUp | |
BS shift Ctrl PgDn Enter Space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |