Skip to content

Instantly share code, notes, and snippets.

View hikari-no-yume's full-sized avatar
🌟
trying to save beautiful things

hikari_no_yume hikari-no-yume

🌟
trying to save beautiful things
View GitHub Profile
@lynn
lynn / PrettyParseError.hs
Last active October 20, 2020 09:29
Pretty ParseErrors for Text.Parsec
module PrettyParseError (
prettyParseError,
PrettyParseErrorOptions(PrettyParseErrorOptions),
prettyParseErrorDefaults
) where
import Data.List (intercalate, nub)
import Text.Parsec
import Text.Parsec.Error
import Text.Parsec.Pos
@billatq
billatq / royal-print.py
Created June 7, 2020 22:03
Super simple driver for Royal LetterMaster
import sys
import usb.core
import usb.util
import time
def initialize():
# find our device
dev = usb.core.find(idVendor=0x1a86, idProduct=0x7584)
@rrika
rrika / test.c
Created December 14, 2018 00:08
Mesa hooking
/*
MESA=<path to git clone of git://anongit.freedesktop.org/mesa/mesa>
gcc
-I$MESA/include/
-I$MESA/src/
-I$MESA/src/mesa
-I$MESA/src/mapi
-I$MESA/src/gallium/include
-lglapi
@Prof9
Prof9 / Readme.md
Last active February 1, 2024 07:02
THIS SCRIPT NO LONGER WORKS! Twitter has rolled out a fix for the web client hack. (Original text: Force enable cramming (280 character tweets) on Twitter. Use TamperMonkey. NOTE: Stops working when you switch pages, refresh to fix.)

As of 7 November 2017 everyone has access to 280 characters in supported clients, so you no longer need this script!

while ! ./_/build.sh 2> _/build.log; do
if [[ $(grep "No such file or directory" _/build.log) =~ .*error..(.*)..No.such.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding file" $missing
mkdir -p $(dirname _missing/$missing)
touch _missing/$missing
elif [[ $(grep "was not declared in this scope" _/build.log) =~ .*error..‘([A-Z0-9_]*)’.was.not.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding constant" $missing
@porglezomp
porglezomp / conformant_json_parser.py
Created October 27, 2016 06:08
It's possible to have an extremely simple standard-conformant JSON parser!
# RFC 7159 § 9
# "An implementation may set limits on the size of texts that it accepts."
def parse_json(text):
if len(text) != 1:
raise ValueError("Only accepts single character JSON values")
return int(text[0])
@glasnt
glasnt / regional.py
Last active August 25, 2016 16:22
🇷​🇪​🇬​🇮​🇴​🇳​🇦​🇱​ ​🇮​🇳​🇩​🇮​🇨​🇦​🇹​🇴​🇷​ ​🇨​🇭​🇦​🇷​🇦​🇨​🇹​🇪​🇷​🇸​ ​🇦​🇸​ ​🇦​ ​🇸​🇪​🇷​🇻​🇮​🇨​🇪
"""
Usage: python3 regional.py list of words
Prints a representation of the words as Regional Identifiers, and copies the output directly to keyboard for you
This is because some terminals think that zero width spaces are silly.
Currently supports: A-Z
Requires: Python 3
Now less complex, thanks @bmispelon!
"""
@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created October 10, 2015 11:07
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
@qntm
qntm / multiline.js
Last active October 16, 2023 12:39
// TODO: longer method name
Function.prototype.extractBlockCommentAsMultilineString = function() {
return this.toString().match(/^function \(\)\{\s*\/\*((?:[^*]|\*+[^*\/])*)\*+\/\s*\}$/)[1];
};
var s = function(){/*
STRING
GOES
HERE
*/}.extractBlockCommentAsMultilineString();
@zipcode
zipcode / pulse.js
Created August 10, 2015 05:45
Pulse inserted nodes in the DOM
function pulse(node, time) {
if (!node) throw new Error("node was falsy");
if (node.constructor && node.constructor == NodeList) {
var nodes = Array.prototype.slice.call(node);
nodes.forEach(function (node) { pulse(node, time); });
return;
}
if (!node.style) return;