Skip to content

Instantly share code, notes, and snippets.

@Rayquaza01
Rayquaza01 / extload.lua
Created January 11, 2025 23:01
Picotron External Loader
--[[
extload
load an external folder
]]
cd(env().path)
local argv = env().argv
if (#argv < 1) then
print("\f6usage: load filename -- can be file or directory")
@Rayquaza01
Rayquaza01 / ini.lua
Last active September 23, 2025 00:31
Picotron INI Parser
--- Loads an ini string into a lua table
--- @param ini_text string
--- @return table
function load_ini(ini_text)
local tbl = {}
local lines = split(ini_text, "\n", false)
local current_head = tbl
local header = ""
@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 November 27, 2024 16:33
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");