Skip to content

Instantly share code, notes, and snippets.

View GoodClover's full-sized avatar

olive GoodClover

View GitHub Profile
@appgurueu
appgurueu / slowlocals.lua
Created February 20, 2023 18:44
Pathological example to show that due to upvalue copying locals can in fact be slightly slower than globals (environmentals)
local vars = {}
for i = 1, 50 do table.insert(vars, ("v%d"):format(i)) end
local all_vars, all_vals = table.concat(vars, ", "), "1" .. (", 2"):rep(#vars - 1)
local pathological_code = ([[
local %s = %s
return function(get_all)
if get_all then return %s end
return v1
end
]]):format(all_vars, all_vals, all_vars)

A few years ago, I tried to turn a Pi Zero into a ‘synthetic USB stick’ – where you’d plug it into your laptop and it’d appear like an ordinary flash drive, but the program on the Zero could intercept reads and writes and dynamically generate content. Like a FUSE filesystem, but as a piece of hardware, sort of.

So you could edit a Python file on your laptop, save it to the USB drive, and then the output of your Python code would magically appear as a sibling file on the drive; things like that. I thought it would be particularly cool as a way to get some dynamism and programmability

@shaunlebron
shaunlebron / realtalk.md
Last active March 25, 2024 15:26
why Dynamicland Realtalk isn't open source

Transcribed from an interview with Toby Schachman and Paula Te on The Afrofuturist Podcast:

There's this notion of the open-source movement. There are a lot of things
that we totally resonate with that because it's about understanding how your
technology works. We're totally 100% on board with that.

But then there are other issues with the open-source community, where it's
very internet-based and so open-source ends up benefitting this group of
people who have really strong access to internet and understand how to use
from math import *
# a performant solution would store a prefix sum of line lengths to
# a sidechannel and then use that to do a bsearch; on the GPU,
# you'd do a sum tree / histopyramid as a preprocessing step
def find_point(points, d):
d = d
for i in range(1, len(points)):
x0,y0 = points[i-1]
x1,y1 = points[i]
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active June 25, 2024 20:13
Hyperlinks in Terminal Emulators
@daurnimator
daurnimator / ieee754.lua
Last active July 2, 2022 15:32
Reading IEEE-754 floating point numbers in Lua
--[[
A short module to read binary floating point numbers for lua.
]]
local has_ffi , ffi = pcall ( require , "ffi" )
local has_bit , bit = pcall ( require , "bit" )
local read_float , read_double
if has_ffi and has_bit then
local cast = ffi.cast
anonymous
anonymous / fish.py
Created August 30, 2013 17:41
><> python interpreter.
#!/usr/local/bin/python3.2
"""
Python interpreter for the esoteric language ><> (pronounced /ˈfɪʃ/).
Usage: ./fish.py --help
More information: http://esolangs.org/wiki/Fish
Requires python 2.7/3.2 or higher.
@KartikTalwar
KartikTalwar / tiny.c
Created July 12, 2012 04:37
Tiny-C Compiler
/* file: "tinyc.c" */
/* Copyright (C) 2001 by Marc Feeley, All Rights Reserved. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* This is a compiler for the Tiny-C language. Tiny-C is a