Skip to content

Instantly share code, notes, and snippets.

@sport4minus
sport4minus / P5_image_blur_demo.pde
Created May 17, 2012 10:34
Animated Processing Image Blur Demo
PImage myImage;
void setup() {
size(400,300);
myImage = loadImage("image.jpg");
}
void draw() {
@sport4minus
sport4minus / MIDI_Loader.pde
Created June 22, 2012 09:52
Convenient classes for loading and analyzing midi files in Processing / java, using the Sequence Object
class MidiLoader {
/**
*loads a midi file from disk and stores all notes in a nested Array List, using the Helper class "Note"
* needs some cleanup though
*/
ArrayList<ArrayList<Note>> tracks;
long maxTicks = 0;
final boolean DO_PRINT = false;
MidiLoader(String fileName) {
@sport4minus
sport4minus / load_sequence.pde
Created June 23, 2012 13:52
load image sequence in processing
/**
* this code snippet can be used in the processing environment to load all images in a folder
* "input" in the sketches' data folder into an array of PImages.
* ideally, the images are sequentially named, like 0001.jpg, 0002.jpg etc.
* in this demo, te images are sequentially displayed.
*/
PImage[] imageSequence;
String[] imageFilenames;
void setup() {
@sport4minus
sport4minus / actionscript 3 buildsystem
Created March 5, 2015 19:01
Sublime Text 2 Build System Actionscript 3 OSX fixed utf-8 decode error
{
"cmd": [
"/_path_/_to_/flex_sdk_4.6/bin/mxmlc",
"${file}"
],
"selector": "source.actionscript",
"encoding": "cp1252"
}
@sport4minus
sport4minus / crossfade-videos.js
Last active October 24, 2022 18:58
Crossfade two videos on Raspberry Pi /w omxplayer and node.js using omxplayer-controll
/*
crossfade-videos.js by github.com/sport4minus
test based on omxplayer-controll example by github.com/winstonwp
– crossfade two videos on raspberry pi using node.js, omxplayer-controll https://github.com/winstonwp/omxplayer-controll and omxplayer.
– working based on omxplayer's capability to set a video render layer.
– two instances of omxplayer are started on different layers, the upper ones' alpha is changed during runtime.
@sport4minus
sport4minus / deckset_collect.py
Last active January 22, 2017 09:51
Collect all assets used in a deckset presentation, and clone the original file into one with updated references.
#!/bin/python
# deckset_collect.py
# by jens wunderling
# this script collects all assets used in a deckset presentation into one folder and creates an updated .md file
# useful if you wildly use image files all over your local file system
# and for archiving (if online sources go offline)
# i'd like this to be a feature of the main app though :D
import os, argparse, shutil
@sport4minus
sport4minus / run-processing-sketch-from-commandline.md
Last active September 8, 2018 09:35
Run processing.org 3.x exported sketch from commandline

Run processing.org 3.x exported sketch from commandline

example under OSX:

if you have a sketch called Test.pde

  • navigate to application.macosx/Test.app/Contents/Java
  • then call the following line java -cp "*" Test
    -cp "*" makes all the jars in the directory available to java
    Testist the main class name, in Processing usually the name of the Sketch / Main .pde
@sport4minus
sport4minus / re-encode-txt-howto.md
Last active January 11, 2022 16:35
batch re-encode windows encoded .txt files to UTF-8 on the MacOS command line

Re-encode all .txt files in a directory from windows-1252 to utf-8 in place

  • using find and iconf commands on osx
  • replaces original files!
  • two-step process:
    • first store all paths to text files in a separate file
    • then do conversion based on each file path
    • why? find -exec with iconv was too hard to figure out on macOS

1:

@sport4minus
sport4minus / gist:18b17e19ce20cdc485e3ad43666f58a8
Created April 5, 2022 08:18
export git commit history to csv with dates cli
git log --since 2021-01-01 --until 2021-12-31 --reverse --pretty=format:"%s;%as" --date=iso > ../export-history.csv
@sport4minus
sport4minus / avconv-join-audio-video
Created December 19, 2022 19:27
join audio and video input files -> video with audio channel using libav / avconv
# join audio and video input files -> video with audio channel using libav / avconv
avconv -i in_video.mov -i in_audio.wav -vcodec copy -acodec mp3 -map 0:v:0 -map 1:0 out_audio_video.mov