Skip to content

Instantly share code, notes, and snippets.

View miketahani's full-sized avatar

Mike Tahani miketahani

View GitHub Profile
/* post-fx pass by blending a solid white fullscreen quad, no texture required */
/*uniform*/ float fmin = 0.7;
void main(void)
{
float fmod = mod(gl_FragCoord.y, 2.0);
float fstep = fmin + (1.0 - fmin) * fmod;
gl_FragColor = vec4(1.0, 1.0, 1.0, fstep);
}
@miketahani
miketahani / convert-mp4-to-gif.mkd
Created March 30, 2021 06:56 — forked from tomnomnom/convert-mp4-to-gif.mkd
Crop an mp4 and convert it to a gif

Because I'll forget how to do this...

Crop

crop=w:h:x:y

ffmpeg -i in.mp4 -filter:v "crop=900:700:0:50" out.mp4
@miketahani
miketahani / DrawInstances.frag
Last active December 17, 2020 01:58 — forked from mantissa/DrawInstances.frag
Drawing instanced meshes using matrices contained in textures (OpenFrameworks)
#version 120
#extension GL_EXT_gpu_shader4 : require
void main(){
gl_FragColor = gl_Color;
}
@miketahani
miketahani / MakingGeometries.md
Created December 12, 2020 18:03 — forked from patriciogonzalezvivo/MakingGeometries.md
Creating Geometries in openFrameworks

Face by Face

void addFace(ofMesh& mesh, ofVec3f a, ofVec3f b, ofVec3f c) {
	ofVec3f normal = ((b - a).cross(c - a)).normalize();
	mesh.addNormal(normal);
	mesh.addVertex(a);
	mesh.addNormal(normal);
	mesh.addVertex(b);
	mesh.addNormal(normal);
@miketahani
miketahani / motion_vector.c
Created September 20, 2020 03:16 — forked from w495/motion_vector.c
Пример построения векторов движения с помощью libav. Выводит координаты точек и векторов на stdout. Проверялось на коротких mp4 (h264 / aac). Начальный вариант был взят тут: http://www.princeton.edu/~jiasic/cos435/motion_vector.c и переписан под современный ffmpeg.
/**
* MOTION_VECTOR
*
* Calculates motion vector using ffmpeg and libavcodec.
*
* @authors First modifications by Victor Hsieh.
* Second modifications by Jiasi Chen.
* Third modifications by Ilya Nikitin <w@w-495.ru>.
*
* @date: 2014.05.10 23:30:13
@miketahani
miketahani / web-servers.md
Created May 26, 2020 03:31 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
var p1={
x:0,
y:0
};
var p2={
x:0,
y:1
};
@miketahani
miketahani / tree.md
Created April 9, 2020 03:42 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@miketahani
miketahani / README.md
Created November 10, 2019 19:09 — forked from veltman/README.md
Flocking boids
@miketahani
miketahani / globalmaptiles.py
Created January 31, 2018 20:40 — forked from tucotuco/globalmaptiles.py
Classes to calculate Tile coordinates
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008
# Global Map Tiles Classes
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326,
# generate a simple HTML viewers based on Google Maps and OpenLayers
# Author: Klokan Petr Pridal, klokan at klokan dot cz
# Web: http://www.klokan.cz/projects/gdal2tiles/