Skip to content

Instantly share code, notes, and snippets.

@obskyr
obskyr / helloimdean.py
Created November 19, 2013 00:17
The Dean from Community does a lot of interesting stuff. The best part of this code is easily the stupidly long list of verbs.
# -*- coding: utf-8 -*-
import random
verbing = ['coming', 'opening', 'standing', 'attempting', 'beating', 'clearing', 'demanding', 'failing', 'pulling', 'regarding', 'studying', 'dancing', 'feeding', 'improving', 'letting', 'sleeping', 'suggesting', 'wondering', 'bargaining', 'booking', 'crying', 'filling', 'knitting', 'laughing', 'preparing', 'signing', 'striking', 'wanting', 'cooking', 'sharing', 'applying', 'approaching', 'computing', 'controlling', 'deciding', 'discussing', 'grouping', 'lifting', 'lighting', 'mining', 'offspring', 'pudding', 'threatening', 'breeding', 'caring', 'choosing', 'climbing', 'corresponding', 'establishing', 'expecting', 'healing', 'heating', 'lending', 'listing', 'maintaining', 'placing', 'planting', 'pressing', 'questioning', 'restructuring', 'rolling', 'shaking', 'spelling', 'arising', 'bombing', 'claiming', 'cling', 'enjoying', 'entering', 'picking', 'reasoning', 'screening', 'shipping', 'voting', 'farming', 'joining', 'pointing', 'pushing', 'representing', 'searching', 'h
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
// Parse dispmanx-safe colors from command-line arguments
typedef struct __attribute__((__packed__)) {
uint8_t r;
uint8_t g;
@obskyr
obskyr / jitai.user.js
Last active August 23, 2023 09:47
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
// ==UserScript==
// @name Jitai
// @version 1.3.2
// @description Display WaniKani reviews in randomized fonts, for more varied reading training.
// @author Samuel (@obskyr)
// @copyright 2016-2018, obskyr
// @license MIT
// @namespace http://obskyr.io/
// @homepageURL https://gist.github.com/obskyr/9f3c77cf6bf663792c6e
// @icon http://i.imgur.com/qyuR9bD.png
@obskyr
obskyr / stream_response.py
Last active April 2, 2024 09:53
How to stream a requests response as a file-like object.
# -*- coding: utf-8 -*-
import requests
from io import BytesIO, SEEK_SET, SEEK_END
class ResponseStream(object):
def __init__(self, request_iterator):
self._bytes = BytesIO()
self._iterator = request_iterator
@obskyr
obskyr / banksy.py
Last active March 9, 2018 13:51
A Python script to convert Game Boy memory addresses between absolute and banked forms.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Convert Game Boy addresses between absolute and banked forms.
from __future__ import print_function
from __future__ import unicode_literals
import sys
@obskyr
obskyr / asmdependencies.cr
Last active March 16, 2018 02:12
Near-instant RGBDS assembly dependency generation / include scanning, for use with makefiles.
# Get all the dependencies of RGBDS assembly files recursively,
# and output them using Make dependency syntax.
def dependencies_in(asm_file_paths)
asm_file_paths = asm_file_paths.clone
dependencies = {} of String => Set(String)
asm_file_paths.each do |asm_file_path|
if !dependencies.has_key? asm_file_path
asm_dependencies, bin_dependencies = shallow_dependencies_of asm_file_path
@obskyr
obskyr / twittify.py
Last active June 29, 2018 02:26
Prepare lossless images (screenshots, for example) for being posted to Twitter, scaling them reasonably and making sure Twitter will keep them lossless.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
"""Turn a lossless image into something in a resolution suitable for Twitter,
and turn down the opacity on a single pixel so Twitter won't convert it.
"""
@obskyr
obskyr / ohmybaud.ino
Last active February 25, 2019 03:14
Test baud rates on Arduino compatibles – does your desired combination of clock frequency and baud rate work?
#include <math.h>
// Implements the "client" side of the testing protocol of ohmybaud.py.
#define SAFE_BAUD_RATE 9600
#define TEST_DURATION_TARGET 2.5
const uint32_t BAUD_RATES[] = {
2400,
4800,
@obskyr
obskyr / _Tales of Ar'Okés.md
Last active January 5, 2022 11:25
Use your arrow keys instead of a numpad in Tales of Maj'Eyal and other games where it's required!

Tales of Ar'Okés

Do you have a tenkeyless keyboard? Are you not stuck in the 1970s? Then finally, your prayers are answered. This handy script lets you use arrow keys in Tales of Maj'Eyal (and other grid-based numpad-controlled games) and still reliably walk diagonally!

How to use

  1. Install AutoHotKey, the scripting language (for Windows only)
  2. Click “Download ZIP” at the top right of this page, and extract arrow-keys-to-numpad.ahk to wherever you want it.
  3. Whenever you want to use it, simply double-click the script, and it will run in the background!
@obskyr
obskyr / X-MAS CTF 2020 – Ken Kutaragi's Secret Code.md
Created December 20, 2020 02:53
How to Reverse-Engineer a PS1 Game – X-MAS CTF 2020 Writeup

X-MAS CTF 2020 Writeup: Ken Kutaragi's Secret Code

Or, How to Reverse-Engineer a PS1 Game

X-MAS CTF 2020 was my first CTF – I do ROM hacking, fan translation, and hardware modding, but I haven't done much hacking related to modern systems, so I was a wee bit worried there wouldn't be many challenges suited to my skillset. Imagine my surprise and delight, then, when I saw the challenge Ken Kutaragi's Secret Code, which consists of a PlayStation executable! And wouldn't you know it? I've hacked away at quite a few PS1 games in my day! Not many people solved it, likely because it requires quite niche skills – so let me share those with you!


Identifying our goal

The challenge description is as follows.