This file contains hidden or 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
{ | |
"metadata": { | |
"name": "Next PyBulls Meeting" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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
CREATE TABLE #LocalTempTable( | |
somenum INT); | |
INSERT into #LocalTempTable values (2); | |
INSERT into #LocalTempTable values (4); | |
INSERT into #LocalTempTable values (6); | |
select * from #LocalTempTable; | |
select avg(somenum) |
This file contains hidden or 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
def make_bold(fn): | |
def bold(): | |
return "<b>{}</b>".format(fn()) | |
return bold | |
def make_italic(fn): | |
def italic(): | |
return "<i>{}</i>".format(fn()) | |
return italic |
This file contains hidden or 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
def roman(): | |
i = "" | |
for cnt in range(1,30): | |
if cnt != 1 and cnt % 10 == 0: | |
i = i[:-5] + "x" | |
elif cnt != 1 and cnt % 5 == 0: | |
i = i[:-4] + "v" | |
else: | |
i += "i" | |
print cnt, i |
This file contains hidden or 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
def make_global(): | |
global x | |
x = 1 | |
def some_func(): | |
print x, | |
def main(): | |
make_global() | |
some_func() |
This file contains hidden or 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
```{r} | |
library(ggplot2) | |
# Multiple plot function | |
# | |
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects) | |
# - cols: Number of columns in layout | |
# - layout: A matrix specifying the layout. If present, 'cols' is ignored. | |
# | |
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE), |
This file contains hidden or 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
// Source: http://www.census.gov/geo/www/ansi/countylookup.html | |
var countyToFIPS = { | |
'Alabama': { | |
'Autauga County': '01001', | |
'Baldwin County': '01003', | |
'Barbour County': '01005', | |
'Bibb County': '01007', | |
'Blount County': '01009', | |
'Bullock County': '01011', |
This file contains hidden or 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
{ | |
"01": "Alabama", | |
"02": "Alaska", | |
"04": "Arizona", | |
"05": "Arkansas", | |
"06": "California", | |
"08": "Colorado", | |
"09": "Connecticut", | |
"10": "Delaware", | |
"11": "District of Columbia", |
This file contains hidden or 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
[ec2-user@ip-10-195-227-243 ~]$ python | |
Python 2.7.3 (default, Apr 30 2012, 21:18:10) | |
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from mapnik import * | |
m = Map(400,500,'+proj=latlong +datum=WGS84') | |
m.background = Color('transparent') | |
s = Style() | |
r = Rule() |
This file contains hidden or 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 | |
def get_fips(): | |
lines = open("counties_fips_list.txt").readlines() | |
fips = [line.strip() for line in lines] | |
return fips | |
if __name__ == "__main__": | |
wetsawn = sys.argv[1] # pass the wetsaw # as an argument | |
fips = get_fips() |