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
#!/bin/bash | |
# | |
# Install lxml on Mac OS X 10.7. It might work for 10.8 as well. | |
# | |
LXML_LIB=libxml2-2.9.0 | |
LXML_ARCHIVE=libxml2-2.9.0.tar.gz | |
# Start install, it's going to fail... | |
STATIC_DEPS=true pip install lxml |
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/python | |
# -*- coding: utf-8 -*- | |
# | |
# Download meta information from: | |
# - http://thejoysofcode.com | |
# - http://devopsreactions.tumblr.com | |
# | |
# Script downloads title, link and image url for each post. First run will | |
# extract all posts. Following executions just update db. Posts are stored | |
# in JSON format in 'posts-joys.json' and 'posts-devops.json'. |
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 os, sys, time | |
def print_stats(buckets): | |
# source: http://mathworld.wolfram.com/BenfordsLaw.html | |
benford = (0.30103, 0.176091, 0.124939, 0.09691, 0.0791812, 0.0669468, 0.0579919, 0.0511525, 0.0457575) | |
try: | |
vals = [float(buckets[x])/sum(buckets) for x in range(len(buckets))] | |
print 'Digit\tResult\tBenford\tDifference' | |
for i, val in enumerate(vals): | |
error = (benford[i] - vals[i]) |
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/env python | |
import os | |
paths = os.getenv('PATH').split(os.pathsep) | |
cleaned_paths = [] | |
for path in paths: | |
if path in cleaned_paths: | |
print 'Duplicated:', path | |
continue | |
if not os.path.exists(path): | |
print 'Doesn\'t exist: ', 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
appStores = { | |
"Albania": 143575, | |
"Algeria": 143563, | |
"Angola": 143564, | |
"Anguilla": 143538, | |
"Antigua And Barbuda": 143540, | |
"Argentina": 143505, | |
"Armenia": 143524, | |
"Australia": 143460, | |
"Austria": 143445, |