Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
# 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])
#!/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)
@BlogBlocks
BlogBlocks / GoogleMapDownloader.py
Last active December 8, 2017 13:48 — forked from eskriett/GoogleMapDownloader.py
A python script to download high resolution Google map images given a longitude, latitude and zoom level.
#!/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
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)
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]
# 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]
@BlogBlocks
BlogBlocks / Key.py
Last active December 8, 2017 13:49
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
# -*- coding: utf-8 -*-
"""
Collage maker - tool to create picture collages
Author: Delimitry
"""
import time
import argparse
import os
import random
from PIL import Image
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
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"