Skip to content

Instantly share code, notes, and snippets.

View creationix's full-sized avatar
💚
<3

Tim Caswell creationix

💚
<3
View GitHub Profile
@creationix
creationix / etching-thin.svg
Last active October 9, 2024 03:50
Hexy Compute Shell
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const start = 0x2800; // Braille pattern blank
for (let i = 0; i < 16; i++) {
let line = "";
for (let j = 0; j < 16; j++) {
line += String.fromCodePoint(start + i * 16 + j);
}
console.log(line);
}
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "Grove_Temperature_And_Humidity_Sensor.h"
#define PIN_GROVE_POWER 15 // https://github.com/esphome/issues/issues/223
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
// #define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
../bench/corgis/website/datasets/json/tate/tate.json (2.60 MiB)
Action Duration Used Kept Output
cjson_resty.decode 38.9ms 3.87 MiB 3.63 MiB table: 0x419b8440
Tibs.decode 42.1ms 2.95 MiB 2.91 MiB table: 0x4209dad8
cjson_resty.encode 13.2ms 1.88 MiB 1.88 MiB string: 1.88 MiB
Tibs.encode 48.3ms 8.24 MiB 1.97 MiB string: 1.84 MiB
encoded sizes mismatch: 1968571 1933719
cjson_resty = "data":{"url":"http:\/\/www.tate.org.uk\/
do
-- Polyfill for luajit without __pairs and __ipairs extensions
local triggered = false
pairs(setmetatable({}, { __pairs = function()
triggered = true
return function() end
end }))
if not triggered then
print "Polyfilling pairs"
function _G.pairs(t)
@creationix
creationix / Dockerfile
Last active November 14, 2022 22:16
Build luvit from source using alpine docker
FROM alpine AS build-luv
RUN apk add build-base cmake git
RUN git clone --recursive https://github.com/luvit/luvi.git
RUN make -C luvi/deps/luv
FROM alpine AS build-luvi
RUN apk add build-base cmake git
RUN git clone --recursive https://github.com/luvit/luvi.git
RUN apk add perl linux-headers
RUN make -C luvi regular-asm
--- xxHash
--- https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md#xxh32-algorithm-description
local bit = require 'bit'
local rshift = bit.rshift
local rol = bit.rol
local bxor = bit.bxor
local tobit = bit.tobit
local ffi = require 'ffi'
local bit = require 'bit'
local bxor = bit.bxor
local rol = bit.rol
local lshift = bit.lshift
local band = bit.band
local bor = bit.bor
local function gimli(state)
for round = 24, 1, -1 do
for column = 0, 3, 1 do
count=9;
h=100;
r=27;
s=4;
g=1.1;
w=(r+s)*(count+1)+s*2;
echo(w);
d=(r+s)*(2+2*sin(60))+s*2;
// ESC := "^"
ESC := "\x1b"
WIDTH := 33
HEIGHT := 32
FPS := 120
SIZE := WIDTH * HEIGHT
pixels := ByteArray(SIZE)
dirty_x1 := 0
dirty_y1 := 0