Skip to content

Instantly share code, notes, and snippets.

View velipso's full-sized avatar

Sean velipso

View GitHub Profile
@velipso
velipso / shadertoy.glsl
Last active February 13, 2025 21:24
ShaderToy Looking at closed eyelids
vec2 grad(ivec2 z) {
int n = z.x+z.y*11111;
n = (n<<13)^n;
n = (n*(n*n*15731+789221)+1376312589)>>16;
return vec2(cos(float(n)),sin(float(n)));
}
float noise(vec2 p, float seed) {
p += vec2(cos(seed * 123.456) * 123.456, sin(seed * 456.789) * 456.789);
ivec2 i = ivec2(floor(p));
@velipso
velipso / ZedSettings.md
Last active February 18, 2025 19:36
Zed settings to disable as many features as possible

I love zed, but boy do they like cramming in a bunch of annoying features.

There is still an open issue to fix the buggy auto-indent behavior.

Also, I can't get the damn thing to work with Makefiles, so I still use Sublime for that.

It's taken me a while to track down how to disable some of them, so here are my current settings:

{
function fish_prompt --description 'Write out the prompt'
set -l color_time
set -l color_cwd
set -l suffix
switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
@velipso
velipso / random-noise-color.html
Created March 5, 2020 02:23
Random noise color
<!doctype html>
<html lang="en">
<head><title>Random Noise Color</title></head>
<body style="background-color: #eef;">
<div id="ranges"></div>
<canvas width="2048" height="1200" style="width: 1024px; height: 600px;" id="cnv"></canvas>
<script>
var cnv = document.getElementById('cnv');
var ctx = cnv.getContext('2d');
@velipso
velipso / faster_atan2.c
Last active March 25, 2024 12:50
Faster atan2 algorithm (worse accuracy)
// public domain
//
// algorithm adopted from:
// https://dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization/
//
// when ran without arguments, it simply calculates the maximum error between
// the functions below and atan2f
//
// it tests all (x,y) values from -100.00 to +100.00
//
@velipso
velipso / sdl2_game_loop.c
Last active September 25, 2023 21:17
SDL2 game loop forcing a certain frame rate
//////////////////////////////////////////////////
//
// EDIT: Warning, this doesn't seem to work well.
//
//////////////////////////////////////////////////
@velipso
velipso / unknown_midi_data.txt
Created May 5, 2017 01:08
Unknown data inside MIDI file
If anyone can figure out what this data is, that would be greeeaaaat. Bytes represented in hex.
Found inside a MIDI file between tracks. Surely it's related to music somehow, like a sample..? Not sure.
I've inserted newlines after 99 and 89, which seem to be very common bytes.
29 40 30 99
26 5a 00 99
30 50 60 89
30 40 00 89
26 40 18 99
@velipso
velipso / to-gif.fish
Created January 18, 2017 20:35
Fish script to convert movies to GIFs using ffmpeg
#!/usr/local/bin/fish
# Usage:
# ./to-gif somefile.mp4 [more files]
#
# Converts to 'somefile.gif'
set palette /tmp/palette.png
# V--------V---- change these if you want :-)
set filters "fps=15,scale=320:-1:flags=lanczos"
@velipso
velipso / JavaScript's Object Model Sucks.md
Created December 3, 2016 05:36
Short explanation on why JavaScript's object model sucks

How do you convert an object to a string?

It started out simple enough:

var s = obj.toString();

Ooops. But wait. What if an object has a toString key inside of it?

@velipso
velipso / astar.js
Last active February 3, 2018 13:44
Single function that implements A-Star pathfinding algorithm in ~75 lines of code
// PUBLIC DOMAIN
//
// Single function that implements A-Star pathfinding algorithm in ~75 lines of code
//
// (why use a huge library..?)
//
// Parameters:
// solid array of booleans (of size width * height) that determine if a tile is solid
// width width of the map
// height height of the map