Skip to content

Instantly share code, notes, and snippets.

View Archenoth's full-sized avatar
💕
Arrested for Oshawott crimes

Arch Archenoth

💕
Arrested for Oshawott crimes
View GitHub Profile

Advent Of Code 2023

(require '[clojure.string :as str]
         '[clojure.core.match :refer [match]]
         '[clojure.edn :as edn])

Day 1: Trebuchet?!

@Archenoth
Archenoth / mg
Last active September 21, 2023 18:47
(kinda-but-not-actually) microemacs -- a script for emacs28+ that runs a speedy configless terminal version of emacs with some edges filed off~
#!/bin/bash
EL=`cat <<EL
(load-theme 'modus-vivendi)
(setq initial-scratch-message nil)
;; Squelch the creation of .#<filename> files
(setq create-lockfiles nil)
;; Emacs auto-backups feel nicer when they collect in my ~/.emacs.d/backups

Advent Of Code 2022

(require '[clojure.string :as str]
         '[clojure.core.match :refer [match]]
         '[clojure.edn :as edn])

Day 1: Calorie Counting

Advent of Code 2021

(require '[clojure.string :as str])

— Day 1: Sonar Sweep —

You’re minding your own business on a ship at sea when the overboard alarm goes off! You rush to see if you can help. Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean!

(fn assert-tail [tail-sym body]
"Asserts that the passed in tail-sym function is a tail-call position of the
passed-in body.
Throws an error if it is in a position to be returned or if the function is
situated to be called from a position other than the tail of the passed-in
body."
(fn last-arg? [form i]
(= (- (length form) 1) i))
@Archenoth
Archenoth / adom.properites
Created May 29, 2020 05:00
An Termux keyboard layout for playing ADOM if you have muscle memory for https://gist.github.com/Archenoth/0ef3a2eddb1ddebbcadc46aafc500984
extra-keys = [ \
['Z', '7', 'UP', '9', '\\\''], \
['TAB', 'LEFT', '5', 'RIGHT', '*'], \
['=', '1', 'DOWN', '3', 'ENTER'] \
]
@Archenoth
Archenoth / syscall-intercept.c
Created May 29, 2020 04:47
An aarch64 ptrace-based system call intercepter for the Raspberry Pi version of ADOM, allowing you to run it in Termux on Android without it getting SECCOMP killed by the kernel
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm-generic/unistd.h>
#include <sys/procfs.h>
#include <sys/ptrace.h>
#include <sys/types.h>
@Archenoth
Archenoth / keymap
Created March 3, 2020 17:41
A Termux keymap switcher
#!/bin/sh
KEYMAP=$1
if [ -z "$KEYMAP" ]; then
KEYMAP=default
fi
if [ -f "$HOME/.termux/keymaps/$KEYMAP.properties" ]; then
echo "Setting keymap: $KEYMAP"
@Archenoth
Archenoth / termux.properties
Created February 4, 2020 20:27
Extra keys setup for playing Roguelikes in Termux
extra-keys = [ \
['ESC', '7', 'UP', '9', '\\\''], \
['TAB', 'LEFT', '5', 'RIGHT', '*'], \
['=', '1', 'DOWN', '3', 'ENTER'] \
]
@Archenoth
Archenoth / service
Last active April 19, 2024 01:22
Termux service management script, because convenience, and also because I wanna have fewer runit watchers running all the time
#!/bin/sh
# This script 100% requires termux-services to be installed
if ! dpkg -L termux-services 2>&1 >/dev/null; then
echo "Requires termux-services package to be installed." >&2
read -r -p "Would you like me to install that now? (y/n) " INSTALL >&2
if [ "$INSTALL" != "y" ]; then
echo "Aborting..." >&2
exit 1