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
| # Where to get the data: | |
| # Crimes_-_2001_to_present.csv | |
| # https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 | |
| # THIS IS A BIG FILE - 1.5 gig | |
| # prints a range within the file | |
| #USAGE: Line 0 is the header row | |
| # python PrintRange.py Crimes_-_2001_to_present.csv 0 15 | |
| import sys | |
| filename = sys.argv[1] | |
| starT = int(sys.argv[2]) |
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
| #!/usr/bin/python | |
| %matplotlib inline | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # gives a base to x and y | |
| x=[] | |
| y=[] | |
| with open("Crimes_file.txt") as f: | |
| data = f.read() | |
| data = zip(*[iter(data.split(" "))]*2) |
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
| #!/usr/bin/python | |
| # GoogleMapDownloader.py | |
| # Created by Hayden Eskriett [http://eskriett.com] | |
| # | |
| # A script which when given a longitude, latitude and zoom level downloads a | |
| # high resolution google map | |
| # Find the associated blog post at: http://blog.eskriett.com/2013/07/19/downloading-google-maps/ | |
| import urllib | |
| import Image |
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 | |
| import timeit | |
| def txsearch(): | |
| # Ask to enter string to search | |
| Sstring = raw_input("Search Phrase") | |
| for fname in os.listdir('./'): | |
| # Apply file type filter | |
| if fname.endswith(".txt"): | |
| # Open file for reading | |
| fo = open(fname) |
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 sys | |
| import tweepy | |
| import csv | |
| import Key | |
| #pass security information to variables | |
| consumer_key = Key.twiter()[0] | |
| consumer_secret = Key.twiter()[1] | |
| access_key = Key.twiter()[2] | |
| access_secret = Key.twiter()[3] |
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
| # post image and tweet to Twitter | |
| # USAGE: import Tpost | |
| # Tpost.tpost(ImgPath,STR) | |
| import sys | |
| import twython | |
| from twython import Twython | |
| import Key | |
| def tpost(ImgPath,STR): | |
| CONSUMER_KEY = Key.twiter()[0] | |
| CONSUMER_SECRET = Key.twiter()[1] |
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 twiter(): | |
| CONSUMER_KEY = 'aaaaaaaaaaaaa' | |
| CONSUMER_SECRET = 'bbbbbbbbbbbbbbbbbbbbb' | |
| ACCESS_KEY = 'ccccccccccccccccccccccccccccc' | |
| ACCESS_SECRET = 'dddddddddddddddddddddddddddddddd' | |
| twitter = (CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET) | |
| return twitter |
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
| # -*- coding: utf-8 -*- | |
| """ | |
| Collage maker - tool to create picture collages | |
| Author: Delimitry | |
| """ | |
| import time | |
| import argparse | |
| import os | |
| import random | |
| from PIL import Image |
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 sqlite3 | |
| import os.path | |
| from os import listdir, getcwd | |
| from IPython.core.display import Image | |
| def getImage_list(rel_path): | |
| abs_path = os.path.join(os.getcwd(),rel_path) | |
| print 'abs_path =', abs_path | |
| dir_files = os.listdir(abs_path) | |
| return dir_files |
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 dbread(): | |
| import sqlite3 | |
| conn = sqlite3.connect('XPfts4.db') | |
| c = conn.cursor() | |
| count = 0 | |
| req = 100 | |
| view = raw_input("Search : ") | |
| for row in c.execute('SELECT rowid, code FROM pages WHERE pages MATCH ?', (view,)): | |
| count=count+1 | |
| print (row)[0],"-",(row)[1],"\n" |