Skip to content

Instantly share code, notes, and snippets.

@impiaaa
impiaaa / error.c
Created October 22, 2023 16:46
PS1 Crash Handler
/**
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@impiaaa
impiaaa / isin.c
Last active October 23, 2023 14:54
4th-order polynomial cosine approximation
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
// 4th-order polynomial cosine approximation
// Derived from
// http://web.archive.org/web/20210224233553/https://www.coranac.com/2009/07/sines/
// Changes:
// - constants split out into variables
// - 32-bits-per-turn angles as input
@impiaaa
impiaaa / watchfile.py
Last active October 23, 2023 14:58
Highlight file changes as they happen
import curses, sys, difflib
import time, os.path
import watchdog.events, watchdog.observers
class Handler(watchdog.events.FileSystemEventHandler):
def __init__(self, path):
self.path = os.path.abspath(path)
self.matcher = difflib.SequenceMatcher(isjunk=lambda s: s.isspace())
self.contents = None
self.first = True
@impiaaa
impiaaa / stack3ssa.py
Last active October 23, 2023 15:03
Demonstrating conversion from Python to LLVM IR
import dis, inspect, typing
import math, sys
import os
from llvmlite import ir
#def putchar(n: int) -> int: pass
def fact(n: int) -> int:
if n <= 1: return 1
else: return n*fact(n-1)
@impiaaa
impiaaa / psxlib.py
Last active October 23, 2023 15:04
Convert PSYQ .OBJ and .LIB to ELF and .a
import os, os.path
import struct, array, sys, io
def readstring(f):
return f.read(f.read(1)[0])
class SectionType:
NULL = 0
PROGBITS = 1
SYMTAB = 2
@impiaaa
impiaaa / extrahashtags.py
Last active October 23, 2023 15:01
Multi-instance Mastodon hashtag search
#!/usr/bin/env python3
# -- CONFIGURATION --
# Your home instance
myinstance = "octodon.social"
# Create an "application" in the "development" section in account settings, if
# you haven't already. Paste the client key, client secret, and access token
# here.
import dis, inspect, typing
import math, sys
from operator import or_
from functools import reduce
#def putchar(n: int) -> int: pass
def fact(n: int) -> int:
if n <= 1: return 1
else: return n*fact(n-1)
@impiaaa
impiaaa / aprilwords.txt
Last active October 23, 2023 15:06
April 1 word list for @domainhacker@botsin.space
# https://github.com/dariusk/corpora/blob/master/data/words/strange_words.json
cubersome
dingleberry
doodlesack
expat
flabergasted
floccinaucinihilipilification
jentacular
kardashian
macrosmatic
@impiaaa
impiaaa / fla2.py
Last active October 23, 2023 15:06
FLA to SVG converter
from xml.dom import minidom
import sys
from xml.sax.saxutils import quoteattr, escape
import math, numpy
class Scanner:
def __init__(self, data):
self.data = data
self.pos = 0
@impiaaa
impiaaa / findadmins.py
Last active January 11, 2019 18:57
Mastodon tools
#!/usr/bin/env python3
from mastodon import Mastodon
from bs4 import BeautifulSoup
import urllib
myinstance = "somewhere.social"
m = Mastodon(client_id="…", client_secret="…", access_token="…", api_base_url="https://"+myinstance)
myid = m.account_verify_credentials()['id']
admins = {}