Skip to content

Instantly share code, notes, and snippets.

View mtdukes's full-sized avatar

Tyler Dukes mtdukes

View GitHub Profile
import csv, statistics
with open('nc_county_time_series0611.csv', 'rU') as time_series_file:
filereader = csv.reader(time_series_file)
with open('sts_county_transposed.csv','w') as transposed_file:
fieldnames = ['nc_county','date', 'date_count', 'cases','new_cases', 'rolling_avg']
filewriter = csv.DictWriter(transposed_file, fieldnames = fieldnames)
filewriter.writeheader()
rowcounter = 0
for row in filereader:
@mtdukes
mtdukes / nc_licensure.txt
Created January 8, 2020 21:46
Occupations requiring NC licensure
Acupuncturist
Adult Care Administrator
Aerial Pesticide Applicator
Air Traffic Control Tower Operator
Aircraft Dispatcher
Aircraft Mechanic
Aircraft Repairperson
Alarm Installer
Alarm System Business Licensee
Alcoholic Beverage Distributor/Vendor Representative
@echo off
::Enter a project name to create a new project directory
::Provided you have a template folder with the following structure:
::chron.docx
::documents
::interviews
::>audio
::questions.txt
::data
::>data-diary.txt
@mtdukes
mtdukes / msg_cleaner.bas
Created April 29, 2019 17:47
A VBA script for Outlook to clean msg files not loading correctly into Outlook due to Internal MAPI errors
Sub savemsg()
Debug.Print "Running..."
ListFilesInFolder "SOURCE DIR HERE"
End Sub
Sub ListFilesInFolder(SourceFolderName As String)
Debug.Print "Loading source folder..."
Debug.Print SourceFolderName
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
@mtdukes
mtdukes / parse_date.py
Created July 27, 2017 17:59
Get a python date object from a date string
#import the datetime library
from datetime import datetime
#Get a python date object from a date string
#specify the date string with ex '%Y%m%d'
def parse_date(d, date_string):
if d:
try:
parsed_date = datetime.strptime(d, date_string).date()
except ValueError, e:
@mtdukes
mtdukes / nc_county_choices.py
Created July 24, 2017 16:54
NC County code list
COUNTY_CODE_CHOICES = (
('000','Alamance'),
('010','Alexander'),
('020','Alleghany'),
('030','Anson'),
('040','Ashe'),
('050','Avery'),
('060','Beaufort'),
('070','Bertie'),
('080','Bladen'),
@mtdukes
mtdukes / hello-world.py
Last active May 11, 2017 19:18
A simple program to run from the command line
#import a python library to help us work with dates and times
import datetime
# define a FUNCTION to run a specified task
def main():
print 'Hello World!'
print 'I am some prepackaged code.'
print "I don't do much, but I'm still special!"
# another function, but we won't run this at first
@mtdukes
mtdukes / collegescorecard_v2.py
Last active April 20, 2017 04:02
A generalized script to gather data from DOE's College Scorecard site using JSON
'''
A generalized script to gather data from
DOE's College Scorecard site using JSON
USAGE
python collegescorecard_v2.py 'https://api.data.gov/ed/collegescorecard/v1/schools.json?school.ownership=2&fields=id,school.name,2014.student.share_firstgeneration&page=0&per_page=100&api_key=MY_API_KEY_HIDDEN'
'''
#import libraries
#the time library allows us to pause for a second
from time import sleep
[
['Alabama','AL'],
['Montana','MT'],
['Alaska','AK'],
['Nebraska','NE'],
['Arizona','AZ'],
['Nevada','NV'],
['Arkansas','AR'],
['New Hampshire','NH'],
['California','CA'],
[
'Alamance',
'Alexander',
'Alleghany',
'Anson',
'Ashe',
'Avery',
'Beaufort',
'Bertie',
'Bladen',