Skip to content

Instantly share code, notes, and snippets.

View djanatyn's full-sized avatar

Jonathan Strickland djanatyn

View GitHub Profile
@djanatyn
djanatyn / disasm.rs
Created December 28, 2023 08:27
disassembling melee with radare2 from rust
use r2pipe::{R2Pipe, R2PipeSpawnOptions};
/// Filename of GALE01 v1.02 GCM disk image.
const SSBM_ISO: &str = "ssbm.iso";
/// Filename of converted main.dol -> main.elf, converted with doltool.
const MAIN_DOL: &str = "main.elf";
/// Offset of get_rand_int in main.elf and in memory.
///
@djanatyn
djanatyn / scrobble.md
Created October 18, 2023 00:34
scrobble fix story

when i'm biking i listen to music on my ipod (hacked to run rockbox), i like using last.fm so i record a scrobble.log file

i was going to upload the scrobbles but i noticed some of the dates were from before 2001

$ cat /mnt/.scrobbler.log
...
JPEGMAFIA EP2!  FEED HER! 6 176 L 1616925238     
Yuzo Koshiro  Actraiser Opening   131 S 946994845
...
@djanatyn
djanatyn / scrobble-fix.rs
Last active October 17, 2023 14:58
fixing scrobbles
//! https://github.com/Rockbox/rockbox/blob/3c89adbdbdd036baf313786b0694632c8e7e2bb3/apps/plugins/lastfm_scrobbler.c#L29
use chrono::{DateTime, TimeZone, Utc};
use nom::{
bytes::complete::take_until, character::complete::char, multi::count, sequence::terminated,
IResult,
};
fn main() -> std::io::Result<()> {
let log = std::fs::read_to_string("scrobbler.log")?;
@djanatyn
djanatyn / PlyPeach5K_Share_ACTION_AttackAirLw_figatree.subaction
Created July 1, 2023 15:08
PlyPeach5K_Share_ACTION_AttackAirLw_figatree
name: PlyPeach5K_Share_ACTION_AttackAirLw_figatree
stroff: 97c
animoff: 87f80
unknown 0x8: 3681
eventsoff: 55cc
positionalFlags: 8
charID: 900
unknown0x14: 0
48 (0x8d60):
offset: 0x55cc
@djanatyn
djanatyn / match.rs
Created November 26, 2022 15:45
ganzu
[src/main.rs:284] (filter, file) = (
Mimetype(
"text/plain",
),
FileSnapshot {
input_name: "/home/djanatyn/query.graphql",
absolute_path: "/home/djanatyn/query.graphql",
last_mtime: 1643587565,
mimetype: "text/plain",
},
@djanatyn
djanatyn / chocobo.md
Created November 14, 2022 01:01
chocobo coloring prolog

So in Final Fantasy 14, you have a cute companion, a Chocobo! You can change the color of your Chocobo:

The default color of the chocobo is Desert Yellow. Players can change the color of their Chocobo by feeding them snacks...

The color value is tracked in RGB, so the default value (Desert Yellow) is 216/180/87.

Different fruit will change the Chocobo color in different ways:

Snack                  Effect                                                 R      G      B
---------------------  -----------------------------------------------------  -----  -----  -----
@djanatyn
djanatyn / test.hs
Created November 10, 2022 16:07
xmonad pasteString debugging
insertDate :: X ()
insertDate = pasteString "<>"
-- this is outputting ">>"!
@djanatyn
djanatyn / nixos-systemd-run-confusion.md
Last active November 17, 2022 23:56
trying to get systemd-run and nixos working well together

Learning to use systemd-creds properly:

❯ pass show backups/notes | sudo systemd-creds encrypt --name=borg-notes - /tmp/borg-notes.creds

This encrypts with /var/lib/systemd/credential.secret, you can load using LoadCredentialEncrypted=:

In a systemd unit, if i provide the property LoadCredentialEncrypted=borg-notes:/tmp/borg-notes.creds, then I can run systemd-creds cat borg-notes to get the password:

❯ sudo systemd-run -P --wait -p LoadCredentialEncrypted=borg-notes:/tmp/borg-notes.creds systemd-creds cat borg-notes
@djanatyn
djanatyn / feeds.opml
Created November 2, 2022 19:31
my rss feeds november 2022
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<head>
<title>Miniflux</title>
<dateCreated>Wed, 02 Nov 2022 19:31:01 UTC</dateCreated>
</head>
<body>
<outline text="All">
<outline title="Black Agenda Report" text="Black Agenda Report" xmlUrl="https://blackagendareport.com/rss.xml" htmlUrl="http://blackagendareport.com/rss.xml"></outline>
<outline title="Free Mumia" text="Free Mumia" xmlUrl="http://box2108.temp.domains/~freemumi/feed/" htmlUrl="http://box2108.temp.domains/~freemumi"></outline>
@djanatyn
djanatyn / nix-shell.sh
Created October 31, 2022 02:02
nix-shell vs nix shell
# why does `nix-shell` update NIX_LDFLAGS
# but `nix shell` does not?
❯ nix shell nixpkgs#libGLU -c /bin/sh -c 'env | grep -i glu'
PATH=/nix/store/xva8m3sa2yc56cglmqxgj3cdkq50hcly-glu-9.0.2/bin:/home/djanatyn/.zplug/repos/zplug/zplug/bin:/home/djanatyn/.zplug/bin:/usr/local/bin:/home/djanatyn/.local/bin:/nix/store/crrclzy9cqk55nlkcals81z1556c195c-kitty-0.26.2/bin:/nix/store/jwg4p52y4s69pyj9l8fmjc3xhckbl2rj-imagemagick-7.1.0-49/bin:/nix/store/5ki8qk489a2cmfc9sbjb2kwda8ymza3p-ncurses-6.3-p20220507-dev/bin:/run/wrappers/bin:/home/djanatyn/.nix-profile/bin:/etc/profiles/per-user/djanatyn/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
❯ nix-shell -p libGLU --command 'env | grep -i glu'
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
NIX_CFLAGS_COMPILE= -isystem /nix/store/1gs13a2259qdbxjgx4vkw1my6a80vq4q-glu-9.0.1-dev/include -isystem /nix/store/mgky1qxwsj8268q8ivp41772pp6q1kq8-libGL-1.3.2-dev/include -isystem /nix/store/k8bkfl6lf5sgq