Skip to content

Instantly share code, notes, and snippets.

View beefy's full-sized avatar
✌️

Nate Schultz beefy

✌️
  • Zendesk
  • Philadelphia, PA
  • 04:55 (UTC -04:00)
View GitHub Profile
@beefy
beefy / generate.py
Created February 10, 2022 13:35
Generate text based on pdf files
import pickle
import random
with open("markov.pickle", "rb") as f:
markov = pickle.load(f)
length = 500
initial_word = random.choice(list(markov.keys()))
output = initial_word.decode("ascii", "ignore") + " "
previous_word = initial_word
@beefy
beefy / video_markov.py
Last active December 15, 2021 04:34
Work in progress: create a markov chain for a video to generate new frames
import os
import io
import cv2
import math
import matplotlib.pyplot as plt
import pandas as pd
from tensorflow.keras.preprocessing import image_dataset_from_directory
import numpy as np
from keras.utils import np_utils
from skimage.transform import resize
@beefy
beefy / solidity_build_docs.md
Created May 1, 2021 01:28
Run Solidity Locally Linux/Ubuntu
@beefy
beefy / chess_game_to_gif.py
Last active January 2, 2021 14:43
convert a chess pgn file to a gif
import chess.pgn
import chess.svg
import subprocess
import lichess.pgn
import lichess.api
import os
import io
import imageio
import numpy as np
import cv2
@beefy
beefy / plot_chess_data.py
Created September 3, 2018 15:07
use matplotlib on lichess data
import matplotlib.pyplot as plt
import datetime
import numpy as np
from datetime import datetime
games = []
rec= {}
keys = [
"[Event ","[Site ","[Date ","[Round ","[White ","[Black ",
"[Result ","[UTCDate ","[UTCTime ","[WhiteElo ","[BlackElo ",
@beefy
beefy / parse2.py
Last active February 5, 2019 00:08
parse chess pgn metadata into python dict
import matplotlib.pyplot as plt
import datetime
import numpy as np
from datetime import datetime
games = []
rec= {}
keys = [
"[Event ","[Site ","[Date ","[Round ","[White ","[Black ",
"[Result ","[UTCDate ","[UTCTime ","[WhiteElo ","[BlackElo ",
# by convention the first makefile target
# compile, run the problems, then clean up
all: compile run
# compile all of the files
# and execute them
run:
java -cp ./build/classes main/Checkers
# compile all of the files
@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):
@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 / 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()