Skip to content

Instantly share code, notes, and snippets.

View gist:214972
===== Places vs Place, 1 variable; Significance/Strength of Difference =====
Given the data for each county in one state and each county in another
(two samples), determine whether crime rate (one variable) is significantly
higher (in a statistics sense) in one state versus the other.
---
We're testing *one* variable, technically, but if we have a function written
up for this, we could actually forloop this and list various demographics --
population, crime rate, education, etc -- and show the difference between the
View gist:219443
# .zshrc
alias lstree="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//–/g' -e 's/^/ /' -e 's/-/|/'"
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
View mpl_test.py
# coding=utf-8
from matplotlib.figure import Figure
def make_example_pie():
"""
Follows the simple pie chart demo[1] from matplotlib's gallery, but
rewritten in a cleaner fashion that can be used for PNG rendering.
[1] http://matplotlib.sourceforge.net/examples/pylab_examples/pie_demo.html
"""
View komu_story_nophoto.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- non-standard XML format, obviously -->
<!-- example for this story:
http://www.komu.com/satellite/SatelliteRender/KOMU.com/ba8a4513-c0a8-2f11-0063-9bd94c70b769/e46a687c-80ce-0971-006f-a167008c2203
-->
<!-- should newlines in this be \n delimited? -->
<body><![CDATA[LAFAYETTE COUNTY - Horrifying details continue to surface after Missouri authorities arrested five family members on an array of child sexual abuse charges.
Law enforcement continues its search of the Mohler's property, located about 30 miles east of Kansas City. Authorities began searching Tuesday evening, and they're convinced there's still a lot of evidence to find. Authorities have confirmed they are looking for bodies buried on the property. They are also looking for glass jars that contain notes written by victims with the details of the abuse.
View komu_story_withphoto.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- non-standard XML format, obviously -->
<!-- example for this story:
http://www.komu.com/satellite/SatelliteRender/KOMU.com/ba8a4513-c0a8-2f11-0063-9bd94c70b769/e56e519a-80ce-0971-00b6-57a8d5e46f84
-->
<!-- should newlines in this be \n delimited? -->
<body><![CDATA[COLUMBIA - Columbia Transit announced Wednesday it reached its goal of two million riders for the 2009 fiscal year that ended in September.
Columbia Transit announced Wednesday it reached its goal of two million riders for the 2009 fiscal year, which ended in September. Despite initial predictions of a decrease in bus ridership, there are more Columbia passengers than ever before. Transit supervisor Drew Brooks said changes in the economy may have contributed to this year's success.
@mtigas
mtigas / backup_dir.sh
Created Feb 9, 2010
Script that creates a tarball backup of a directory, compressed with xz (LZMA2) and encrypted with GPG. Uploads backup to S3 storage space.
View backup_dir.sh
#!/bin/bash
# Script that creates a tarball backup of a directory,
# compressed with xz (LZMA2) and encrypted with GPG.
# Resulting backup is then uploaded onto my Amazon S3
# storage space.
#
# Requires:
# * GNU Tar 1.22
# * XZ Utils 4.999.9beta
# * GNU Privacy Guard
View sniff.sh
#!/bin/bash
#
# sniff.sh
# A simple script that allows your Mac to perform packet sniffing on
# unencrypted WiFi networks.
# ----------
# Usage:
# ./sniff.sh (keyword)
#
# `keyword` is optional and is simply appended to the resulting
View gist:363931
mtigas@nationbrowse:~$ ab -n 100 -c 10 http://mike.tig.as/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking mike.tig.as (be patient).....done
Server Software: nginx/0.7.62
Server Hostname: mike.tig.as
View zip_import.py
# See http://www.census.gov/tiger/tms/gazetteer/zips.txt
import csv
from places.models import ZipCode
from django.contrib.gis.geos import fromstr as geo_from_str
state_cache = dict()
reader = csv.reader(open('zips.txt'),delimiter=',',quotechar='"')
for row in reader:
@mtigas
mtigas / sunrise.html
Created Jun 7, 2010
Messing with HTML5 canvas to create a daylight clock visualization.
View sunrise.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sunlight</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">/*<![CDATA[*/
// TODO automate getting this data somehow
// http://aa.usno.navy.mil/data/docs/RS_OneDay.php