Skip to content

Instantly share code, notes, and snippets.

View j-mcc1993's full-sized avatar

James McCullough j-mcc1993

  • Bay Area & San Diego, CA
View GitHub Profile
@j-mcc1993
j-mcc1993 / Quick_Reddit_Scraper.py
Last active January 1, 2016 21:39
A script that traverses a supplied number of links on the "hot" page of the supplied subreddit and downloads all posted images (with some corner cases).
import urllib.request, os, praw, datetime
from bs4 import BeautifulSoup
from sys import argv
script, sub, lim = argv
r = praw.Reddit(user_agent = 'RedditScraper1.0 by /u/I_Am_Treebeard')
subreddit = r.get_subreddit(sub)
directory = '/Users/admin/desktop/%s (%s)' % (sub, datetime.date.today())
if not os.path.exists(directory): os.makedirs(directory)
collectpath = directory + '/All_Pictures'
@j-mcc1993
j-mcc1993 / Arduino_NES_Controller.ino
Last active January 1, 2016 21:19
Arduino Sketch that handles serial communication between NES controller and Arduino
int latch = 7; //signals controller to latch button states
int pulse = 5; //toggle to shift out button states
int data = 9; //data in line
int data_byte; //byte that stores button states
int count[] = {0,0,0,0,0,0,0,0}; //each value stores 1 or 0 indicating whether a key is currently pressed
char keys[] = {'a','b','s','d','u','j','l','r'}; //keyboard keys to be pressed
int tempbit; //iterates over the data_byte to grab each button's state
void setup() {
pinMode(latch, OUTPUT);