Skip to content

Instantly share code, notes, and snippets.

View jenrik's full-sized avatar
🐧

Jener Rasmussen jenrik

🐧
View GitHub Profile
@shinyquagsire23
shinyquagsire23 / rf-extract.py
Last active September 6, 2023 22:09
LEGO LOCO RFH/RFD unpacker
import struct
import os
contents = open("resource.RFH", "rb").read()
blob_f = open("resource.RFD", "rb")
def huff_decompress(data):
bits = 0
node = struct.unpack("<H", data[4:6])[0]
decomp = ""
@larsch
larsch / termbench.c
Created September 9, 2018 10:23
Basic terminal benchmark program
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <stdint.h>
#include <stdlib.h>
void writestr(int fd, const char* str) {
write(fd, str, strlen(str));
}
@ArthurHeymans
ArthurHeymans / coreboot_x60.md
Last active April 4, 2021 08:37
How to flash coreboot properly on Thinkpad X60

How to flash coreboot to the thinkpad x60 the proper way

-> https://blog.aheymans.xyz/old-how-to-flash-coreboot-to-the-thinkpad-x60-the-proper-way/ is more up to date

What is so special about the x60 when running vendor bios?

Vendor BIOS write protects its bootblock, which means the lowest 64K of the flash can't be modified

This is a problem since the first code that runs on the CPU comes from there and if we ever want to run coreboot the cpu must start with coreboot code. This write protection is set in the PBR (protect bios range) registers on the southbridge, there is currently no known way to change them back once they are locked by setting the SPI Configuration Lock-Down bit.

@javiromero
javiromero / git_post_checkout_clean_pyc_and_empty_dirs.py
Last active August 8, 2017 22:20
Python scripts to check for new/missing Django migrations and Cleaning *.pyc and *. pyo for deleted *.py files from a repo & to remove any empty dir after every checkout
#!/bin/env python
"""
A hook to git that removes orphan files "*.pyc" and "*.pyo" for "*.py"
beeing deleted or renamed by git checkout. It also removes their empty parent
directories.
Place it to "my_local_repository/.git/hooks/post-checkout" and make it executable.
Nothing is cleaned for .py files deleted manually or by "git rm" etc.
Related to http://stackoverflow.com/q/1504724/448474
"""
import glob
"""
This file contains code that, when run on Python 2.7.5 or earlier, creates
a string that should not exist: u'\Udeadbeef'. That's a single "character"
that's illegal in Python because it's outside the valid Unicode range.
It then uses it to crash various things in the Python standard library and
corrupt a database.
On Python 3... well, this file is full of syntax errors on Python 3. But
if you were to change the print statements and byte literals and stuff: