Skip to content

Instantly share code, notes, and snippets.

@billautomata
billautomata / ssh_tunnels.sh
Last active May 15, 2024 13:22
ssh port forwarding cheatsheet
# local port forwarding
# the target host 192.168.0.100 is running a service on port 8888
# and you want that service available on the localhost port 7777
ssh -L 7777:localhost:8888 user@192.168.0.100
# remote port forwarding
# you are running a service on localhost port 9999
# and you want that service available on the target host 192.168.0.100 port 12340
@billautomata
billautomata / convert_to_safe.py
Created December 12, 2022 06:59 — forked from zer0TF/convert_to_safe.py
Convert all CKPT files to SAFETENSOR files in a directory
# Got a bunch of .ckpt files to convert?
# Here's a handy script to take care of all that for you!
# Original .ckpt files are not touched!
# Make sure you have enough disk space! You are going to DOUBLE the size of your models folder!
#
# First, run:
# pip install torch torchsde==0.2.5 safetensors==0.2.5
#
# Place this file in the **SAME DIRECTORY** as all of your .ckpt files, open a command prompt for that folder, and run:
# python convert_to_safe.py
@billautomata
billautomata / frag.glsl
Created February 7, 2022 17:13 — forked from 983/frag.glsl
hsv rgb conversion glsl shader
// because http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl is often down
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
@billautomata
billautomata / GLSL-Noise.md
Created January 14, 2022 18:29 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@billautomata
billautomata / gist:6452daac265f06f17ed2
Created October 3, 2014 05:36
glsl 32 bit unpack and pack
vec4 pack (float depth)
{
const vec4 bitSh = vec4(256 * 256 * 256,
256 * 256,
256,
1.0);
const vec4 bitMsk = vec4(0,
1.0 / 256.0,
1.0 / 256.0,
1.0 / 256.0);
@billautomata
billautomata / iologo.svg
Last active January 30, 2021 07:48 — forked from fhinson/iologo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@billautomata
billautomata / ca.md
Created December 15, 2019 08:17 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@billautomata
billautomata / midi-computer-test.c
Created May 23, 2019 15:47
midi clock and 16th notes test program
unsigned long BPM = 120;
unsigned long PPQ = 24;
unsigned long PPQ_T;
unsigned long SECONDS_IN_MINUTE = 60;
unsigned long MICROSECONDS_PER_PPQ = (SECONDS_IN_MINUTE * 1000000) / (BPM * PPQ);
unsigned long _micros;
unsigned long MICROSECONDS_PER_STEP = (SECONDS_IN_MINUTE * 1000000) / (BPM * 4);
unsigned long STEP_T;
@billautomata
billautomata / example.js
Created August 28, 2018 01:46
dealing with callbacks
// nest them
var a = 0
var b = 0
fs.readFile('filename.txt', function(err,data){
a = data
fs.readFile('file2.txt', function(err,data){
b = data
console.log(a,b) // both values
@billautomata
billautomata / 1-1000.txt
Created November 24, 2016 23:19 — forked from deekayen/1-1000.txt
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that