Instantly share code, notes, and snippets.

# Paulpayoung

• Sort options
Last active Dec 18, 2015 — forked from eleddy/inheritance.py
View inheritance.py
 #!/usr/bin/python class Toy(object): inventory = 0 def __init__(self, price, name, quantity): self.price = price self.name = name self.quantity = quantity
Created Jul 26, 2013
Python function that plots the data from a traveling salesman problem that I am working on for a discrete optimization class on Coursera. It can take multiple iterations of the path between nodes and plot out the current path as well as the old paths. Helps with troubleshooting and improving the algorithms that I am working on.
View tsp_plot.py
 import matplotlib.pyplot as plt def plotTSP(path, points, num_iters=1): """ path: List of lists with the different orders in which the nodes are visited points: coordinates for the different nodes num_iters: number of paths that are in the path list """
Created Aug 6, 2013
This script compares the performance of three different methods for finding the nearest neighbors from a list of coordinates. The first method is a simple 'for loop'. The second method uses the KDTree object from the scipy.spatial library. The third method uses cKDTree from the scipy.spatial library. Both the KDTree and cKDTree methods are signi…
View kdtree_evaluation.py
 import numpy as np import scipy.spatial as ss from itertools import combinations from itertools import permutations import math import random from time import clock def length(point1, point2):
Last active Dec 24, 2015
Personal config file for gVim
View .vimrc
 colorscheme slate set expandtab set tabstop=4 set shiftwidth=4 map :retab set guifont=Monospace\ 8 " To enable the saving and restoring of screen positions. let g:screen_size_restore_pos = 1
Created Oct 3, 2013
This is a python class wrapped around a number of common boto methods that I use to access AWS. Makes the code a little cleaner and abstracts away the details of making the connection to aws. At the moment it only contains methods to push and pull data to S3. WIll most likely add a method to retrieve a list files in a S3 bucket, and possibly add…
View AwsConnect.py
 import boto import boto.s3.connection # credentials.py should contain the access_key and secret_key which are needed for # the boto S3 connection import credentials as cr class AwsConnect(object): def __init__(self, bucket): self.bucket = bucket
Created Sep 24, 2014
One of the first python programs I wrote. For some reason, I chose to download the html and save to text files. I think I was having trouble working with the raw html with bs4. Anyway, I am leaving it 'as is' mostly for the sake of having a reference point in regards to how my python programming improve (or doesn't) over time.
View SurfCheck.py
 #-----------------------------------------------------------------------------# # Parses the converted html files to find the swell heights and conditions # and then prints these out into formatted tables #-----------------------------------------------------------------------------# import urllib2 from bs4 import BeautifulSoup # Scarpe the site and convert html to text
Last active Nov 28, 2015
Crouton/Chromebook Setup Instructions and Preferences
View ChrootSetup
 # Setup guide for chromebook # Crouton chroot comes with # stripped down versions of the OS, so need to add a lot # of applications # Due to issues with the anaconda distribution # and virtualenv, I am running two trusty/unity chroots # one for data analysis work and one for development work # I'll call the data chroot 'datatrusty' and the dev chroot
You can’t perform that action at this time.