Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar
🦀
Rewriting RGBDS... In Rust!

Eldred Habert ISSOtm

🦀
Rewriting RGBDS... In Rust!
View GitHub Profile
@ISSOtm
ISSOtm / configure.sh
Created February 8, 2023 10:01
Fragment of a `./configure.sh` I wrote that generates a `build.ninja`
View configure.sh
#!/bin/bash
# shellcheck disable=SC2016 # Dollar signs in single quotes are destined to Ninja, not Bash.
# Safety belt, even if not perfect. Combined with Shellcheck, we should be okay.
set -euo pipefail
cd "$(dirname "$0")" # Go to the script's directory.
BUILD_DIR="build"
CFLAGS="-D_GNU_SOURCE -pthread $(pkg-config --cflags sdl2)"
@ISSOtm
ISSOtm / shell.session
Created November 5, 2022 21:03
Macro definition polyfill for RGBDS 0.4.2+
View shell.session
issotm@sheik-kitty ~% rgbasm - -Dm1=MACRO -Dm2= <<EOF
m1 duck{m2}
PRINTLN "Quack!"
ENDM
duck
EOF
Quack!
issotm@sheik-kitty ~% rgbasm - -Dm1= -Dm2=:MACRO <<EOF
m1 duck{m2}
View discord_arch_electron.patch
diff --git a/PKGBUILD b/PKGBUILD
index fe012c2..f43190d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,10 +18,12 @@ optdepends=('libpulse: Pulseaudio support'
'xdg-utils: Open files')
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
'discord-launcher.sh'
+ 'https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar'
'LICENSE.html::https://discordapp.com/terms'
@ISSOtm
ISSOtm / firefox
Created September 20, 2022 19:45
Wrapper to make Firefox respect the current theme (e.g. under i3 or Wayland)
View firefox
#!/bin/bash
# Start Firefox, enforcing the global theme
export GTK_THEME="${GTK_THEME:-"$(xfconf-query -c xsettings -p /Net/ThemeName)"}"
if [[ "$XDG_SESSION_TYPE" = wayland ]]; then
export MOZ_ENABLE_WAYLAND=1
fi
exec "$(type -a "$(basename "$0")" | grep -Fv "$(realpath "$0")" | head -n 1 | cut -d ' ' -f 3)" "$@"
@ISSOtm
ISSOtm / PKGBUILD
Last active January 8, 2022 02:08
Overhauled PKGBUILD for aseprite-git
View PKGBUILD
# Maintainer: Justin Wong <jusw85 at hotmail dot com>
# Contributor: Eldred Habert <me@eldred.fr>
# Contributor: Benoit Favre <benoit.favre@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>
# Discussion: https://bbs.archlinux.org/viewtopic.php?pid=1853334#p1853334
pkgname=aseprite-git
pkgver=1.3.beta7.r63.g8ec2fff44
@ISSOtm
ISSOtm / map_to_sym.awk
Created September 25, 2021 13:23
Awk script for generating a Game Boy SYM file from a RGBDS map file
View map_to_sym.awk
#!/usr/bin/awk -f
/^[^ \t]+[ \t]bank #([0-9]+):$/ {
bank = substr($3, 2)
sub(/:/, "", bank)
}
/^[ \t]*\$[0-9A-Fa-f]{4}[ \t]+=[ \t]+/ {
printf "%02x:%s %s\n", bank, substr($1, 2), $3
}
@ISSOtm
ISSOtm / maze.py
Created September 5, 2021 16:08
"Clever" assembly for NANDGame maze escape mission (not really Python, just for approximate syntax highlighting)
View maze.py
# Start of main loop
loop:
# Wait until everything is settled before doing anything
A = 0x600
D = A
wait_init:
A = 0x7FFF
# D has its bits get progressively cleared as exit conditions become true
# (since we're not instructing the robot to move, it won't suddenly start doing so)
@ISSOtm
ISSOtm / metasprite_defs.asm
Created July 29, 2021 23:21
Metasprite animation definition
View metasprite_defs.asm
MACRO nb_cels
REDEF NB_CELS equs "_NB_CELS\@"
db {NB_CELS}
DEF {NB_CELS} = 0
ENDM
MACRO cel
db (\1) ; Amount of frames to display this cel during
REDEF {NB_CELS} = {NB_CELS} + (\1)
dw (\2) ; Ptr to cel
ENDM
@ISSOtm
ISSOtm / u256.rs
Created May 24, 2021 14:33
Short, very incomplete implementation of u256 to showcase the use of `u128::overflowing_add`
View u256.rs
use std::fmt::{self, Display, Formatter};
use std::ops::Add;
#[derive(Debug, Clone)]
struct u256 {
lo: u128,
hi: u128,
}
impl Add<u256> for u256 {
@ISSOtm
ISSOtm / csvtomap.py
Last active May 22, 2021 21:28
CSV → Binary tilemap converter
View csvtomap.py
#!/usr/bin/env python3
import sys
def main(argv):
if len(argv) != 3:
print(f"Usage: {argv[0} -(0|1) file.csv", file=sys.stderr)
return 1
if argv[1] == "-0":
bounds = (-128, 127)