Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@echo off
set PORT=8080
:findport
netstat -ano | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1
if %errorlevel%==0 (
set /a PORT+=1
goto findport
)
@n1ckfg
n1ckfg / float_to_int.py
Created November 26, 2025 17:53
Float to int converter methods
def float_to_int(float_value, num_places):
multiplier = 10 ** num_places
return int(round(float_value * multiplier))
def int_to_float(int_value, num_places):
divisor = 10 ** num_places
return int_value / divisor
@n1ckfg
n1ckfg / nouns.md
Created July 10, 2025 18:23 — forked from trag1c/nouns.md
A list of nouns in the English language (40,940 entries)

Based on the WordNet corpus, omitting results containing:

  • slashes (e.g. lo/ovral)
  • spaces (e.g. living_thing)
  • digits (e.g. 1900s)

Generated with the following Python script using NLTK:

from pathlib import Path

from nltk.corpus import wordnet
@n1ckfg
n1ckfg / w3.sh
Created February 19, 2025 04:36
Fujifilm W3 converter methods
function w3-sbs() {
ffmpeg -i $1 -filter_complex "[0:0][0:2] hstack=inputs=2 [out]" -aspect 1.7777 -vcodec libx264 -x264opts frame-packing=3 -map [out] -map 0:1 "$1.mp4"
}
function w3-lr() {
ffmpeg -i $1 -c:v libx264 -crf 19 -preset slow -an -map 0:0 "$1_L.mp4" -crf 19 -preset slow -map 0:2 -map 0:1 "$1_R.mp4"
}
@n1ckfg
n1ckfg / complex.glsl
Created September 22, 2024 18:56 — forked from DonKarlssonSan/complex.glsl
Complex Number Math In GLSL
// Hyperboloc functions by toneburst from
// https://machinesdontcare.wordpress.com/2008/03/10/glsl-cosh-sinh-tanh/
// These are missing in GLSL 1.10 and 1.20, uncomment if you need them
/*
/// COSH Function (Hyperbolic Cosine)
float cosh(float val)
{
float tmp = exp(val);
float cosH = (tmp + 1.0 / tmp) / 2.0;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0
Nick Fox-Gieg / @n1ckfg / fox-gieg.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
await loadScript("https://unpkg.com/latk@1.0.3/latk.js")
p = new P5({mode: 'WEBGL'}) // loads p5js library, comment this line after using it once
p.hide() // hide p5js canvas.
currentFrame = 0
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: black;
}
</style>
<script src="https://unpkg.com/p5@1.9.1/lib/p5.min.js"></script>
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0
Nick Fox-Gieg / @n1ckfg / fox-gieg.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
p = new P5({width: 500, height: 500, mode: 'WEBGL'}) // loads p5js library, comment this line after using it once
p.hide() // hide p5js canvas.
polylines = []
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0
Nick Fox-Gieg / @n1ckfg / fox-gieg.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
p = new P5({mode: 'WEBGL'}) // loads p5js library, comment this line after using it once
p.hide() // hide p5js canvas.
rot = 0
rotDelta = 0