Skip to content

Instantly share code, notes, and snippets.

Avatar
🌙

Luna lunasorcery

🌙
View GitHub Profile
View misleading-cat.cpp
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
View clang-microtransactions.sh
# https://twitter.com/lunasorcery/status/1295847638840020992
echo "[ Now building... 4 hours remaining ]"
sleep 3
echo "You can skip the wait by spending 40 gems."
echo "What would you like to do?"
read -p "> "
sleep 1
echo "You don't have any gems to spend!"
echo "What would you like to do?"
@lunasorcery
lunasorcery / kill.sh
Created Aug 17, 2020
Activity Monitor Moomin
View kill.sh
killall "⠀⠀⠀⠀⠀⠀⠀⢠⢦⡀⠀⡰⣩⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀"
killall "⠀⠀⠀⠀⠀⠀⠀⠘⣄⠙⠍⠁⠙⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀"
killall "⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⠀⡠⠄⠔⠊⠉⠒⠒⠒⢄⠀⠀⠀"
killall "⠀⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⠆⠀⠀"
killall "⠀⠀⢠⢤⠜⡆⠀⢸⠀⠰⣄⠀⠀⠀⠀⠀⠀⠀⣠⠎⠀⠀⠀"
killall "⠀⠀⠱⠤⡁⠈⠑⠇⠀⠀⠀⠉⠒⠤⠤⠄⢖⠊⠀⡐⠧⣄⣀"
killall "⠀⠀⠀⠀⠘⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⡉⠀⣀⣨⡷"
killall "⠀⠀⠀⠀⠀⠈⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠜⠁⠀⠀"
killall "⠀⠀⠀⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣸⠱⡀⠀"
killall "⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠁⠀⣣⠀"
View _WW080006B4_jump_entry1_colored_inbounds_poly.asm
; partial disassembly from Drome Racers (GBA, 2003)
; fill a flat-colored 2D polygon that's fully inside screen bounds
_WW080006B4_jump_entry1_colored_inbounds_poly:
str r0, [sp, #4] ; back up our current renderstream pointer
; read three verts from the renderstream into (r1,r2,r3)
ldr r1, [r0, #12]
ldr r2, [r0, #16]
ldr r3, [r0, #20]
View drome-racers-gba-sprite-decompression.asm
; EU 0x087E70E0 / NA 0x087E4230:
; loaded to RAM at 030008f0
; sprite decompression function (8bit indexed)
; r0: compressed sprite source ptr
; r1: vram destination ptr
; r2: width
; r3: height
.arm
add lr, lr, #1
stmdb sp!, {r4-r9}
View paniq-12-tiles.cpp
#include <cstdio>
#include <cstdint>
// bit layout:
// +-1-+
// 8 2
// +-4-+
bool matchHorizontal(uint8_t left, uint8_t right)
{
View generate-ridiculous-zero.cpp
#define SUPPRESS_SUBSCRIPT_WARNING 1
#include <iostream>
#include <string>
#include <random>
const int kMaxDepth = 5;
std::string emptyString(int depth=0, bool singular=false)
{
View shader-stream-2019-01-09.glsl
#version 410 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
uniform sampler2D texChecker;
uniform sampler2D texNoise;
View trans-gba-bios-hack.txt
Replace 104 bytes at $3204 with the following.
This stores the animated color palette for the letters, and the static color palette for the shimmer.
16 70 E0 01 1E 68 B0 01 1F 7C F0 01 0B 64 E0 01
1D 50 60 01 1F 7C F0 01 0B 64 E0 01 1D 50 60 01
1F 7C F0 01 0B 64 E0 01 1D 50 60 01 1F 7C F0 01
0B 64 E0 01 1D 50 60 01 1F 7C F0 01 0B 64 E0 01
1D 50 60 01 1F 7C F0 01 0B 64 E0 01 1D 50 60 01
1F 7C F0 01 1F 7C F0 01 1F 7C F0 01 1F 7C F0 01
1F 00 FF 7F F7 5E EF 3D
View shader-stream-2018-11-21.glsl
#version 410 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
uniform sampler2D texChecker;
uniform sampler2D texNoise;