Skip to content

Instantly share code, notes, and snippets.

@mkowoods
mkowoods / gist:45f4d4d91a9d78d80845
Last active August 29, 2015 14:07
Keep In Mind
http://rgraphgallery.blogspot.com/
#Base graphic reference Guide
http://www.inside-r.org/r-doc/graphics/par
http://projecttemplate.net/index.html
http://alignedleft.com/tutorials/d3
@mkowoods
mkowoods / google_maps.py
Created October 19, 2014 01:08
Class to Access Google Maps API
import urllib
import json
"""
https://developers.google.com/maps/documentation/geocoding/
https://developers.google.com/maps/documentation/distancematrix/
"""
class GoogleMapsAPI(object):
def __init__(self):
@mkowoods
mkowoods / tkinter-file-dialog.py
Created October 19, 2014 01:17
Tkinter File Dialog
from Tkinter import *
import tkFileDialog
root = Tk()
root.withdraw()
inputfile = tkFileDialog.askopenfilename(initialdir = 'C:\\', title = "Select Quote File", filetypes = [('csv files', '.csv')])
print inputfile
import csv
@mkowoods
mkowoods / simplehttp-server.py
Last active August 29, 2015 14:08
simplehttp server
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: mwoods
#
# Created: 05/11/2014
# Copyright: (c) mwoods 2014
# Licence: <your licence>
#-------------------------------------------------------------------------------
@mkowoods
mkowoods / gist:41e320bda51f4fc8653a
Created November 1, 2014 22:45
Search File Tree for specific Files and then copy them to a new directory
import os
SET_PATH = "E:\\"
os.chdir(SET_PATH)
results = os.walk(SET_PATH)
@mkowoods
mkowoods / gist:dedfc93f0aa74c921e35
Created November 6, 2014 17:43
Fork Me on Github
https://github.com/blog/273-github-ribbons
<a href="https://github.com/you"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
@mkowoods
mkowoods / gist:e24e67782c39b0ccf394
Created November 18, 2014 02:12
Quick Letter Count Script
def letter_frequency(text):
wdct = {}
for n in text:
m = n.lower()
if m.isalpha():
wdct[m] = wdct.get(m, 0) + 1
return sorted([(k,v) for k,v in wdct.iteritems()], key = lambda x : (-x[1], x[0]))
result = letter_frequency('IWT LDGAS XH HIXAA P LTXGS EAPRT, STHEXIT BN TUUDGIH ID BPZT RATPG PCS ETGUTRI HTCHT DU XI.')
@mkowoods
mkowoods / gist:903c140767483b702f77
Last active August 29, 2015 14:10
email blast messaging solution
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 20 18:48:28 2014
@author: mwoods
code is based on textbelt by Ian Webster
https://github.com/typpo/textbelt/tree/master/lib
"""
@mkowoods
mkowoods / gist:797e8b9bf446fdcd209f
Last active August 29, 2015 14:10
Playing with Test and Training Set Error
n_col = 100
n_rows = 1000
set.seed(500)
rand.matrix <- matrix(data = rep(NA, n_rows*n_col), nrow = n_rows, ncol = n_col)
rand.class <- rbinom(n = n_rows, size = 1, prob = 0.7)
#Assign some variables to be randomly relevant
for(i in 1:n_col){
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import time
VERBOSE = False
def wait(seconds):