Skip to content

Instantly share code, notes, and snippets.

@montycheese
montycheese / delete_extra.py
Last active August 29, 2015 14:04
Delete files with multiple versions
import os, glob
path = "/Users/mowong/Documents/Thumbnails/Big_Thumbnail_Project" # update to current dir
list = ["1","3","4"] #append here the version number(s)
for x in list:
for files in glob.glob("/Users/mowong/Documents/Thumbnails/Big_Thumbnail_Project/*-0%s.jpg" % x):
os.remove(files)
@montycheese
montycheese / BlackJack.py
Last active August 29, 2015 14:06
Black Jack game
from random import randint
import datetime
score = 100
round = 1
#date and time included in high scores
now = datetime.datetime.now()
today = datetime.date.today()
numericalDate = "%d/%d/%d" % (today.day, today.month, today.year)
@montycheese
montycheese / ZapposGiftProgram.py
Last active July 18, 2016 11:38
Requires Python Libraries: requests, json.
#! /usr/bin/env python2.7
# Author:****
# Education: ****
# Email: ****
# Phone: 808-633-****
# Purpose: ZapposGiftProgram.py is my submission for Zappos' 2015 Summer
# Software Engineering Internship application. The program prompts the user for two
# inputs: the amount of money they want to spend, and how many gifts they want to purchase.
# The program searches through Zappos's website using its API and returns a series of
@montycheese
montycheese / CheckRedditKarma.py
Last active August 29, 2015 14:07
Reddit Comment and Karma checker
import requests, webbrowser
def get_reddit_user_info(username):
url = "https://www.reddit.com/user/%s.json" % username
r = requests.get(url)
json_data = r.json()
#op = json_data['data']['children'][0]['data']['link_author']
#individualpost = json_data['data']['children'][0]['data']
@montycheese
montycheese / SubredditTracker.py
Created October 21, 2014 02:53
Subreddit ranking tracker
import requests, webbrowser
def get_frontpage_info():
url = "http://www.reddit.com/.json"
r = requests.get(url)
json_data = r.json()
try:
@montycheese
montycheese / SortingAlgorithms.java
Created November 3, 2014 04:58
Sorting Algorithms
import java.util.Scanner;
public class SortingAlgorithms {
public static void main(String[] args) {
int[] anArray = {2, 3, 1, 5, 6, 33, 10, 15, 16, 4, 7, 1000};
int searchTerm;
System.out.println("Starting array");
for (int x = 0; x < anArray.length; x ++)
System.out.printf("%d ", anArray[x]);
@montycheese
montycheese / calculator.py
Last active August 29, 2015 14:10
Calculator with Tinkter GUI
from Tkinter import *
from math import *
from time import sleep
import webbrowser
class Calculator():
def __init__(self):
self.root = Tk()
self.root.wm_title("Montana's Calculator")
@montycheese
montycheese / ShiftCypher.py
Created December 1, 2014 01:01
Shift Cypher encryption and decryption
import string
REPLACE_SPACE = None
def map_alphabet():
alphabet = string.lowercase
map = dict()
map[" "] = REPLACE_SPACE # if spaces are found in code
for idx in range(0, 26):
map[alphabet[idx]] = idx
@montycheese
montycheese / acronym.py
Created January 14, 2015 15:50
Acronym expander
abbvr = {
"lol": "laugh out loud",
"dw": "don't worry",
"hf": "have fun",
"gg": "good game",
"brb": "be right back",
"g2g": "got to go",
"wtf": "what the fuck",
"wp": "well played",
"gl": "good luck",
@montycheese
montycheese / pharm_analysis.py
Last active August 29, 2015 14:17
Analysis of Pharmaceutical web scraping results
import os
#File extensions to scrape
EXT = '.txt'
#filter out files to parse within entire directory
files = [
file for file in os.listdir('.')
if os.path.isfile(file)
and file.endswith('.txt')
and file.startswith('no_')