Skip to content

Instantly share code, notes, and snippets.

@Rayquaza01
Rayquaza01 / pretty_printh.lua
Created October 16, 2024 14:33
Picotron Pretty Printh
function pretty_printh(s)
s = s
:gsub("%[fg=(#?%w+)]", function (c)
if c:find("^%d+$") then
return string.format("\27[38;5;%sm", c)
end
if c:find("^#[%da-fA-F][%da-fA-F][%da-fA-F][%da-fA-F][%da-fA-F][%da-fA-F]$") then
return string.format(
"\27[38;2;%d;%d;%dm",
@Rayquaza01
Rayquaza01 / balloon-run.lua
Created September 30, 2024 17:18
balloon-run
function move_towards(x, y)
if abs(x - y) < s then
return y
elseif x > y then
return x - s
elseif x < y then
return x + s
end
end
#!/bin/bash
# if inside a tmux session, don't do anything
if [ -z "$TMUX" ]; then
# get the session name of the first session that isn't attached
FREE_SESSION=$(tmux ls 2>/dev/null | grep -v "(attached)$" | cut -f1 -d: | head -n 1)
# if no free sessions, make a new one
# otherwise attach to it
if [ -z "$FREE_SESSION" ]; then
tmux new && exit
else
@Rayquaza01
Rayquaza01 / json.lua
Created March 18, 2024 02:20 — forked from tylerneylon/json.lua
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@Rayquaza01
Rayquaza01 / picotron-mastodon-proxy.py
Created March 15, 2024 05:27
Picotron Mastodon Proof of Concept
#!/usr/bin/env python3
from textwrap import wrap
import requests
from markdownify import markdownify
from flask import Flask, request
app = Flask(__name__)
@app.route("/statuses")
@Rayquaza01
Rayquaza01 / dvd.p64
Created March 14, 2024 23:45
Picotron DVD Screensaver
picotron cartridge // www.picotron.net
version 2
:: gfx/
:: gfx/0.gfx
b64$LS1bW3BvZCxjcmVhdGVkPSIyMDI0LTAzLTE0IDIyOjM4OjMyIixtb2RpZmllZD0iMjAyNC0w
My0xNCAyMzozMzozMCIscmV2aXNpb249MTYzXV1sejQAWQIAAHIzAADzFHtbMF09e2JtcD1weHUA
QyAQEATw8CxmbGFncz0wLHBhbl94CADPeT0wLHpvb209OH0sMQAs3-8cIP8OIPcw-iD-HCBtAB1g
ABcQB0AHBgBgAAcQByAHCAARAAYAAAwANBAXEAwAEBcGAAIEAP8KABdABzAX8AZ3QNcAR1CHcIdQ
9wUA10B3MH0AHlAYEAhACAYAYAAIEAggCAgAEQAGAAAMADQQGBAMABAYBgACBAD-CQAYQAgwGPAG
@Rayquaza01
Rayquaza01 / wallpaper-shuffle.sh
Created November 19, 2023 18:59
Wallpaper Shuffle
#!/bin/bash
WALLPAPER_PATH=$HOME/Pictures/Wallpapers/Shuffle
WALLPAPER=$(find "$WALLPAPER_PATH" -type f -name "*.jpg" -o -name "*.png" | shuf -n 1)
gsettings set org.gnome.desktop.background picture-uri "file://$WALLPAPER"
@Rayquaza01
Rayquaza01 / old-reddit-redirect.user.js
Last active August 27, 2023 15:09
Old Reddit Redirect
// ==UserScript==
// @name Old Reddit Redirect
// @namespace Violentmonkey Scripts
// @match https://www.reddit.com/*
// @grant none
// @version 1.0
// @author Arnaught
// @description 8/27/2023, 11:06:35 AM
// ==/UserScript==
location.href = location.href.replace("www", "old");
@Rayquaza01
Rayquaza01 / neocities-clean.sh
Created July 16, 2023 21:43
Compares the files from neocities and the files on your local jekyll site, and deletes the residual files from neocities.
#!/bin/bash
# get all files on remote site, remove coloring, and sort
NEOCITIES_FILES=$(neocities list -a | ansi2txt | sort)
# echo "$NEOCITIES_FILES"
# get all files from local site, remove _site/ prefix, remove / suffix, remove blank lines, and sort
LOCAL_FILES=$(find _site/ | sed -e 's/^_site\///' -e 's/\/$//' -e '/^$/d' | sort)
# echo "$LOCAL_FILES"
# compare two lists
// ==UserScript==
// @name Kbin Instance Display
// @namespace Violentmonkey Scripts
// @match https://kbin.social/*
// @grant none
// @version 1.0
// @author Arnaught
// @description Displays instance name next to users on remote instances
// ==/UserScript==
[...document.querySelectorAll(".user-inline")].forEach(item => {