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
""" | |
Kombu and Celery were doing something strange were I noticed rabbit had | |
a large number of unacked messages, but when I hit .get() I got nothing. | |
This manifested on the client side of things at times where it would work once, | |
hang the next. And then work again. | |
""" | |
# This was the bad code | |
with kombu.Connection(RABBIT_HOST) as conn: |
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
var thresh = 100e6; | |
var lis = document.querySelectorAll('.yt-lockup-meta-info li'); | |
for(var i = 0; i < lis.length; i++) { | |
var text = lis[i].textContent; | |
if(text.indexOf('views') == -1) { | |
continue; | |
} | |
if(Number(text.replace(' views','').replace(/,/g, '')) < thresh) { | |
//console.log('-' + text); | |
var li = lis[i].parentNode.parentNode.parentNode.parentNode.parentNode; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="keywords" lang="de" content="Zeitleiste, Zeitlinie, Zeitkarte, Geschichte, Chronologie"> | |
<meta name="keywords" lang="en" content="Timeline, Timemap, History, Chronology"> | |
<title>Timeline - Proof-of-concept</title> | |
<!-- That's my local d3 path. When working locally, use your local path. --> |
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
""" | |
Thank you | |
http://stackoverflow.com/a/24588289/177498 | |
""" | |
def debug(): | |
import logging | |
# These two lines enable debugging at httplib level (requests->urllib3->http.client) | |
# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA. |
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
import sys | |
import pprint | |
import json | |
import requests | |
base_url = 'http://localhost:9200' | |
INDEX_COUNT = 400 |
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 gist is a one-click pip setup for windows: | |
1. installs distribute if needed | |
2. installs pip | |
3. (On windows) sets the path environment variable so "pip" is always runnable from cmd. | |
Tested on Windows 7 with python2.7 | |
""" |
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
""" | |
These two repr implementations make a "repr" that you can just drop into your class if it's a simple one. | |
""" | |
class A: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def __repr__(self): | |
return "%s(**%r)" % (self.__class__.__name__, self.__dict__) |
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
#!/usr/bin/python2.7 | |
""" | |
Outputs on my PC: | |
"python2.7 startup_times.py nop" min run 0.019732 seconds | |
"python3.3 startup_times.py nop" min run 0.026251 seconds | |
""" | |
import subprocess | |
import time |
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
""" | |
Analyze USA h1b salaries | |
data from http://www.foreignlaborcert.doleta.gov/quarterlydata.cfm | |
specifically: | |
http://www.foreignlaborcert.doleta.gov/pdf/quarter_2_2012/PW_FY2012_Q2.csv | |
""" | |
import math |
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
<!DOCTYPE html> | |
<html manifest="main.appcache"> | |
<meta charset="utf-8"> | |
<style> | |
.circle, .wave { | |
fill: none; | |
stroke: steelblue; | |
stroke-width: 1.5px; | |
} |
OlderNewer