Skip to content

Instantly share code, notes, and snippets.

put this in lambda.sh

#!/usr/bin/env bash

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

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

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: https://github.com/jserv/simple-dvm

dvm

  1. java hello world ugh
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
require 'zlib'
module (Module.new)::Digest
ROT13 = 'a'.upto('z').zip('a'.upto('z').lazy.cycle.drop(13)).then { |r| r.concat r.map { |a| a.map(&:upcase) } }.to_h
def rot13_digest(s)
String.new(encoding: Encoding::BINARY).tap { |buffer|
Zlib
.deflate(s, Zlib::NO_COMPRESSION)
.each_char
.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
benolee / ninja-gaiden-ii.lua
Last active April 13, 2023 23:46
Mesen port of Scumtron's Lua Script for Ninja Gaiden II
-- 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)
end
function tobitstring(n,m)
const workerHandler = `function (e) {
if (e.data === 'ping') {
self.postMessage('pong')
} else {
self.setTimeout(function () {
self.postMessage('tack')
}, 1000/60)
}
}`
const worker = new Worker(

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)

RbStringIndices

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.