Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
kylemcdonald / beat-detect-osc.cpp
Last active April 15, 2017 10:43
ofxAubio beat detector sent over OSC.
// Example settings.xml:
//
// {
// "destination": "localhost",
// "port": 9090,
// "device": 2
// }
#include "ofMain.h"
#include "ofEventUtils.h"
@kylemcdonald
kylemcdonald / jc_voronoi.h
Last active April 15, 2017 10:43
C++ app for Voronoi relaxation of CSV points using https://github.com/JCash/voronoi
/*
ABOUT:
A fast single file 2D voronoi diagram generator.
HISTORY:
0.2 2016-12-30 - Fixed issue of edges not being closed properly
- Fixed issue when having many events
@rsodre
rsodre / transformToFit.h
Created March 23, 2017 14:27
Transform matrix to fit any rect into any other rect. For OpenFrameworks (or anything else, really)
#pragma once
#include "ofMain.h"
void transformToFit( ofRectangle src, ofRectangle dst, bool upscale=true ) {
// Scale
float scaleX = ( dst.width / src.width );
float scaleY = ( dst.height / src.height );
float sc = ( scaleX < scaleY ? scaleX : scaleY );
if ( ! upscale )
sc = ofClamp( sc, 0.0f, 1.0f );
// Position (scaled)
@jellea
jellea / init.lua
Last active February 15, 2017 19:47
Go to bed! Fade out computer screen from 22:00 to 23:00. Hammerspoon
function brightnessDown ()
lct = hs.timer.localTime()
tt = 60*60*22 -- 22:00
if lct > tt then
wish = 100-math.ceil((lct % tt) / (60*60) * 100) -- time after
if hs.brightness.get() > wish then
hs.brightness.set(wish)
end
end
end
@kylemcdonald
kylemcdonald / archive-to-grid.cpp
Last active April 15, 2017 10:44
Given an archive of images (filenames.csv) and a set of positions for those images (assignments-i.tsv) render a grid. Saves the image to disk when done loading all the images.
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
int side = 32;
int imagesPerFrame = 100;
string baseDir = "/Users/kyle/Documents/TeenieHarris/Teenie_Harris_JPG640/";
string renderOutput = "render.png";
int nx = 277;
@kylemcdonald
kylemcdonald / BluetoothRSSI.m
Created December 14, 2016 21:28
Small command line tool for displaying real time Bluetooth signal strength on a Mac.
// gcc -Wall -o BluetoothRSSI BluetoothRSSI.m -framework Foundation -framework IOBluetooth ; ./BluetoothRSSI
#import <Foundation/Foundation.h>
#import <IOBluetooth/IOBluetooth.h>
int width = 32; // display width in characters
int refresh = 33; // refresh rate milliseconds
int main(int argc, const char * argv[]) {
@autoreleasepool {
open ReasonJs;
type uint8Array;
external int8Array : int => uint8Array = "window.Uint8Array" [@@bs.new];
external get : uint8Array => int => int = "" [@@bs.get_index];
[%%bs.raw{|
window.polyAudioContext = window.AudioContext || new window.webkitAudioContext
|}];
@danhett
danhett / contract.md
Last active July 6, 2020 17:57 — forked from brendandawes/Dawesome Design Contract.md
A contract for creative technologist/development services.

This is simple, clear and concise contract that I use for general creative and technical projects. It's based largely upon Brendan Dawe's excellent open-source design contract, but has been modified to contain more appropriate terminology for my field, and now contains sections pertaining to source code, ongoing support, NDA's etc.

Please feel free to fork, modify, distribute and use this document as you wish - and please please do use it. Do not start work without a contract, ever. Additionally: DO NOT START WORK WITHOUT A CONTRACT, EVER.

Agreement for commission of work between:

Dan Hett ("Developer", "me", "I")

and:

[CLIENT NAME] ("Client", "you")

@paniq
paniq / ecs.md
Last active May 27, 2023 10:34
Entity Component Systems
@sebleblanc
sebleblanc / Installing Flexget.md
Last active December 30, 2017 10:35
Installing flexget in a virtualenv

To avoid clashes with packages installed on your system, FlexGet can be installed in a Python virtualenv. A virtualenv is similar to a chroot, but specific to Python packages. Creating a virtualenv is a simple process. The virtualenv will contain its own Python interpreter and its own versions of downloaded dependencies, separate from the system's packages.

Creating a virtualenv is a standard procedure in a Python web application deployment.

Let's create a folder in which to create the virtualenv:

mkdir ~/virtualenv # or any name you prefer
cd ~/virtualenv

Now, create the virtualenv itself and make it relocatable. For some reason, we have to create a regular virtualenv before making it relocatable: