Skip to content

Instantly share code, notes, and snippets.

View Tremeschin's full-sized avatar
⚠️
Focusing on IRL Internship to Graduate! Less energy for GitHub

Gabriel Tremeschin Tremeschin

⚠️
Focusing on IRL Internship to Graduate! Less energy for GitHub
View GitHub Profile
@ad8e
ad8e / glfw_ship.cpp
Last active June 3, 2024 01:48
instructions to use skia and glfw together. (download, installation, first program). as of Sept 2023, Windows is broken but this is still sadly the best starting resource for skia on Windows too.
/* Note: this Google copyright notice only applies to the original file, which has large sections copy-pasted here. my changes are under CC0 (public domain).
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
The official instructions don't work well. These alternative instructions are intended to be the shortest path to get a minimal setup running.
@clungzta
clungzta / cv2_transparent_overlay.py
Created August 23, 2017 03:40
Function for overlaying transparent (PNG) images in python
import cv2
import numpy as np
def overlay_transparent(background_img, img_to_overlay_t, x, y, overlay_size=None):
"""
@brief Overlays a transparant PNG onto another image using CV2
@param background_img The background image
@param img_to_overlay_t The transparent image to overlay (has alpha channel)
@param x x location to place the top-left corner of our overlay
This work, excluding the Arch Linux logo, is made available under CC0: https://creativecommons.org/publicdomain/zero/1.0/
@agrafix
agrafix / FTT.h
Created June 15, 2016 15:54
C++ implementation of FFT
/**
* C++ implementation of FFT
*
* Source: http://paulbourke.net/miscellaneous/dft/
*/
#pragma once
/*
This computes an in-place complex-to-complex FFT
@kylemcdonald
kylemcdonald / ffmpeg_load_audio.py
Last active June 6, 2023 03:06
Load audio from ffmpeg into Python using numpy.
import numpy as np
import subprocess as sp
import os
DEVNULL = open(os.devnull, 'w')
# load_audio can not detect the input type
def ffmpeg_load_audio(filename, sr=44100, mono=False, normalize=True, in_type=np.int16, out_type=np.float32):
channels = 1 if mono else 2
format_strings = {
np.float64: 'f64le',
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active July 5, 2024 10:29
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

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);
@positlabs
positlabs / Vignette.js
Created March 21, 2013 19:47
A simple canvas vignette
Vignette = function (canvas) {
var alpha = .7,
context,
visible,
data;
(function initView() {
context = canvas.getContext("2d");
@ganwell
ganwell / logspec.py
Created September 23, 2012 16:08
Pylab spectogram with log. frequency scale
import numpy
import scipy
import matplotlib.pyplot as pyplot
def decibel(lin):
"""Convert amplitude to decibel.
We might later need power to decibel..."""
return 20*numpy.log10(norm(lin))