Skip to content

Instantly share code, notes, and snippets.

View ofZach's full-sized avatar

ofZach

View GitHub Profile
// this code takes a src string,
// tries to fine multiline strings that are
// of the form
// var fs = ` .... ` or let vs = `....`
// and tries to compress them via
// glslx
// I found renaming hard to manage so this is set to not rename. (my approach is to rename myself to something small)
function compressShaders(src) {
// written by Golan Levin
// for example, huntForBlendFunc(1, -1, -1);
void huntForBlendFunc(float period, int defaultSid, int defaultDid){
// sets all possible (24) combinations of blend functions,
// changing modes every period seconds.
int sfact[] = {
GL_ZERO,
@ofZach
ofZach / download_flickr_image.py
Last active June 28, 2020 16:48 — forked from yunjey/download_flickr_image.py
downloading images from flickr using python-flickr
# First, you should install flickrapi
# pip install flickrapi
import flickrapi
import urllib
from PIL import Image
from urlparse import urlparse
# Flickr api access key
flickr=flickrapi.FlickrAPI('c6a2c45591d4973ff525042472446ca2', '202ffe6f387ce29b', cache=True)
@ofZach
ofZach / gist:d67d2ab2a0aa183b7d34f72263d5c5bd
Created November 27, 2017 07:44
looping 1d noise (tiling)
ofPolyline temp;
float ff = ofGetElapsedTimef();
for (int i = 0; i < 100; i++){
float angle = ofMap(i, 0, 100, 0, TWO_PI);
ofPoint pt= ofPoint(400,400);
float radius = 200 + ofSignedNoise(ff*0.1, cos(angle)*0.3, sin(angle)*0.3) * 100;
pt += radius * ofPoint(cos(angle), sin(angle));
temp.addVertex(pt);
}
temp.setClosed(true);
w/ speed up or slow down:
ffmpeg -i INPUT -crf 14 -vf "scale=640:640, setpts=1.0*PTS" -c:a copy -tune grain OUTPUT
(adjust crf for compression amount and 1.0*PTS for speed up / down)
w/out speed up:
ffmpeg -i INPUT -crf 14 -filter:v scale=640:640 -c:a copy -tune grain OUTPUT
@ofZach
ofZach / gist:e944f19b96f861693f1a035ddc588ef9
Created August 24, 2016 00:25
non openmp openmp like behavior
#include "ofApp.h"
#include <thread>
#include <algorithm>
#include <vector>
#include <iostream>
#include <functional>
using namespace std;
@ofZach
ofZach / gist:88abc3aed0462121279913e87401b19c
Last active July 26, 2016 17:56
many lines from wall to wall
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
}
//--------------------------------------------------------------
void ofApp::update(){
#include "ofApp.h"
ofEasyCam cam;
//--------------------------------------------------------------
void ofApp::setup(){
}
var data2 = [343.578,240.626,342.566,220.307,345.036,161.03,338.079,105.569,393.994,107.748,416.197,168.413,419.841,235.297,422.212,256.19,338.079,105.569,330.11,79.5909,327.501,57.3636,338.079,105.569,287.615,119.797,281.813,183.263,259.249,253.235,260.306,272.378,376.786,240.247,372.111,371.145,426.257,374.581,421.481,399.685,310.122,241.008,301.739,374.391,312.717,492.93,296.487,521.009,343.578,240.626,342.411,220.293,344.539,161.074,337.828,105.704,394.524,107.575,417.215,167.367,422.298,233.197,425.304,253.642,337.828,105.704,330.146,79.864,327.896,57.5828,337.828,105.704,285.889,119.952,275.74,186.252,250.698,259.567,250.541,280.528,376.903,239.885,365.776,377.178,420.797,379.866,415.67,405.612,309.985,241.373,305.77,371.795,319.224,487.056,303.411,514.733,343.578,240.626,342.24,220.299,344.025,161.137,337.563,105.835,394.637,107.671,417.483,166.985,423.492,232.079,426.906,252.231,337.563,105.835,329.905,80.0992,327.909,57.7585,337.563,105.835,284.891,119.763,271.838,187.734,244.93,262.94,243.623,285.
#include "ofApp.h"
vector < vector < float > > energies;
//--------------------------------------------------------------
void ofApp::setup(){