Skip to content

Instantly share code, notes, and snippets.

View postspectacular's full-sized avatar
🎉
Celebrating 24 years of building open source tools

Karsten Schmidt postspectacular

🎉
Celebrating 24 years of building open source tools
View GitHub Profile
@AssortedFantasy
AssortedFantasy / ndarray.zig
Last active November 26, 2021 20:59
A minimal implementation of higher dimensional slices in Zig.
// Multi Dimensional Slices in Zig
// Sort of akin to ndarrays in Python's numpy
const std = @import("std");
const runtime_safety = std.debug.runtime_safety;
const mem = std.mem;
const NDSliceErrors = error{
InsufficientBufferSize,
ZeroLengthDimensionsNotSupported,
@memononen
memononen / biasgaininf.c
Last active February 2, 2022 10:09
bias gain inflection point
float evalCurve(float x, float tx, float ty, float sa, float sb)
{
const float EPS = 1e-6f;
if (x < tx) {
return (ty * x) / (x + sa * (tx - x) + EPS);
} else {
return ((1-ty) * (x-1)) / ((1-x) - sb * (tx - x) + EPS) + 1.0f;
}
}
@eltonjothi
eltonjothi / Payload.json
Last active February 17, 2024 14:03
AWS Serverless Image Handler - Custom Watermark
{
"bucket":"bucketname",
"key":"image-key",
"edits":{
"resize":{
"height":720,
"fit":"inside"
},
"txtWatermark":{
"options":{
@onlurking
onlurking / programming-as-theory-building.md
Last active March 16, 2024 00:01
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@IanColdwater
IanColdwater / twittermute.txt
Last active March 6, 2024 18:49
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@bellbind
bellbind / build.zig
Last active August 8, 2022 04:29
[zig][WebAssembly][c11] FFT
// build all: $ zig build
// clean up: $ zig build dist-clean
const builtin = @import("builtin"); // list-up the content with `zig builtin` command
const Builder = @import("std").build.Builder;
//NOTE: this build code is for zig-0.4.0, maybe incompatible with zig >= 0.5
pub fn build(b: *Builder) void {
{ //[case: WebAssembly wasm] build fft.wasm
const wasmStep = b.step("fft.wasm", "build fft.wasm");
const wasm = b.addExecutable("fft.wasm", "fft.zig");
@kajott
kajott / bluenoise.c
Created June 26, 2019 10:49
Blue Noise texture generation using the void-and-cluster algorithm
#if 0 // self-compiling code
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -O4 -march=native $0 -lm || exit 1
exec time ./a.out
#endif
// Blue Noise texture generation using the void-and-cluster algorithm
// implemented by Martin Fiedler <keyj@emphy.de>
// using an algorithm description written by Alan Wolfe:
// https://blog.demofox.org/2019/06/25/generating-blue-noise-textures-with-void-and-cluster/
;; see also https://twitter.com/thing_umbrella/status/1111427898487898113
(require '[clojure.spec.alpha :as s])
;; spec that ensures the keys in renames match the keys in map
(s/def ::rename-keys-args
(s/and (s/cat :map map? :renames map?)
(fn [{:keys [map renames]}]
(every? map (keys renames)))))
;; ok
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active December 20, 2023 16:50
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@spacechase0
spacechase0 / NodeGraph.cpp
Last active October 30, 2022 09:53
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{