Skip to content

Instantly share code, notes, and snippets.

@Lucrecious
Lucrecious / scale2x.gdshader
Created July 19, 2022 23:51
A Fast Rot-Sprite shader based on Scale3x
shader_type canvas_item;
const vec4 background = vec4(1., 1., 1., 0.);
float dist(vec4 c1, vec4 c2) {
return (c1 == c2) ? 0.0 : abs(c1.r - c2.r) + abs(c1.g - c2.g) + abs(c1.b - c2.b);
}
bool similar(vec4 c1, vec4 c2, vec4 input) {
return (c1 == c2 || (dist(c1, c2) <= dist(input, c2) && dist(c1, c2) <= dist(input, c1)));
@simon-liu
simon-liu / ensure-dir-exists.py
Last active September 3, 2021 08:31
python ensure dir exists
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists(d):
os.makedirs(d)
return os.path.exists(f)
@tedivm
tedivm / gist:4fe620bfca5afd89004e
Last active July 20, 2022 17:28
Ubuntu CUDA Installation Instructions

Ubuntu Cuda Install Instructions

Upgrade System

apt-get update 
apt-get dist-upgrade
reboot
@andrewgiessel
andrewgiessel / gist:4635563
Last active June 30, 2023 20:31
simple numpy based 2d gaussian function
import numpy as np
def makeGaussian(size, fwhm = 3, center=None):
""" Make a square gaussian kernel.
size is the length of a side of the square
fwhm is full-width-half-maximum, which
can be thought of as an effective radius.
"""