Skip to content

Instantly share code, notes, and snippets.

View tgcnzn's full-sized avatar

Tiago Canzian tgcnzn

View GitHub Profile
@tgcnzn
tgcnzn / three.js.shader.html
Created March 28, 2021 02:44 — forked from kylemcdonald/three.js.shader.html
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
@tgcnzn
tgcnzn / javascript aspect ratio calculation (with GCD)
Created January 19, 2018 02:11 — forked from phobeo/javascript aspect ratio calculation (with GCD)
javascript aspect ratio calculation algorithm (take the GCD and divide both elements of resolution)
/* euclidean GCD (feel free to use any other) */
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;}
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
/* eg:
> ratio(320,240)
"4:3"
> ratio(360,240)
@tgcnzn
tgcnzn / subsetsum
Last active November 23, 2017 21:14
/**
* Recursive approach
* Time complexity - O(2^n)
* Space complexity - O(n), take into account additional stack memory and memory for subsets
* https://github.com/olehch/subsetsum
*/
const arr = [17, 2, 8, 34, 4, 0.5, 42, 6, 3, 7, 15, 14, 9]
const sum = 20
let result = null
To list any process listening to the port 8080:
lsof -i:8080
To kill any process listening to the port 8080:
kill $(lsof -t -i:8080)
set mylist to {"Beats", "Brasil", "Dubstep/Grime", "Groove", "Jungle/DNB/Electronic", "Rap", "Reggae/Dub", "Trap", "Trip-Hop"}
set loc to choose folder "Choose Parent Folder Location"
tell application "iTunes"
set myPlaylists to every playlist
repeat with myPlaylist in myPlaylists
if mylist contains name of myPlaylist then
set playListName to name of myPlaylist
set myTracks to every track of myPlaylist
function base64ToBlob(data) {
var byteString = atob(data.split(',')[1]);
var mimeString = data.split(',')[0].split(':')[1].split(';')[0]
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
@tgcnzn
tgcnzn / ffmpeg-concat-audio-files.txt
Last active September 23, 2020 01:45
ffmpeg - concat multiple audio files with image into mp4
files.txt >>>
file '01.mp3'
file '02.mp3'
file '03.mp3'
file '04.mp3'
file '05.mp3'
file '06.mp3'
file '07.mp3'