Skip to content

Instantly share code, notes, and snippets.

@iamgreaser
iamgreaser / log2_ceil_hifive1_revb.c
Created February 20, 2020 05:54
ceil(log2(x)) implementation for HiFive1 RevB
int log2_ceil(uint32_t v)
{
if ( v == 0 ) {
return -1;
} else if ( v == 1 ) {
return 0;
} else if (((int32_t)(v-1)) < 0) {
return 32;
} else {
for ( ;; ) {
@iamgreaser
iamgreaser / boot.S
Last active April 21, 2024 09:04
RV64 QEMU virt VGA mode 13h
// riscv64-elf-gcc -Os -mcmodel=medany -nostdlib -march=rv64gc -Wl,-T,qemu.ld -o vga-hello.elf boot.S main.c
// qemu-system-riscv64 -machine virt -device VGA -smp 1 -kernel vga-hello.elf
.section .text
.global _start
.global _enter
_start:
_enter:
//1: j 1b
@iamgreaser
iamgreaser / malsa076.py
Created November 30, 2019 20:43
malsa076.py
"""
MALSA 0.76: Make AoS Less Shit Again
Instantly turns a 0.75 server into a 0.76 server.
Version 4
Author: GreaseMonkey
Changelog:
Version 4: 2019-12-01
- Updated so that it works on this year's piqueserver.
@iamgreaser
iamgreaser / superz-map.txt
Created September 28, 2019 03:34
preliminary zzt + superz memory maps
// 0C7B: ZZT (?purpose?)
// 0C7B:2085: find_stat_index_at
//
// 14D3: Pascal runtime?
// 14D3:0244: _TMP__ENSURE_STACK_FASTCALL
// 14D3:0329: AllocMem
// 14D3:0341: Freemem
// data+bss:
@iamgreaser
iamgreaser / sh2-seeds-1000-lines.txt
Created September 18, 2019 05:57
1000 Silent Hill 2 seeds for slow menu days
(Fr), Seed,Clock,Blod,Carb,Spin,Bug,H,Br,iefcase
0,0x6A4F8C55,10:10,3338,3869,6583,921,6,15,time
1,0x1F5ED66A,10:47,7414,3338,2275,687,1, 4,dark
2,0x00B1C75B,08:20,8699,7414,9532,794,4,10,luck
3,0x41D1CBF8,00:13,3386,8699,5834,653,1, 2,hell
4,0x2C4998D1,03:22,4147,3386,2756,473,2,17,kill
5,0x0A8BEF36,07:15,6996,4147,5322,147,1, 0,open
6,0x5A3B7E37,06:20,3864,6996,8341,642,4,14,dust
7,0x2153AFA4,07:41,1471,3864,7564,128,1,16,help
8,0x2CFDF10D,08:06,9966,1471,3221,429,2, 0,open
@iamgreaser
iamgreaser / sh2-briefcase.txt
Created June 13, 2019 23:57
The Silent Hill 2 Briefcase: The Actual Word List
The Silent Hill 2 Briefcase: The Actual Word List
PC version:
0048f640 50 01 a0 00 6f 01 df 00 30 01 e0 00 4f 01 ff 00 |P...o...0...O...|
0048f650 90 00 20 01 ff 01 ff 01 a0 00 00 01 4f 01 1f 01 |.. .........O...|
0048f660 c0 00 e0 00 2f 01 ff 00 50 01 e0 00 ff 01 1f 01 |..../...P.......|
0048f670 6f 70 65 6e 64 61 6d 6e 68 65 6c 6c 74 6f 77 6e |opendamnhelltown|
0048f680 64 61 72 6b 6d 61 6d 61 64 6f 77 6e 6c 6f 76 65 |darkmamadownlove|
0048f690 6c 6f 63 6b 6d 69 73 74 6c 75 63 6b 6c 6f 73 65 |lockmistlucklose|
@iamgreaser
iamgreaser / packaroo.cl
Created June 16, 2018 01:53
IT214 sample brute force optimal thing finder
;; vim: set sts=2 sw=2 et sm lisp :
(declaim (optimize (debug 3)
(speed 3)
(compilation-speed 0)
(safety 3)
(space 0)))
(defun range0x (n)
(do ((i (1- n) (1- i))
*> vim: set syntax= et sts=2 sw=2 :
*> free syntax. compile like so:
*> cobc -x -free -o actualmandel actualmandel.cbl
identification division.
program-id. actualmandel.
environment division.
data division.
working-storage section.
01 template-string.
03 template-elems occurs 10 times pic x.
@iamgreaser
iamgreaser / head.S
Created April 23, 2018 08:18
how to make a light blink on a SAMC21-XPRO kit
.thumb
.text
.global vector_table
vector_table:
.word 0x20007FF0
.word _start+1
.word isr_lockup+1 // NMI
.word isr_lockup+1
.word isr_lockup+1
@iamgreaser
iamgreaser / infix-mode.cl
Last active March 1, 2022 20:23
infix notation for common lisp - first reader macro attempt
;; vim: set sts=2 sw=2 et sm lisp :
(defvar *reading-a-list* nil)
(defun read-terminator (stream char)
(declare (ignore stream))
(error (format nil "unexpected ~S" char)))
(defun get-infix-precedence (symbol)
(case symbol