Skip to content

Instantly share code, notes, and snippets.

@nemzyx
nemzyx / jsfuck_compressor.js
Last active December 9, 2023 00:33
jsfuck compressor
const jsfuck_code = `[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+
@nemzyx
nemzyx / ctxRunner.js
Created March 14, 2023 18:14
ctxRunner.js: micro framework for canvas API
let ctx, w, h
const context = (ctx_, w_, h_) => {
ctx = ctx_
w = w_
h = h_
}
const init = (callback) => {
utils() // extend ctx obj
return callback(ctx, w, h)
@nemzyx
nemzyx / cached_math.js
Last active March 14, 2023 18:18
Capturing math in LUTs with JavaScript
// save math functions in a table
const TAU = 2*Math.PI
const HALFPI = Math.PI / 2
const P = 10000 // precision factor, int arithmetic
const steps = 2048
const step = TAU/(steps)
const SIN_TABLE = []
for (let i=0;i<steps;i++) {
@nemzyx
nemzyx / combine_elon.vmf
Created January 12, 2023 07:40
AI attempts to create a counter-strike: source map
// This is a comment in a VMF file
versioninfo
{
"editorversion" "400"
"editorbuild" "7153"
"mapversion" "1"
"formatversion" "100"
"prefab" "0"
}
@nemzyx
nemzyx / bindConsole.js
Last active March 14, 2023 18:15
Reactive browser console
const setWm = (wm, obj, v) => {
wm.set(obj, Object.assign(wm.get(obj), { internal: v }))
wm.get(obj).listener(v)
}
const bindWm = (wm, obj, ref, f) => {
wm.set(obj, {
listener: () => {},
listen: function(listener) { this.listener = listener },
internal: ref,