Skip to content

Instantly share code, notes, and snippets.

View spyoungtech's full-sized avatar

Spencer Phillip Young spyoungtech

View GitHub Profile
@spyoungtech
spyoungtech / generate.py
Last active May 26, 2020 04:59
generate json
# Make sure to pip install json-five
from functools import singledispatch, update_wrapper
from json5.model import *
from json5.dumper import ModelDumper
import json5
import random
import string
VALUE_MODELS = [Integer, JSONObject, JSONArray, DoubleQuotedString, SingleQuotedString, Float, NullLiteral,
BooleanLiteral, Infinity, NaN, UnaryOp]
@spyoungtech
spyoungtech / upgradewsl.ps1
Last active June 1, 2020 11:19
Upgrade all WSL distros to version 2
$oldversion = "1"
$newversion = "2"
$output = wsl -l -v
$distros = $output -replace "`0",'' | ConvertFrom-String -PropertyNames Active,Name,State,Version | where {$_.Version -ne "VERSION"}
$outdated = $distros | where {$_.Version -like $oldversion}
$outdated | ForEach-Object {wsl --set-version $_.Name $newversion}
@spyoungtech
spyoungtech / 1.README.md
Last active June 26, 2022 12:08
Adaptive sound - Keyboard Inputs from audio pitch

How to use

(Windows only)

  1. Download the files from this gist
  2. Install Python (using default options is OK)
  3. In command prompt, type py -m pip install --prefer-binary -r C:\path\to\requirements.txt (replacing the actual path to the requirements.txt file you downloaded from this gist)
  4. In the command prompt, type py C:\path\to\adaptivesound.py -- in 5 seconds recording will start
  5. Open the window you want to send input to
@spyoungtech
spyoungtech / unasync-rewrite.py
Last active July 13, 2022 02:08
unasync rewriter
"""
remove code from unasync-generated code wherever there is a `unasync: remove` comment is placed
MIT License
Copyright (c) 2022 Spencer Phillip Young
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@spyoungtech
spyoungtech / 0.example.py
Last active October 3, 2022 16:48
Parse docker repo info
from parse_repo import parse
with open('6.0.5.md') as f:
text = f.read()
images = parse(text)
for image in images:
print('Image Digest:', image.digest)
print('Layers:')
for layer in image.layers:
print('\t', "Digest:", layer.digest)
print('\t', "Size:", layer.size)
@spyoungtech
spyoungtech / download_emotes.py
Last active October 23, 2022 12:56
Download twitch emotes from twitchemotes.com channel
import os
from requests import Session
from bs4 import BeautifulSoup
requests = Session()
class EmoteNotFoundError(RuntimeError):
...
from selenium.webdriver.common.keys import Keys
import time
from browsermobproxy import Server
import ast
import urllib2 as UR
import os
import eyed3 as ED3
from django.utils.encoding import force_text
import re
from selenium import webdriver