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 sys | |
import sqlite3 | |
import time | |
import uuid | |
from functools import wraps | |
DB_FILE = 'tester.db' | |
FILE = 'tester.cache' |
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
""" | |
Usage: | |
python simple_http_example.py [sync|async] | |
Description: | |
Simple python script to show the differences in implementation/speed of | |
synchronous and asynchronous approach for downloading content. | |
The output will show what was downloaded. The script repeats five | |
times and prints the average run speed before exiting. |
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
#include <SPI.h> | |
#include <Adafruit_GPS.h> | |
//#include <SoftwareSerial.h> | |
#include <SD.h> | |
#include <DHT.h> | |
#include <avr/sleep.h> | |
// Ladyada's logger modified by Bill Greiman to use the SdFat library | |
// | |
// This code shows how to listen to the GPS module in an interrupt |
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 convert_degree_dec_min_to_degree_dec(degree_dec_min: str): | |
""" | |
Converts a string that looks like this: | |
- "12238.2974W" | |
To this: | |
- -122.63829 | |
In other words, it converts the "Degrees and Decimal Minutes" format |
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
#! /bin/bash | |
############################################################################# | |
# Author: Travis Hathaway # | |
# # | |
# Description: # | |
# This is a simple script used to transform a .mov file to a .gif file # | |
# # | |
# Example: # | |
# mov_to_gif <mov_file> <start_time:seconds> <duration:seconds> # | |
# mov_to_gif your_movie.mov 5 2.5 # |
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 | |
from functools import wraps | |
def sqlite_conn(func): | |
@wraps(func) | |
def wrap(self, *args, **kwargs): | |
conn = getattr(self, 'conn', None) | |
if not conn: | |
raise NotImplementedError( |
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
from functools import wraps | |
import sqlite3 | |
CONN_STR = '/tmp/foo.db' | |
def sqlite_conn(conn_str): | |
def dec_func(func): | |
@wraps(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
from functools import wraps | |
import psycopg2 | |
#################### | |
# Define Decorator # | |
#################### | |
def psycopg2_cursor(conn_info): | |
"""Wrap function to setup and tear down a Postgres connection while | |
providing a cursor object to make queries with. |
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
#! /bin/bash | |
# Author: Travis Hathaway | |
# | |
# Description: | |
# This file downloads crime report data from portlandoregon.gov's FTP server | |
# and then loads it in to a postgres database. | |
# | |
# How to use: | |
# Simply change the DB_* variables to fit your local installation. I assume that | |
# you are using a passwordless Postgres account. |
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
#! /bin/bash | |
# | |
# Author: Travis Hathaway | |
# | |
# Description: | |
# This is a script that will import csv data from gathered from | |
# the chicago crime reports stream. More info here: | |
# https://data.cityofchicago.org/Public-Safety/Crimes-2001-to-present/ijzp-q8t2/data | |
# | |
# Requirements: |
NewerOlder