Skip to content

Instantly share code, notes, and snippets.

@aferriss
aferriss / filterExample.js
Created May 30, 2018 22:08
How to use wrap and filter funcs
let canvas;
let img;
function preload(){
img = loadImage("img.jpg");
}
function setup() {
// shaders require WEBGL mode to work
canvas = createCanvas(windowWidth, windowHeight, WEBGL);
@aferriss
aferriss / installDlib
Created May 11, 2018 20:51
Install dlib ubuntu
wget http://dlib.net/files/dlib-19.6.tar.bz2
tar xvf dlib-19.6.tar.bz2
cd dlib-19.6/
mkdir build
cd build
cmake ..
cmake --build . --config Release
sudo make install
sudo ldconfig
cd ..
@aferriss
aferriss / Save.cpp
Created April 28, 2018 16:14
Save image
ofFbo fbo;
ofShader shader;
void setup(){
fbo.allocate(w, h, GL_RGBA);
shader.load("shader");
}
void update(){
if (save ){
@aferriss
aferriss / index.html
Created April 11, 2018 00:26
HTML Boiler Plate
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your Title Here</title>
</head>
<body>
Your content here
</body>
</html>
@aferriss
aferriss / countdown.expression
Created March 23, 2018 20:41
Countdown timer expression in AE in minutes and secs
rate = -1;
clockStart = 420; // num seconds
function padZero(n){
if (n < 10) return "0" + n else return "" + n
}
clockTime = Math.max(clockStart + rate*(time - inPoint),0);
t = Math.floor(clockTime);
@aferriss
aferriss / smooth.mm
Created September 6, 2017 00:43
Smooth points in openframeworks
static float smooth_dist = 0.0;
vector<ofVec2f> DrawLook::smoothPoints(ofVec2f p, ofVec2f lp, ofVec2f llp, float size){
vector<ofVec2f> points;
float step = MAX(size / 4, 1.0);
ofVec2f mp1 = lp;
mp1.middle(llp);
ofVec2f mp2 = p;
@aferriss
aferriss / pad.sh
Last active July 12, 2017 21:12
Batch Rename with Padded Zeros
#just run from current directory
# will rename all files to 00001.jpg 00002.jpg etc.
ls | cat -n | while read n f; do mv "$f" `printf "%05d.jpg" $n`; done
@aferriss
aferriss / levels.glsl
Created April 26, 2017 23:20
GLSL Photoshop Style Levels Adjustment
vec3 gammaCorrect(vec3 color, float gamma){
return pow(color, vec3(1.0/gamma));
}
vec3 levelRange(vec3 color, float minInput, float maxInput){
return min(max(color - vec3(minInput), vec3(0.0)) / (vec3(maxInput) - vec3(minInput)), vec3(1.0));
}
vec3 finalLevels(vec3 color, float minInput, float gamma, float maxInput){
return gammaCorrect(levelRange(color, minInput, maxInput), gamma);
@aferriss
aferriss / proxy.php
Created April 16, 2017 04:45
cors proxy
<?php
// Get the url of to be proxied
// Is it a POST or a GET?
$url = ($_POST['url']) ? $_POST['url'] : $_GET['url'];
$headers = ($_POST['headers']) ? $_POST['headers'] : $_GET['headers'];
$mimeType =($_POST['mimeType']) ? $_POST['mimeType'] : $_GET['mimeType'];
//Start the Curl session
$session = curl_init($url);
@aferriss
aferriss / masterCat.sh
Last active April 20, 2016 20:22
Cat all text to one file
ls -tr | xargs -I{} cat {} > ../allI.txt