Skip to content

Instantly share code, notes, and snippets.

View benolee's full-sized avatar

Ben Holley benolee

View GitHub Profile

put this in

#!/usr/bin/env bash

: ${temp_directory=$(mktemp -d "/tmp/demo/example_XXXXXXXXXXXXX")}
: ${filename=$(mktemp "$temp_directory/command_XXXXXXXXXXXX")}
export PATH="$temp_directory:$PATH"

lambda() {
View ascii_to_unicode.rb
#!/usr/bin/env ruby
# coding: utf-8
require 'json'
mapping = JSON.parse(['ascii_to_unicode']
puts mapping.reduce($<.read) { |a, (k,v)| a.gsub(k, v) }
"ascii_to_unicode": {
View 01 simple dalvik vm.markdown

why can't I run a dex file in a statically linked linux x64 native elf dalvik vm?

I want to run a dex file in a simple dalvik vm runtime for x86_64…but how?

trying out a simple dvm. there are a few old projects that I couldn't get to work. I will probably try this out at some point:


  1. java hello world ugh
View Sang.Map.VoxelMapData
using System;
using System.IO;
using ICSharpCode.SharpZipLib.NotThreadSafe.Zip;
using Sang.Common;
using Sang.Utility;
using Sang.Voxel;
namespace Sang.Map
// Token: 0x02000271 RID: 625
View rot13_digest.rb
require 'zlib'
module (
ROT13 = 'a'.upto('z').zip('a'.upto('z').lazy.cycle.drop(13)).then { |r| r.concat { |a| } }.to_h
def rot13_digest(s) Encoding::BINARY).tap { |buffer|
.deflate(s, Zlib::NO_COMPRESSION)
.map { |c| ROT13[c] }

vedis bash loadable

what is this?

Loadables in bash are exactly like builtins, but you enable or disable at runtime. They're shared libraries whose main interface is receiving the WORD_LIST, which is basically the last command.

For this loadable, I want to provide nice data structures directly to bash.

Vedis is an embeddable self-contained library with commands and data structures from Redis, but without the networking.

benolee / ninja-gaiden-ii.lua
Last active April 13, 2023 23:46
Mesen port of Scumtron's Lua Script for Ninja Gaiden II
View ninja-gaiden-ii.lua
-- Q, W, I, A keys while unpaused or frame-advancing toggles stuff
-- for Mesen 0.9.9
local bit = require "bitop_funcs".bit
local function BIT(x)
return bit.bor(0, 2^x)
function tobitstring(n,m)
View Worker with setTimeout.js
const workerHandler = `function (e) {
if ( === 'ping') {
} else {
self.setTimeout(function () {
}, 1000/60)
const worker = new Worker(
View map.mkd

N8Pro SAV Map:

N8Pro Sav            Nes / Cart
0000:07FF            CPU 0000:07FF (ram)
0800:17FF            PPU 2000:2FFF (nametables)
1800:187F            Mapper Registers
1880:189F            APU Registers                      
18A0:18BF            PPU 3F00:3F1F (palettes)
18C0:18C7            Ppu Registers (CTRL, MASK, Scroll_HI, Scroll_LO)


What is this?

rb_string_indices is a rust native extension for ruby String that returns all indices for matches of a given substring.

How does it work?

It's using a ruby and rust interop library called rutie.