Skip to content

Instantly share code, notes, and snippets.

View selenologist's full-sized avatar

Luna Langton selenologist

  • New South Wales, Australia
View GitHub Profile
@selenologist
selenologist / gba_types.h
Created May 10, 2023 20:33
Reads a Pokemon Emerald save file and dumps the party's BoxPokemon structs to the screen as as QR code
// adapted from pret/pokeemerald
#ifndef GUARD_GBA_TYPES_H
#define GUARD_GBA_TYPES_H
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
@selenologist
selenologist / Cargo.toml
Last active December 29, 2021 06:13
Crappy paraphonic midi router for keystep pro
[package]
name = "ksp-paraphonic"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
wmidi = "4.0.6"
midir = "0.7.0"
@selenologist
selenologist / Cargo.toml
Last active June 23, 2020 12:11
Stupid latency compensation rollback system
[package]
name = "game-state-recomputation"
version = "0.1.0"
authors = ["luna <selenologist@users.noreply.github.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
im = "15.0"
@selenologist
selenologist / chord_progression.py
Created April 5, 2020 12:31
Crappy python script for generating MIDI from chord progressions
#!/usr/bin/env python3
import re
import midi # https://github.com/louisabraham/python3-midi
# Transcript for Pachelbel's Canon chord progression:
#
# Key? D
# PROG [] 1
# PROG [1M] 5
@selenologist
selenologist / rfs-fire-monitor.py
Created November 27, 2019 05:56
Pulls data from the rfs.nsw.gov.au majorIncidents feed every 10 minutes, printing a summary of nearby incidents.
import math, json, time, re
import urllib.request
MI_URL = "https://www.rfs.nsw.gov.au/feeds/majorIncidents.json"
def get_features_from_net():
start = time.time()
data = urllib.request.urlopen(MI_URL).read()
loadtime = time.time()
@selenologist
selenologist / ovh-ideal-brute.py
Created November 27, 2019 05:42
Simple brute force of ideal amount of credits to add to OVH public cloud that minimises wasted credits with a monthly service
# OVH only lets you add integer values of credits at a time,
# but credits expire 13 months after being purchased.
# So, given the monthly cost of the service and a current balance of credits
# (possibly smaller than the monthly cost) there exists an amount of added credits
# that will yield the lowest amount of leftover credits when the the balance becomes
# lower than the monthly cost.
#
# There's probably a smarter way to do this but this is computationally cheap enough that I
# really don't care.

Keybase proof

I hereby claim:

  • I am selenologist on github.
  • I am yueming (https://keybase.io/yueming) on keybase.
  • I have a public key ASAwF2HGu9sxrh1pTTe7YTKpJtHVWjz3eUf_f_mmpPoDzAo

To claim this, I am signing this object:

// play with ptrace
// was trying to make a thing that messed with a parent shell,
// but only for fun because of course you can't ptrace your own
// processes on modern hardened kernels without overriding those
// features.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
/* Doesn't actually do a missing-fundamental effect
* I couldn't work out how to do it.
* Hopefully this is illustrative of how to use LADSPA and/or FFTW3.
* Not that the latter is used properly.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
##### All rights reserved #####
# crappy sound implementation
# no more pymunk dependency now, pure pygame
import time, math, queue, ctypes, random, pygame, operator, numpy as np, sys
from pygame import gfxdraw
from pyaudio import PyAudio, paFloat32,paContinue
pyaudio = PyAudio()