Skip to content

Instantly share code, notes, and snippets.

View kylemsguy's full-sized avatar

Kyle Zhou kylemsguy

  • Seattle
View GitHub Profile
@kylemsguy
kylemsguy / printchat.py
Last active April 10, 2025 04:08
A quick script to render live chat json's downloaded from YT-DLP
import json
def render_chat(chats):
chat_rendered = []
for chat in chats:
item = chat['replayChatItemAction']['actions'][0]
if 'addChatItemAction' not in item:
continue
item = item['addChatItemAction']['item']
if 'liveChatTextMessageRenderer' in item:
@kylemsguy
kylemsguy / PRIFACTR.8xp
Last active April 25, 2024 10:56
[PRIFACTR.8xg] Prime factorization program for TI-83+/84+
Input "NUM:",M
If fPart(M
Then
Disp "ERR: NUM IS NOT INT"
Stop
End
0->C
2->T
M->I
@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 / 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)