Skip to content

Instantly share code, notes, and snippets.

View acarabott's full-sized avatar

Arthur Carabott acarabott

View GitHub Profile
@acarabott
acarabott / beatShifter.js
Created December 27, 2013 02:12
Logic Pro X Scripter MIDI FX that pitch shifts notes played in beats 1 and 3 of the bar
var shift = 0;
NeedsTimingInfo = true;
function HandleMIDI(event) {
event.pitch += shift;
event.send();
}
function ProcessMIDI () {
@acarabott
acarabott / chordNoteShifter.js
Last active January 1, 2016 11:59
Logic Pro X Scripter MIDI FX that that shifts the top or bottom note of a chord up or down by 1 or 2 octaves, with parametric controls.
NeedsTimingInfo = true;
var start = Date.now(),
triggered = false,
prev;
var PluginParameters = [
{
name: "Window Length",
defaultValue: 80,
@acarabott
acarabott / username.conf
Created January 12, 2014 12:15
OS X apache conf to allow symbolic links in Sites folder /etc/apache2/users/username.conf
<Directory "/Users/username/Sites/">
# Options Indexes MultiViews
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
@acarabott
acarabott / buildAndRun.sh
Last active October 12, 2016 20:50
openFrameworks Sublime Text Build
#!/bin/bash
# This lives in your project directory, alongside src/, bin/, config.make, etc
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
make Debug && make RunDebug;
@acarabott
acarabott / ofApp.cpp
Created April 23, 2014 12:26
get value from ofxUIIntSlider guiEvent
void ofApp::setup(){
myValue = 5;
gui->addIntSlider("MY_INT_SLIDER", 0, 10, myValue);
}
void ofApp::guiEvent(ofxUIEventArgs &e)
{
if (e.getName() == "MY_INT_SLIDER")
{
// the trick is in the cast....
@acarabott
acarabott / .bash_profile
Created May 30, 2014 05:58
running GUI apps on a remote machine's own display, e.g. for an openFrameworks installation
DISPLAY=":0"
export DISPLAY
@acarabott
acarabott / plugin.py
Created November 1, 2014 19:56
Sublime Text 3 API, check if view scroll position is at bottom
# useful for implementing output view auto scrolling, only when at the bottom
def view_is_at_bottom(view):
layout_h = view.layout_extent()[1]
view_h = view.viewport_extent()[1]
view_y = view.viewport_position()[1]
line_h = view.line_height()
view_taller_than_content = layout_h <= view_h
at_bottom_of_content = view_y + view_h >= layout_h - line_h
@acarabott
acarabott / extract_stills.sh
Last active August 29, 2015 14:13
ffmpeg - extract stills
# -i input file
# -r frames per second to extract
# -ss start time HH:MM:SS
# -t duration to extract in seconds
# -s image format (see below)
# output file format where %d will be the image number
ffmpeg -i video.mp4 -r 25 -ss 00:01:22 -t 7 -s hd1080 output-%d.png
# Image formats
# -------------
@acarabott
acarabott / opencv-mouse-callback-lambda.cpp
Last active January 17, 2017 18:06
opencv mouse callback with c++11 lambda and capture
/*
if you don't need to do any captures you can just do
cv::setMouseCallback("win", [] (int event, int x, int y, int flags, void*userdata) {
std::cout << "mouse action!" << std::endl;
});
but if you need to do any captures, then you'll need to do this crap.
If you know of a better way then fork away...
*/
@acarabott
acarabott / opencv-trackbar-lambda.cpp
Last active December 19, 2020 17:25
using c++11 lambdas with opencv 3 trackbar callbacks
#include <functional>
using TrackbarAction = std::function<void(int)>;
cv::namedWindow("win");
cv::TrackbarCallback trackbarCallback = [] (int pos, void* userdata) {
(*(TrackbarAction*)userdata)(pos);
};