This file contains 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 | |
# pip install scrapetube | |
# for basic operation, use `python -m http.server --cgi` | |
# and access /cgi-bin/yt.py?c={CHANNEL_ID} | |
# Note that due to scrapetube limits, dates are fetched as eg "3 days ago" | |
# so the further in the past a video is, the less precise the date will be. |
This file contains 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
""" | |
Tool to calculate the average additional CO2e emissions | |
from the instruction "boil half a kettle", | |
rather than some slightly more precise figure ("boil 200ml"). | |
Naturally, not everyone will follow this -- we're all busy people -- | |
so we will have to assume not all of these wasted emissions | |
can be reduced. | |
This is targetted at a recipe-delivery service company; |
This file contains 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 | |
"Image that dynamically tells you your user agent" | |
# save this as ./cgi-bin/index.png | |
# run python -m http.server --cgi | |
# go to http://localhost:8000/cgi-bin/hi.png | |
import os, sys | |
from PIL import Image, ImageDraw | |
def serve_png(io, file=sys.stdout): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
/* "NEW" merch */ | |
header>div>div:has(button[aria-label="Shop TumblrMart"]), | |
/* Tumbly live I shoot you like the gun */ | |
div[data-timeline]>div>div:has(div[data-testid=liveMarquee]), | |
div:has(>a>button[aria-label='Live']), | |
#q{display: none} |
This file contains 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 | |
# I hope the example input is fairly obvious | |
# but this is a quick tool to randomly pick emoji from a palette | |
# and apply it onto a grid. | |
# Input Discord-markdown in the format of example.txt to stdin. | |
# Add `spoilers` to argv if you wish to make a cute find-the-emoji puzzle! |
This file contains 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
''' | |
Python 3.x minor version usage stats, by proxy of PyPI downloads. | |
Placed into public domain by Mia yun Ruse. | |
(I wouldn't recommend using it though. It's a tad hacky.) | |
''' | |
from datetime import date as Date, timedelta | |
from requests import get | |
from json import loads |
This file contains 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
''' | |
Small tool that generates a phonetic password with a schema | |
identical to that used in iCloud's password generators. | |
Pronouncable-ish with 20 characters and ~70 bits of entropy. | |
Useful for password managers or sysadmins. | |
''' | |
# Example password from schema: fivhAp-riznux-0mizhi | |
# Let V be the set of all lowercase vowels "aiueoy". | |
# Let C be the set of all lowercase consonants in the Latin (English) alphabet. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 os import fstat | |
from stat import S_ISREG | |
def is_redirected() -> bool: | |
'''Detect if program is being redirected (i.e. using the > or >> operator).''' | |
return S_ISREG(fstat(1).st_mode) | |
if __name__ == '__main__': | |
if is_redirected(): | |
print('Hi file!') |
NewerOlder