Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/nawk -f
BEGIN {
FS="\t"
}
{
for (i in hash)
delete hash[i]
for (i = 1; i <= NF; i++) {
sep = index($i, ":")
key = substr($i, 1, sep - 1)
@aike
aike / YomodoroTimer.html
Last active August 29, 2015 14:03
Pomodoro technique timer using Yo notification
<!DOCTYPE html>
<html>
<!--
Yomodoro Timer
This program is licensed under the MIT License.
Copyright 2014, aike (Yo: AIKE1000)
-->
<head>
<meta charset="UTF-8">
<title>Yomodoro Timer</title>
@aike
aike / getUserMediaAudioMock.js
Created September 1, 2014 03:22
getUserMedia API mock for audio
// This program is licensed under the MIT License.
navigator.webkitGetUserMedia = function(opt, ok, ng) {
ok(null);
};
AudioContext.prototype.createMediaStreamSource = function() {
var osc = this.createOscillator();
osc.type = 'sine';
var gain = this.createGain();
gain.gain.value = 0.0;
osc.connect(gain);
@aike
aike / reveal_midi.js
Last active August 29, 2015 14:24
Reveal.js MIDI plugin - presentation remote paging via Web MIDI API
/*
* reveal_midi.js
* MIDI control plugin for reveal.js (http://lab.hakim.se/reveal-js)
* MIT licensed
*
* Copyright (C) 2015 aike, http://github.com/aike
*/
(function() {
var mode = 0; // 0: note_on:left, note_off:right
;; (permutations {1 2 3}) ;=> {{1 2 3} {1 3 2} {2 1 3} {2 3 1} {3 1 2} {3 2 1}}
;;
(define $permutations
(lambda [$list]
(match list (multiset integer)
{[<nil> [{{}}]]
[<cons $x <nil>> [{{x}}]]
[<cons $x <cons $y <nil>>> {{x y} {y x}}]
[_
[(foldr append {}
@aike
aike / detect-chord.egi
Last active September 17, 2018 19:49
(define $roots {| [0 "C"] [1 "C#"] [2 "D"] [3 "D#"] [4 "E"] [5 "F"] [6 "F#"] [7 "G"] [8 "G#"] [9 "A"] [10 "A#"] [11 "B"] |})
(define $detect-root
(lambda [$notes]
roots_(modulo (car (sort notes)) 12)))
(define $detect-chord
(lambda [$notes]
(match (sort notes) (multiset integer)
{[<cons $n <cons ,(+ n 4) <cons ,(+ n 7) <nil>>>> "Major"]
def bd1
n = 0
sample :loop_amen, start: 0.125 * n, finish: 0.125 * (n + 1)
sleep 0.5
end
def bd2
n = 1
sample :loop_amen, start: 0.125 * n, finish: 0.125 * (n + 1)
sleep 0.5
@aike
aike / ChibaCity.shader
Created October 5, 2018 18:26
Chiba City Skybox for Unity
Shader "Skybox/ChibaCity"
{
CGINCLUDE
struct appdata
{
float4 vertex : POSITION;
float3 texcoord : TEXCOORD0;
};
@aike
aike / mt_sequencer.nkp
Last active August 3, 2021 14:09
Mersenne Twister (MT19937) random number generation library in KONTAKT KSP
{==========================================
Mersenne Twister example
random sequencer multi script
==========================================}
on init
set_ui_height_px(200)
make_perfview
set_script_title("MT Sequencer")
@aike
aike / random_bench.nkp
Last active August 3, 2021 21:15
KSP random function benchmark / 10000 loop result: random() 827microsec, LCG 857microsec, MT 11498microsec
{==========================================
random function benchmark
==========================================}
on init
set_ui_height_px(120)
make_perfview
set_script_title("random function benchmark")
declare ui_label $label1(1, 1)