Skip to content

Instantly share code, notes, and snippets.

View liamstrilchuk's full-sized avatar

Liam Strilchuk liamstrilchuk

  • Ontario, Canada
View GitHub Profile
@liamstrilchuk
liamstrilchuk / astar.html
Created November 22, 2020 15:55
Visualizing the A* pathfinding algorithm
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<canvas id="canvas"></canvas><br>
<button onclick="pause()">Start / Pause</button>
<p id="status">Status: Paused</p>
<script>
@liamstrilchuk
liamstrilchuk / delete.py
Last active November 22, 2020 17:59
nicebot
import praw, sys, json
login_details = json.loads(open("login.json", "r").read())
reddit = praw.Reddit(client_id=login_details["client_id"], \
client_secret=login_details["client_secret"], \
user_agent=login_details["user_agent"], \
username=login_details["username"], \
password=login_details["password"])
scores = {}
@liamstrilchuk
liamstrilchuk / italia.py
Created September 15, 2020 15:23
lol italia lol
import sys, praw, time, math
def main():
N = 350
LINE TO DEFINE REDDIT WITH MY PASSWORD GOES HERE
sub = reddit.subreddit("u_iwillgetitalia")
target = base36decode(sys.argv[1])
for post in reddit.subreddit("all").stream.submissions():
print(abs(base36decode(post.id) - target + N), post.id)
@liamstrilchuk
liamstrilchuk / analyzecovid.py
Created September 14, 2020 22:13
Get CSV file (needs owid-covid-data.csv)
import csv
def main():
days = {}
countries = ["United States", "India", "Brazil", "Russia", "Peru"]
with open("owid-covid-data.csv") as f:
reader = csv.reader(f)
for line in reader:
@liamstrilchuk
liamstrilchuk / analyze.py
Created September 14, 2020 17:25
Get words and characters of post titles
import json, math
def main():
data = json.loads(open("filteredposts.txt", "r").read())
subs = {}
word_counts = {}
allowed_subs = []
@liamstrilchuk
liamstrilchuk / flappy.html
Last active November 30, 2020 07:56
Flappy Bird in 373 bytes
<body onload="z=c.getContext`2d`;c.width=W=400,c.height=H=600,Y=E=200,Q=z.fillRect.bind(z),M=S=p=0;N=M=>z.fillStyle=M;c.onclick=_=>M=9;R=_=>{M=S=p=0,Y=E};setInterval(_=>{p=p||[W,Math.random()*W],N`red`,Q(0,0,W,H),Y-=M-=.5,X=p[0]-=8,N`black`,Q(X,0,V=50,Z=p[1]),Q(X,Z+E,V,H),(Y<Z||Y>Z+E)&&X<B&&R(),X<-V&&(p=0,S++),Y>H&&R(),Q(0,Y-9,B,B),z.fillText(S,9,B)},B=24)"><canvas id=c>
@liamstrilchuk
liamstrilchuk / sentiment.py
Created September 11, 2020 17:45
Sentiment Analyzer
import json
import nltk
nltk.download("subjectivity")
nltk.download("punkt")
nltk.download("vader_lexicon")
from nltk.classify import NaiveBayesClassifier
from nltk.corpus import subjectivity
from nltk.sentiment import SentimentAnalyzer
from nltk.sentiment.util import *
from nltk.sentiment.vader import SentimentIntensityAnalyzer