Skip to content

Instantly share code, notes, and snippets.

View ravener's full-sized avatar
❤️
owo

Ravener ravener

❤️
owo
View GitHub Profile
@ravener
ravener / vm.js
Created June 29, 2018 18:03
Virtual Machine in JavaScript
/*
MIT License
Copyright (c) 2018 Free TNT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@ravener
ravener / changelog.sh
Created June 24, 2022 07:58
Generate CHANGELOG.md from git tags
#!/usr/bin/bash
# A bash script to generate a markdown changelog from git tags
# Run this inside a git repository to generate CHANGELOG.md file
if [ ! -d ".git" ]; then
echo "Error: Not a git repository"
exit 1
fi
@ravener
ravener / det.py
Last active October 8, 2022 18:23
Calculate determinant of an n × n matrix in Python
# Get the submatrix of A
# Removing the ii-th row and jj-th column
def sub(A, ii, jj):
matrix = []
for i in range(len(A)):
if i == ii:
continue
@ravener
ravener / bf.py
Created May 12, 2024 11:17
Brainfuck Interpreter in Python
#!/usr/bin/python3
# -*- coding: utf8 -*-
import sys
from argparse import ArgumentParser
from pathlib import Path
def compute_jump_table(instructions: str) -> dict[int, int]:
"""
@ravener
ravener / rot13.py
Created June 9, 2024 08:51
ROT13 in Python and Rust
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import sys
def generate_table() -> dict[str, str]:
"""
Generates a look up table for mapping characters to their ROT13 character.
"""
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@ravener
ravener / vowels.py
Last active June 18, 2024 15:49
Count the number of vowels in a word
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import unittest
vowels: list[str] = ["a", "e", "i", "o", "u"]
def count_vowels(word: str) -> int:
"""
Counts the vowels in a given word.

IPS File Format

IPS supposedly stands for "International Patching System" and is a patching format that was common with older ROMs back in the day.

The format is old and has limitations, so it's not often used today but I still wanted to keep the information alive as there are less sites documenting the format nowadays.

  • IPS addresses offsets to the original file in a 24-bit value, therefore it is limited to 2^24 meaning it can only patch up to the first 16 MiB of the file.
  • The patches themselves use 16-bit for the length and so it can only include patches up to 2^16 or 64 KiB at a time.

| Section | Size (bytes) | Description |