Skip to content

Instantly share code, notes, and snippets.

View koverholt's full-sized avatar

Kristopher Overholt koverholt

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyFPmr8gxiYTmuD+sFiQZofVII0xW1xBYY+SWEKU9vGOmSZeH/LFpLAouKPOh/3Rmutc67r27YwZ90GpMcw0flDwwpFUkb9ETgiULw4tysoIT119NklhVMuxhbgAgI9a9rTmsvYM5qDDYhiCef19xEFhKUitbp0WOF9idnV+OyvqfA7eudO80gqmwyiO7HWhaW5NmX4c4t95953sjq65CBFuyybC1lK5P6Nn+bEOo8KmldX3Cjmhxt69ZJu3tZRxAtqv5hw0abbD4Ou7BmsTSdRrp2JUQcS83s1YuRW5eFpqyl55rwbBaxYwtq0CHYGI/ismN9BdNHDBwv0jDbASPj koverholt@continuum
@koverholt
koverholt / spark_numpy.py
Created April 10, 2015 20:59
Simple Numpy example in Spark
import numpy as np
from pyspark import SparkContext
from pyspark import SparkConf
conf = SparkConf()
conf.setMaster("spark://<HOSTNAME>:7077")
conf.setAppName("NumpyMult")
sc = SparkContext(conf=conf)
@koverholt
koverholt / spark_wordcount.py
Last active August 29, 2015 14:17
Example Wordcount in Spark
from pyspark import SparkContext
from pyspark import SparkConf
if __name__ == "__main__":
conf = SparkConf()
conf.setMaster("spark://{hostname}:7077")
conf.setAppName("WordCount")
sc = SparkContext(conf=conf)
file = sc.textFile("/mnt/gluster/pg2591.txt")
from __future__ import division
import bloscpack
import cPickle
import numpy as np
import timeit
x = np.empty(10000000)
# cPickle without protocol keyword argument
import sys
from PyQt4 import QtCore, QtGui, uic
qtCreatorFile = "" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class MyApp(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
@koverholt
koverholt / geo_location.py
Created March 19, 2015 17:01
Comparison of geolocation services
import geopy
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, Range1d, ColumnDataSource, LinearAxis,
PanTool, WheelZoomTool, BoxSelectTool, HoverTool,
BoxSelectionOverlay, GMapOptions,
NumeralTickFormatter, PrintfTickFormatter)
@koverholt
koverholt / cluster_fds_run.py
Last active August 29, 2015 14:16
Anaconda Cluster - FDS
from conda_cluster.config import get_cluster_list
import subprocess
SSH_KEY_LOCATION = '/Users/koverholt/.ssh/koverholt.pem'
CLUSTER_NAME = 'cluster_fds'
USER = 'ubuntu'
# List of cluster nodes from conda-cluster
clusters = get_cluster_list()
compute_nodes = clusters[CLUSTER_NAME]['machines']['compute']
@koverholt
koverholt / newton.py
Created November 11, 2011 05:01
newtonRaphson method
## module error
''' err(string).
Prints 'string' and terminates program.
'''
import sys
def err(string):
print string
raw_input('Press return to exit')
sys.exit()
import numpy as np
def stats(path, string):
# Write to stats text file
filename = path
f = open(filename, 'a')
f.write(string)
f.close()
headers = np.array(['Name', 'Temperature (C)', 'Heat Flux (kw/m2)'])
#!/usr/bin/env python
from __future__ import division
import math
def myexp(x):
''' myexp(x) will compute e^x for any x by measuring the difference in the last 2 terms of the series. '''
tot = (1 + x)
n = 1
while (tot != tot + x):