This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# A script to generate videos for MP3s | |
from moviepy.editor import * | |
import numpy as np | |
from PIL import Image | |
from glob import glob | |
from mutagen.mp3 import MP3 | |
from io import BytesIO | |
#points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = document.getElementsByTagName("a"); | |
out = ""; | |
for (var i=0;i<a.length;i++) { | |
if (a[i].hasAttribute("data-stream-url")) { | |
out = out + " '" + a[i].getAttribute("data-stream-url") + "'" | |
} | |
}; | |
prompt("urls:", out) | |
//then use that with something like wget. you'll get a bunch of long filenames. use the below script to fix the filenames |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# A tool to load a Bandcamp collection and print the urls for all included albums and tracks | |
import requests | |
import click | |
import json | |
def get_data(user): | |
data = requests.get("https://bandcamp.com/{}".format(user)).text | |
if " item_details" not in data: | |
return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
from __future__ import print_function | |
import sys | |
from glob import glob | |
from random import shuffle | |
import os.path | |
def playdir(directory): | |
def get_playlist(): | |
playlist = glob("{}/*.ogg".format(directory)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I wanted a bookmarklet to take me to the local instance of Plex running on my desktop, so Chromecast would function correctly | |
// (if I used localhost it wouldn't send the correct uri) | |
// For this I had to get the local ethernet interface IP | |
// I initiate a connection to 0.0.0.0, then use the data on the connection object to get the interface IP used for that connection | |
// May not work on the most popular web browser | |
var path = prompt("Enter uri (e.g http://{}:32400/web)"); | |
// var path = "http://{}:32400/web"; | |
var RTCPeerConnection = window.webkitRTCPeerConnection || window.mozRTCPeerConnection; | |
RTCPeerConnection && function() { | |
function c(ip) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.6 | |
import fire # pypi.python.org/pypi/fire | |
class Example: | |
def hello(self, name="world"): | |
"""Testing""" | |
return f"Hello {name}!" | |
def main(): | |
fire.Fire(Example) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from sys import stdout | |
def fib(x,y,f=stdout): | |
print(x,file=f) | |
z = x + y | |
return y,z | |
def main(): | |
n = (0,1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
c = { | |
"client_id": "", | |
"client_secret": "", | |
"refresh_token": "" # obtained after running script for first time | |
} | |
import os | |
import sys | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pypi:humblebundle has to deal with captchas. I can't be bothered. | |
import requests | |
import json | |
import subprocess | |
keys = [k["gamekey"] for k in json.loads(""" #paste contents of https://www.humblebundle.com/api/v1/user/order here | |
""") | |
# Open your browser's Network console while going to the above url, find the headers, paste them below | |
headers = {"Cookie": "", "User-Agent": ""} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def sec(s): | |
m,s = divmod(int(s), 60) | |
h,m = divmod(m,60) | |
return "%d:%02d:%02d" % (h,m,s) | |
def convert(data): | |
if isinstance(data, bytes): return data.decode('ascii') | |
if isinstance(data, dict): return dict(map(convert, data.items())) | |
if isinstance(data, tuple): return map(convert, data) |