Skip to content

Instantly share code, notes, and snippets.


Mike Tahani miketahani

View GitHub Profile
miketahani / convert-mp4-to-gif.mkd
Created Mar 30, 2021 — forked from tomnomnom/convert-mp4-to-gif.mkd
Crop an mp4 and convert it to a gif
View convert-mp4-to-gif.mkd

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



ffmpeg -i in.mp4 -filter:v "crop=900:700:0:50" out.mp4

convert mp4 to gif

$ ffmpeg -ss 61.0 -t 2.5 -i input.mp4 -filter_complex "[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse" output.gif

  • -ss 61.0: start gif at 61.0 seconds into video
  • -t 2.5: gif duration of 2.5 seconds (starting at 61.0 seconds into video)

crop existing gif

convert input.gif -coalesce -repage 0x0 -crop 343x310+0+65 +repage output.gif

miketahani / DrawInstances.frag
Last active Dec 17, 2020 — forked from mantissa/DrawInstances.frag
Drawing instanced meshes using matrices contained in textures (OpenFrameworks)
View DrawInstances.frag
#version 120
#extension GL_EXT_gpu_shader4 : require
void main(){
gl_FragColor = gl_Color;
miketahani /
Created Dec 12, 2020 — forked from patriciogonzalezvivo/
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();
miketahani / motion_vector.c
Created Sep 20, 2020 — forked from w495/motion_vector.c
Пример построения векторов движения с помощью libav. Выводит координаты точек и векторов на stdout. Проверялось на коротких mp4 (h264 / aac). Начальный вариант был взят тут: и переписан под современный ffmpeg.
View motion_vector.c
* Calculates motion vector using ffmpeg and libavcodec.
* @authors First modifications by Victor Hsieh.
* Second modifications by Jiasi Chen.
* Third modifications by Ilya Nikitin <>.
* @date: 2014.05.10 23:30:13
miketahani /
Created Aug 11, 2020
Raspberry Pi 4 with external boot SSD

Raspberry Pi 4 setup

For barebones initial setup of a Pi to boot from an external, USB-connected SSD.

Follow instructions in this tutorial, reproduced below:

  1. Flash SD card using Raspberry Pi Imager

  2. touch /Volumes/<volume>/ssh to enable SSH on boot

miketahani /
Created May 26, 2020 — forked from willurd/
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
View singlePageReact.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>single page react boilerplate</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="kokaneka">
View convertLatLngToSphere.js
const radians = deg => deg * Math.PI / 180
// @param {Number} z Offset from radius
export default function convertLatLngToSphere (lat, lng, baseRadius, z) {
// radians
const phi = radians(lat)
const theta = radians(lng - 180)
const radius = baseRadius + z