Skip to content

Instantly share code, notes, and snippets.

obskyr

Block or report user

Report or block obskyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@obskyr
obskyr / ohmybaud.ino
Last active Feb 25, 2019
Test baud rates on Arduino compatibles – does your desired combination of clock frequency and baud rate work?
View ohmybaud.ino
#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 / twittify.py
Last active Jun 29, 2018
Prepare lossless images (screenshots, for example) for being posted to Twitter, scaling them reasonably and making sure Twitter will keep them lossless.
View twittify.py
#!/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 / asmdependencies.cr
Last active Mar 16, 2018
Near-instant RGBDS assembly dependency generation / include scanning, for use with makefiles.
View asmdependencies.cr
# 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 / banksy.py
Last active Mar 9, 2018
A Python script to convert Game Boy memory addresses between absolute and banked forms.
View banksy.py
#!/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 / stream_response.py
Last active May 25, 2019
How to stream a requests response as a file-like object.
View stream_response.py
# -*- 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 / jitai.user.js
Last active Jun 29, 2019
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
View jitai.user.js
// ==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
View colorparse.c
#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 / helloimdean.py
Created Nov 19, 2013
The Dean from Community does a lot of interesting stuff. The best part of this code is easily the stupidly long list of verbs.
View helloimdean.py
# -*- 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
You can’t perform that action at this time.