Skip to content

Instantly share code, notes, and snippets.

@indefinit
indefinit / ffmpeg_cheat_sheet.sh
Last active May 29, 2022 12:45
A working cheat sheet for ffmpeg
#use case: converting image sequence to .mp4 video
#official documentation: https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
#description:
# An image sequence follows the pattern, defaultCanvas0-000000000.png (9 zeros)
# video codec is libx264
# pixel format yuv420p
# output file is named out.mp4
ffmpeg -i 'defaultCanvas0-%9d.png' -c:v libx264 -pix_fmt yuv420p out.mp4
#if you want your image sequence to start on a different number than index 0, use the -start_number parameter
@indefinit
indefinit / image_magick_cheatsheet.sh
Created January 20, 2016 17:03
A cheat sheet for working with imagemagick
#description: convert an image sequence to an animated gif, and resize to 500px x 500px, preserving aspect ratio
convert -delay 0 -loop 0 resize 500x500 defaultCanvas0-000000*.png animated-500.gif
@indefinit
indefinit / git-lfs-install.md
Created April 17, 2018 15:17
getting git lfs to work on raspberry pi
wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile
source ~/.profile #permanently add PATH to profile
go get github.com/github/git-lfs
cp gocode/bin/git-lfs /usr/bin #might have to run this command as sudo
@indefinit
indefinit / ShadersInOF.md
Last active April 6, 2018 01:17
Steps to follow for using shaders in OpenFrameworks v0.9.8

#General rules for working with shaders in OpenFrameworks

  1. in main.cpp, set the GL version to 3,2:
  ofGLWindowSettings settings;
	settings.setGLVersion(3,2);
	ofCreateWindow(settings);
  1. in ofApp.h, declare your shader member variable:
  ofShader shader;
@indefinit
indefinit / Ball.h
Created February 21, 2018 21:40
Example of a custom cpp class Ball with boolean methods
#include "ofApp.h" //include ofApp so you can use OF defined functions and vars
class Ball {
public:
Ball();//constructor
~Ball();//destructor
//current ball position, you'll need to initialize
//this somewhere in your constructor or another method
ofVec2f mBallPos;
bool checkIntersects(const ofVec2f &positionToCheck);
@indefinit
indefinit / OLA.md
Last active September 30, 2017 04:52
Random learnings from the project discovery phase

Learnings from working with Open Lighting Architecture for Mac OSX 10.9.5:

On compiling the OLA library from source

Getting the OLA c++ source, compiling it, and running the OLA daemon with Max/MSP to send pixel control data over E131.

  • I had a lot of initial trouble getting OLA to compile and run on my system. My goal was to eventually control LEDs with DMX/E131 protocol using Max or another client application (built in Openframeworks, Cinder, or Processing).
  • I found that my library compile problems were coming from Macports. The Official OLA documentation recommends installing with Macports but in practice Homebrew was a better option for me. Here is some info on Homebrew. http://brew.sh/ Once you have homebrew installed, you should be able to run the command brew install ola --universal in your terminal, which will install OLA to /usr/local/Cellar and symlink to /usr/local/lib directory. Sometimes homebrew installs the package but does not link it. You may have to run
@indefinit
indefinit / of-bundle-app.md
Last active September 20, 2017 20:54
Openframeworks: bundle app resources inside packaged contents

So you want to bundle your openframeworks app and not have to worry about that pesky "data/" directory... follow this stack overflow article:
http://stackoverflow.com/questions/4882572/how-to-bundle-an-openframeworks-application-in-xcode-relative-resource-linking

TLDR: First you need to tell xCode to copy your /bin/data directory into your application bundle by adding a build phase:

  1. Click on your project in the Project Navigator
  2. Select "Build Phases"
  3. Toggle open the "Run Script" section and paste in the following:
@indefinit
indefinit / tree-like-drawing.js
Created September 30, 2015 15:11
some ways of drawing tree like shapes in p5js. There is no right answer.
var branches = [];//holds a list of p5.Vectors
var trunkSize = 10.4;
var currentBranchLocL = null;
var currentBranchLocR = null;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
@indefinit
indefinit / ci-buffer-conversions.cpp
Last active May 5, 2017 21:57
Cinder: buffer data type conversions and processing
string bufferToString( const cinder::Buffer& buffer )
{
string s( static_cast<const char*>( buffer.getData() ) );
if ( s.length() > buffer.getDataSize() ) {
s.resize( buffer.getDataSize() );
}
return s;
}
uint8_t* bufferToUint8(const cinder::Buffer& buffer)
Sailboat.prototype = {
constructor: Sailboat,
sail : function(){
if(this.xpos > width)
{
this.xpos = -200;
this.ypos = random(height);
}
this.xpos = this.xpos + this.speed;
}