Skip to content

Instantly share code, notes, and snippets.

View atomicptr's full-sized avatar

Christopher Kaster atomicptr

View GitHub Profile
@atomicptr
atomicptr / readable_tostring.lua
Last active September 14, 2026 16:43
Simple Lua Pretty Printer
local pp_indent_width = 2
local pp_indent_width = 2
---Indent string
---@param s string
---@param depth integer
---@return string
local function indent(s, depth)
return string.rep(" ", pp_indent_width * depth) .. s
end
@atomicptr
atomicptr / screenshota.sh
Last active April 7, 2026 16:54
A simple screenshot tool mimicking `flameshot` for Hyprland
#!/usr/bin/env bash
# _ _
# | | | |
# ___ ___ _ __ ___ ___ _ __ ___| |__ ___ | |_ __ _
# / __|/ __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __/ _` |
# \__ \ (__| | | __/ __/ | | \__ \ | | | (_) | || (_| |
# |___/\___|_| \___|\___|_| |_|___/_| |_|\___/ \__\__,_|
# Out of frustration of `flameshot` not working well with Hyprland,
@atomicptr
atomicptr / coolify-php-preview-deployments-custom-db-pre-deploy.sh
Last active November 20, 2025 13:46
Script to enable Coolify Preview Deployments to get their own database by copying the actual database into an SQLite DB (need to set ALT_DATABASE_URL)
#!/usr/bin/env bash
if [ "${PREVIEW_DEPLOYMENTS_ENABLED}" = "1" ]; then
echo "===== PREVIEW DEPLOYMENTS ENABLED"
export DATABASE_URL="sqlite:////app/var/app.db"
if [ ! -f /app/var/app.db ]; then
set -e
@atomicptr
atomicptr / defold_messages.lua
Created October 23, 2025 18:02
Defolds internal message identifiers
-- Use like this:
-- local defold = require "defold_messages"
-- msg.post(".", defold.go.acquire_input_focus)
return {
-- Built-in system messages.
exit = hash "exit",
reboot = hash "reboot",
set_update_frequency = hash "set_update_frequency",
start_record = hash "start_record",
@atomicptr
atomicptr / luaxer.clj
Created July 30, 2025 19:26
A Lua lexer in Clojure written for fun
(ns luaxer.core
(:require
[cheshire.core :as json]
[clojure.string :as string]))
(defn- lexer-error [message pos]
(throw (ex-info (str "Lexer Error: " message) {:position pos})))
(defn- lexer [source]
(let [source (string/trim source)
@atomicptr
atomicptr / neovim-server.sh
Last active July 15, 2025 09:37
Bash script that enables seamless reuse of a single Neovim instance for external applications like Defold/Godot/etc. It automatically opens files (with optional line numbers) in an existing Neovim server, launching a new one if none is found, and focuses the corresponding window.
#!/usr/bin/env bash
if [[ "$#" -ne 2 && "$#" -ne 3 ]]; then
echo "Usage: $0 <class> <file> [line]"
echo " <class>: The window class for ghostty/Neovim"
echo " <file>: The file to open"
echo " [line]: Optional. The line number to open the file at"
exit 1
fi
@atomicptr
atomicptr / judo2json.js
Last active September 3, 2024 13:04
(Web scraping) Japanese Judo techniques to JSON
import * as cheerio from "cheerio";
const url = "https://kdkjudo.org/%E6%8A%80/%E6%9F%94%E9%81%93-%E6%8A%80%E5%90%8D%E7%A7%B0%E4%B8%80%E8%A6%A7/";
const main = async () => {
const resp = await fetch(url);
const html = await resp.text();
const $ = cheerio.load(html);
@atomicptr
atomicptr / pixel_camera.odin
Last active April 8, 2024 16:51
Simple pixel camera for Odin and Raylib
package camera
import "core:fmt"
import "core:math"
import rl "vendor:raylib"
PixelCamera :: struct {
screen_width: i32,
screen_height: i32,
virtual_screen_width: i32,
@atomicptr
atomicptr / errors.lua
Last active December 20, 2023 04:42
Implementation of Go-like errors in Lua 5.1+
--[[
Go-like errors for Lua
Copyright (c) 2023 Christopher Kaster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@atomicptr
atomicptr / filler-delete.py
Last active November 23, 2022 08:34
Filler Delete Script
#!/usr/bin/env python3
# Currently this is used for Detective Conan if you want to use this for another show just edit the "fillers"
# variable below
import re
import os
import sys
# copied from https://www.animefillerlist.com/shows/detective-conan