Skip to content

Instantly share code, notes, and snippets.

@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;
@n1ckfg
n1ckfg / JetsonNanoTensorFlowBuildGPU.md
Created April 16, 2024 19:15 — forked from sdeoras/JetsonNanoTensorFlowBuildGPU.md
Building TensorFlow C-library for Nvidia Jetson Nano

Steps to build TensorFlow v1.12.0 C-library on Jetson Nano for GPU

Jetson Nano configuration

  • ARM 64 (aarch64)
  • gcc 7.3
  • cuda 10
  • cudnn 7

TensorFlow configuration

  • v1.12.0
@n1ckfg
n1ckfg / camera.py
Created April 15, 2024 16:00 — forked from pghazanfari/camera.py
numpy Perspective Projection + Look At Matrices
import numpy as np
def perspective_fov(fov, aspect_ratio, near_plane, far_plane):
num = 1.0 / np.tan(fov / 2.0)
num9 = num / aspect_ratio
return np.array([
[num9, 0.0, 0.0, 0.0],
[0.0, num, 0.0, 0.0],
[0.0, 0.0, far_plane / (near_plane - far_plane), -1.0],
[0.0, 0.0, (near_plane * far_plane) / (near_plane - far_plane), 0.0]
@n1ckfg
n1ckfg / cuda_11.3_installation_on_Ubuntu_20.04
Created October 3, 2023 16:04 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.3 and cuDNN 8.2 installation on Ubuntu 20.04 for PyTorch 1.11
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@n1ckfg
n1ckfg / resizeNN_old.js
Last active June 7, 2023 01:55 — forked from gncgnc/resizeNN.js
Extends p5.Image to handle nearest neighbor resizing for scaling small images (e.g. pixel art) without blurring. You can also make regular images into pixelated images by shrinking then growing them with this method (a la MS Paint.)
/**
* Resize the image to a new width and height using nearest neigbor algorithm. To make the image scale
* proportionally, use 0 as the value for the wide or high parameter.
* For instance, to make the width of an image 150 pixels, and change
* the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes the "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize. Any suggestions for performance increase are welcome.
*/
@n1ckfg
n1ckfg / resizeNN.js
Created June 6, 2023 18:11 — forked from GoToLoop/resizeNN.js
Extends p5.Image to handle nearest neighbor resizing for scaling images w/o blurring.
/**
* Resize the image to a new width and height using nearest neighbor algorithm.
* To make the image scale proportionally,
* use 0 as the value for the wide or high parameters.
* For instance, to make the width of an image 150 pixels,
* and change the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize.
@n1ckfg
n1ckfg / bookmarklet.js
Created November 23, 2022 21:53 — forked from bramus/bookmarklet.md
Mastodon User Page Bookmarklet
javascript:(function(){
const MY_MASTO_LOCAL_DOMAIN = 'front-end.social'; /* 👈 Change this value */
const MY_MASTO_WEB_DOMAIN = MY_MASTO_LOCAL_DOMAIN; /* 👈 Only change this value if your Masto host is hosted an different domain than the LOCAL_DOMAIN */
function tryAndGetUserName() {
/* Profile with a moved banner (e.g. https://mastodon.social/@bramus): follow that link */
const userNewProfile = document.querySelector('.moved-account-banner .button')?.getAttribute('href');
if (userNewProfile) {
return userNewProfile.substring(2);
}
@n1ckfg
n1ckfg / encoding-video.md
Created February 13, 2022 02:14 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@n1ckfg
n1ckfg / code-toolkit-2021-welcome.js
Last active December 29, 2021 22:16 — forked from rors/code-toolkit-2021-welcome.py
Homepage image for "Code Toolkit: Python", Fall 2021
let heights = [];
let moving_heights = [];
let r = 0;
function setup() {
createCanvas(800, 400, WEBGL);
for (let i=0; i<17; i++) {
heights.push([]);
moving_heights.push([]);
for (let j=0; j<17; j++) {
@n1ckfg
n1ckfg / map.glsl
Created December 8, 2021 05:12 — forked from companje/map.glsl
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}