Skip to content

Instantly share code, notes, and snippets.

@boppreh
boppreh / Programming Language Checklist 2024.txt
Last active May 2, 2024 16:15
Updated version of the tongue-in-cheek Programming Language Checklist
Programming Language Checklist
by Colin McMillen, Jason Reed, and Elly Fong-Jones, 2011-10-10
updated by BoppreH, 2024-01-24
You appear to be advocating a new:
[ ] functional [ ] imperative [ ] object-oriented [ ] stack-based [ ] concurrent
[ ] interpreted [ ] compiled [ ] JIT [ ] cloud [ ] AI [ ] beginner-friendly
[ ] academic-friendly [ ] visual [ ] sharable [ ] esoteric
[ ] memory safe [ ] memory unsafe [ ] provable [ ] Turing-incomplete
[ ] statically-typed [ ] dynamically-typed [ ] completely incomprehensible
const 𝗫 = 1;
const 𝖷 = 0;
x = list => list.length
Array.prototype.ꭓ = Array.prototype.reduce
Array.prototype.ჯ = Array.prototype.slice
Array.prototype.X = Array.prototype.push
𝚇 = (𝕏) => {
𝚾 = []
@boppreh
boppreh / stack_fanatic.py
Last active July 5, 2023 14:37
Visit every StackExchange site
"""
Login and visit each stackexchange site. Schedule it daily to win the Fanatic Badge after 100 days.
"""
# Create account.py module with 'email', 'password', and 'stackexchange_user_id'.
import account
import requests
import re
session = requests.Session()
@boppreh
boppreh / time_rotation.py
Last active May 5, 2023 17:52
Creates two GIFs, where the second one swaps the Y and time axis.
import sys
from PIL import Image, ImageDraw
if len(sys.argv) > 1:
gif_path, = sys.argv[1:]
im = Image.open(gif_path)
width, before_height = im.size
images_before = [im.copy()]
while im.tell() < im.n_frames-1:
im.seek(im.tell()+1)
@boppreh
boppreh / proxy.py
Created April 1, 2023 22:52
Proxy class to track modifications in a Python object and its children
class Proxy:
"""
Wraps an object to keep track of modifications, including to its children.
"""
def __init__(self, obj, modified_flag=None):
# Must use `super().__setattr__` to avoid recursing on itself.
super().__setattr__('_obj', obj)
super().__setattr__('_modified_flag', modified_flag or [False])
@property
@boppreh
boppreh / grep_and_sort.py
Last active February 9, 2023 10:46
Python implementation of `grep 'lasagna' beef.txt | sort -n`
# Python implementation of
# $ grep 'lasagna' beef.txt | sort -n | uniq
import re
lines = list(set(line for line in open('beef.txt') if 'lasagna' in line))
lines.sort(key=lambda line: int(re.match('\d*', line)[0] or 0))
for line in lines: print(line, end='')
@boppreh
boppreh / balloontip.py
Created November 2, 2012 11:35 — forked from wontoncc/balloontip.py
Balloon tip module, Python, using win32gui. Display a notification in the tray bar and quits after 10 seconds.
# -- coding: utf-8 --
from win32api import *
from win32gui import *
import win32con
import sys, os
import struct
import time
class WindowsBalloonTip:
@boppreh
boppreh / grey_goo.ash
Last active June 13, 2022 07:58
Kingdom of Loathing - 3-day auto-ascend and reincarnation with Grey Goo path, no requirements
# Runs Grey Goo ascensions with no input required. Just run this script once a day and it'll do some basic farming (11-leaf clovers, eating fortune cookies, etc) and reincarnate in the same path when possible.
void do_jobs() {
# Spend time doing Jobs Boards adventures. Not very rewarding, but
# levels us up enough to cast daily skills and gives some pocket change.
if (my_adventures() >= 10) {
visit_url("place.php?whichplace=town&action=town_oddjobs");
while (my_adventures() >= 10) {
run_choice(985, "pwd&option=3");
}
@boppreh
boppreh / userContent.css
Created May 17, 2022 19:49
Give a grey title to visited Youtube links based on browser history, without enabling watch history
# Save to C:\Users\{USER}\AppData\Roaming\Mozilla\Firefox\Profiles\{PROFILE_NAME}\chrome\userContent.css
# And enable "toolkit.legacyUserProfileCustomizations.stylesheets" on about:config
@-moz-document domain(www.youtube.com)
{
a:visited {
color: grey !important;
}
}
@boppreh
boppreh / keyboard.js
Created May 4, 2015 21:47
Allow keyboard control in agar.io
var oldOnKeyDown = window.onkeydown
var canvas = document.getElementById('canvas');
var oldMouseMove = canvas.onmousemove
canvas.onmousemove = null;
var pressedKeys = {}
window.onkeydown = function (f) {
pressedKeys[f.keyCode] = 1;
oldOnKeyDown(f);
updateKey();