Skip to content

Instantly share code, notes, and snippets.

View kylemsguy's full-sized avatar

Kyle Zhou kylemsguy

  • SF Bay Area
View GitHub Profile
@kylemsguy
kylemsguy / pebble-js-app.js
Created January 11, 2024 06:16
Modern Pebble Watch Face OpenWeather API fix
var weathersleep = false;
var ready = false;
var settings;
var manuallongitude;
var manuallatitude;
var manuallocation;
var fetchtime = 60;
var apikey = "{API_KEY_HERE}";
function iconFromWeatherId(weatherId) {
@kylemsguy
kylemsguy / strip1.sh
Created May 23, 2023 20:13
Recursively strip 1 from converted iTunes music files
for i in *
do
cd $i
for j in *.m4a
do
mv "$j" ${j%" 1.m4a"}.m4a
done
cd ..
done
@kylemsguy
kylemsguy / dl-livechat.sh
Last active May 5, 2023 21:44
YouTube channel (including livestream) archival scripts (and also Twitter for good measure)
#!/bin/bash
# NOTE: this is a very quick and dirty script. It saves the files as the <video id>.json
# You will need to map this back to the actual video if you want sane filenames
# TODO: merge this back to the main script and make sure the script can be run to make a partial download...
channel="Rosemi_Lovelock"
stream_list_ids="streams.txt"
# Enable this if you did not previously download the streams with the --download-archive flag set
@kylemsguy
kylemsguy / get_prime.py
Last active November 19, 2020 20:51
Comparision of various prime-finding functions
import time
import math
def prime_number(pnum):
primes = [2]
number = 1
while len(primes) < pnum:
is_prime = True
number += 2
@kylemsguy
kylemsguy / msnlog.py
Last active January 23, 2020 09:20 — forked from dwf/msnlog.py
A script that dumps convoluted XML log files from MSN Messenger to readable plaintext.
"""
Simple script I whipped up to dump MSN Messenger logs in XML to a readable
plaintext format. It's not very robust, nor am I sure which versions of MSN
Messenger it's compatible or incompatible with; I just had a specific
conversation I wanted to read, and this was the vehicle to that end.
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf)
Updated for Python 3.6 by Kyle Zhou (also former CS student at UofT)
@kylemsguy
kylemsguy / mpu_calc.py
Last active August 2, 2019 19:15
Main Power Up calculator Python script
import argparse
import json
import math
def calc_dmg(A, base_dmg, high, mid):
_min = 1.0
B = (3.3 * A - 0.027 * A**2) / 100
C = (mid - _min) / (high - _min)
D = _min + (high - _min) * lerpN(B, C)
@kylemsguy
kylemsguy / blah.cpp
Last active September 28, 2018 21:15
Vector of Vectors test
#include <cstdio>
#include <vector>
using namespace std;
class Blah {
private:
int a;
public:
Blah(int a){
this->a = a;
@kylemsguy
kylemsguy / get_place_in_line.py
Last active July 1, 2020 07:22
Get useful Indiegogo backer data and save it as a json
import json
if __name__ == "__main__":
name = input("Enter your Indiegogo Pledge display name: ")
with open('backer_data.json') as infile:
data = json.load(infile)
backers = data['backers']
for i in range(len(backers)):
if backers[i]['pledger_display_name'] == name:
print(len(backers) - i)
@kylemsguy
kylemsguy / hide_quora_nag.js
Created June 16, 2017 02:20
Hide the Quora login nag screen
// Simply copy the following line into the dev console while on the page with the nag screen.
// Alternatively, paste it into a bookmarklet.
document.getElementsByClassName("modal_signup_background")[0].parentNode.style.display = "none";document.getElementsByTagName("body")[0].style.overflow = "auto";
@kylemsguy
kylemsguy / billproblem.py
Last active October 2, 2015 07:24
Bill problem inspired by MinutePhysics (https://www.youtube.com/watch?v=eivGlBKlK6M)
## Inspired by an episode of MinutePhysics
# You can find a link to the original video here: https://www.youtube.com/watch?v=eivGlBKlK6M
# The algorithm used here is from https://www.youtube.com/watch?v=C5-I0bAuEUE
# but you should really watch the first one first
import sys
from random import shuffle
class Box:
def __init__(self, bill):
self.bill = bill