Skip to content

Instantly share code, notes, and snippets.

@weeble
weeble / flatten_thread.jq
Created December 28, 2024 12:49
JQ script to flatten an atproto thread returned from bsky CLI
# Usage:
# bsky thread --json -n 300 'at://...' | jq --stream -n -f flatten_thread.jq
def rewrite_path:
# Take a path like ["parent", "parent", "parent", "$type"]
# and replace a prefix of 0 or more "parent" items with
# an integer which is the length of that prefix, e.g. giving
# [3, "$type"]
(
(
@weeble
weeble / extra-cursed-ghe-version.css
Last active October 24, 2024 14:42
Make hidden diffs more alarming on github.com
/* Highlight collapsed files */
div :has(> div[class^="HiddenDiffPatch-"]), .js-diff-entry-loader {
--hack-file-colors-bg: var(--bgColor-default, var(--color-canvas-default, rgb(0 0 0)));
--hack-file-colors-addition: var(--diffBlob-addition-bgColor-line, var(--color-diff-blob-addition-line-bg, rgb(27 71 33 / 0.3)));
--hack-file-colors-deletion: var(--diffBlob-deletion-bgColor-line, var(--color-diff-blob-deletion-line-bg, rgb(104 45 15 / 0.3)));
background: linear-gradient(90deg, var(--hack-file-colors-bg), rgb(from var(--hack-file-colors-bg) r g b / 0) 500px),
repeating-linear-gradient(
45deg,
var(--hack-file-colors-addition),
var(--hack-file-colors-addition) 20px,
@weeble
weeble / readme.txt
Last active November 20, 2023 01:53
Void Stranger Mini (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@weeble
weeble / keybase.md
Created June 20, 2023 09:37
Keybase proof of identity

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@weeble
weeble / toplevel.sh
Created February 3, 2022 14:38
Short shell script to run a command at the top level directory of a git repo
#!/bin/sh
if toplevel="$(git rev-parse --show-toplevel)"
then
if cd "$toplevel"
then
exec "$@"
fi
fi
@weeble
weeble / p5js_shifting_sand_land_cubes.js
Created December 28, 2021 17:28
I took an elegant and compact animation by akira2768922 and crudely stuck Mario 64 textures on it
// Based on https://twitter.com/akira2768922/status/1475077131151769613
t=0
let sad,happy,angry,inside
preload=_=>{sad=loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAABACAYAAAB7jnWuAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5QwcERkTVzgENgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAf/SURBVGjexZkvdxs7GsZ/zTUQCBAoEAgQKBAoECgYsGBAgcEFgQv2A/QjXFhYsKCwYMGFAQUBCwIuGLBgQIFAgUCAgIGAwQsMBHxOFmhmMnbt2DG5OsfHk/Ej6dX793mVN1bzxN84rvibx+I1YHUmrlyigS/f7rC+/QUwvj+0+edvd5gDc9QZ643jN634DPC4WiMiFMk7E8b32733Cvh55DeAeGK98f2bl5xQXWCC8kqTXF2yuZp9Ds17jeBXl2yujcEY+7yhUic3VZeGoTrw7JzDeY/WevajusiEi3M2nA/vG5rlLcZYimRC36OUogz4UsplYXhqaKXwTUuzXNK0LUopjHUAtMtbnPNY59Bav3gI9ZIAx+yklMJ5j/N1E1CUUpAhlKy1fPn6haZtcd5jjEVrPZlIvTYTqlnoaK0HmzdYa1FKkUJPDIEUYg0zEXLKLJe3KKXQxiBSKEUQESQLMjzvrz/lgbmURmuMsVjnMMbsnAYgxUjsO1KsAljncU2DsXWOAmJKVTARck7klIgxUkrZyQ2/aEBrjfMN7XKJ1galFUhVt+RMSpEUAjmlmUBhZ76xDjeYSkrVQOg7RIQ0m3c0CowxWOfxTYPkTAw9OSVSCKQYKIMq56MKUaAUSikYa/Htc84XycQYgQMCzNVfnUuAQpFqtxTrqWPoYVChOpBqU4yklLChx7V
print([f"Hello, {first_name} {last_name[0]}. Dork." for first_name, last_name in [[next(x for x in (input(prompt) for _ in iter(object, None)) if x) for prompt in ["First Name: ", "Last Name: "]]]][0])
@weeble
weeble / drone_logo_wide.svg
Last active October 5, 2018 16:38
Drone logo redrawn to be symmetrical but keeping the bottom slightly elliptical.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@weeble
weeble / drone_logo_circles.svg
Last active October 5, 2018 16:19
Drone logo redrawn to be symmetrical using pure circles.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@weeble
weeble / gemdrop.py
Last active August 29, 2015 14:05
Bit-twiddling example of gem-drop logic
import numpy as np
def index_of_highest_bit(x):
p = 1
i = 0
while p<x:
p <<= 1
i += 1
return i