Skip to content

Instantly share code, notes, and snippets.

View beefy's full-sized avatar
✌️

Nate Schultz beefy

✌️
  • Zendesk
  • Philadelphia, PA
  • 23:47 (UTC -04:00)
View GitHub Profile
@beefy
beefy / gen_pdf.py
Created September 20, 2016 20:51
Generate pdf files from LaTeX tex files
import os
# execute `sudo apt-get install texlive-full` to install pdflatex
files = [file for file in os.listdir('.') if file.endswith('.tex')]
for file in files:
os.system('pdflatex '+file)
@beefy
beefy / yahoo_scrapper.py
Last active October 4, 2016 20:34
finance.yahoo.com web scrapper in python
#!/usr/bin/env python2.7
# taken from https://www.youtube.com/user/sentdex
import time
import urllib2
from urllib2 import urlopen
from lxml import html
sp500short = ['a', 'aa', 'aapl', 'abbv', 'abc', 'abt', 'ace', 'aci', 'acn', 'act', 'adbe', 'adi', 'adm', 'adp']
@beefy
beefy / chess_scrape.py
Last active December 29, 2020 03:56
Scrapes all live chess game PGNs from chess.com and concatenates the resulting files
#!/usr/bin/python
import spynner
import pyquery
import urllib
import os
# author: Nate Schultz
# contact: github.com/beefy
# created: 10/22/16
/* $begin csapp.c */
#include "csapp.h"
/**************************
* Error-handling functions
**************************/
/* $begin errorfuns */
/* $begin unixerror */
void unix_error(char *msg) /* unix-style error */
{
@beefy
beefy / git-alias.sh
Last active May 10, 2017 17:34
An alias to simplify git committing
#!/usr/bin/env bash
do_push() {
while true; do
read -p "ready to push? " yn
case $yn in
[Yy]* ) read -p "commit msg: " msg; git add . -A; git commit -m "$msg"; git push; break;;
* ) kill -INT $$;;
esac
done
@beefy
beefy / client.c
Last active July 26, 2017 13:05 — forked from evanradcliffe/client.c
simple network in C from CS283
#include "csapp.h"
/* usage: ./echoclient host port */
int main(int argc, char **argv)
{
int clientfd, port;
char *host, buf[MAXLINE];
rio_t rio;
host = argv[1];
port = atoi(argv[2]);
@beefy
beefy / parker_square.py
Created August 13, 2017 19:42
Try to find a 3x3 magic square
# written by: https://github.com/beefy
# for: https://www.reddit.com/r/math/comments/6tcrxs/3x3_magic_square_of_squares_1000_prize/
import numpy as np
while(1):
# generate a random 3x3 matrix
parker = np.random.randint(1000, size=(3, 3))
@beefy
beefy / clock.py
Last active September 14, 2017 18:55
prints the current time
import time
import datetime
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
time_format = ['%I:%M:%S %p','%I %M %S %p']
while (True):
print CURSOR_UP_ONE + ERASE_LINE + CURSOR_UP_ONE
print datetime.datetime.now().strftime(time_format[0])
time_format.reverse()
@beefy
beefy / delete_calendar_events.gs
Created August 28, 2017 18:26
Delete all google calendar events in a range
function myFunction() {
var fromDate = new Date(2017,8,1,0,0,0);
var toDate = new Date(2017,8,16,0,0,0);
// delete from Sept 1 through Sept 15, 2017
var calendar = CalendarApp.getCalendarsByName('NateSchultz')[0];
var events = calendar.getEvents(fromDate, toDate);
for(var i=0; i<events.length;i++){
var ev = events[i];
@beefy
beefy / tweeter.py
Created September 25, 2017 03:32
a twitter bot to tweet tweets from a text file
import tweepy
import time
def login_to_twitter(consumer_key, consumer_secret, access_token, access_token_secret):
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
return tweepy.API(auth)
def tweet(api, tweet):