Skip to content

Instantly share code, notes, and snippets.

@aqiank
aqiank / combine-webcams.sh
Created July 12, 2016 12:52
ffmpeg muti-webcam stream to virtual webcam (provided by v4l2loopback)
#!/bin/sh
ffmpeg -re -i /dev/video0 -i /dev/video1 \
-filter_complex "
nullsrc=size=640x480 [base];
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];
[base][upperleft] overlay=shortest=1 [tmp1];
[tmp1][upperright] overlay=shortest=1:x=320, format=yuv420p
" -f v4l2 /dev/video2
@aqiank
aqiank / json-to-csv
Last active June 7, 2016 07:18
Simple JavaScript to convert JSON to CSV
function JSONToCSV(data) {
if (typeof(data) != 'object') {
if (typeof(data) != 'string') {
console.error('Error: data is not a JavaScript object or a string');
return null;
}
try {
data = JSON.parse(data);
} catch (error) {
@aqiank
aqiank / gist:efa6eefcc81157982acc
Last active March 9, 2019 15:43
SDL2 DropEvent minimal example
#include <SDL2/SDL.h>
int main() {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window *window = SDL_CreateWindow("Drag-and-Drop", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);
int running = 1;
while (running) {
SDL_Event event;
while (SDL_PollEvent(&event)) {