Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🎛

Lionel RADISSON MAKIO135

💭
🎛
View GitHub Profile
@MAKIO135
MAKIO135 / In_C.rb
Created Jun 25, 2019
SonicPi In C
View In_C.rb
# Discovered In C a few years ago thanks to Tero Parviainen (@teropa) 's great article: Terry Riley's "In C", A Journey Through a Musical Possibility Space
# http://teropa.info/blog/2017/01/23/terry-rileys-in-c.html
# Here is a Sonic Pi version with 3 synths and 1 smaple, based on Jim Bumgardner's Chuck implementation.
# http://electro-music.com/forum/viewtopic.php?t=14237&sid=dbb3ada88a20169e90ee4ce45d79f10
# A generated result can be heard here: https://soundcloud.com/makio135/sonic-pi-in-c
use_debug false
@MAKIO135
MAKIO135 / kniwwelino_SerialMatrix.ino
Last active Jun 19, 2019
Update Kniwwelino board leds matrix using Serial
View kniwwelino_SerialMatrix.ino
// Update Kniwwelino board leds matrix using Serial
// https://doku.kniwwelino.lu/en/reference/matrixwhen sending data
#include <Kniwwelino.h>
String inputString = "";
void setup() {
Kniwwelino.begin("yo", false, true, false); // Wifi=false, Fastboot=true, MQTT logging false
inputString.reserve(26);
View HexGrid.js
class HexGrid {
constructor(firstX, firstY, sizeX, sizeY, hexSize, type) {
// type can be either 'flat' or 'pointy'
type = type === 'flat' || type === 'pointy' ? type : 'flat'
this.width = sizeX
this.height = sizeY
let h = Math.sqrt(3) * hexSize
let w = 2 * hexSize
if(type === 'pointy') [w, h] = [h, w] // swap
@MAKIO135
MAKIO135 / fullscreen.js
Created Mar 27, 2019
utilities for toggling fullscreen
View fullscreen.js
// https://stackoverflow.com/a/23971798
window.addEventListener('click', () => {
toggleFullScreen()
})
function isFullScreen() {
return (document.fullScreenElement && document.fullScreenElement !== null)
|| document.mozFullScreen
|| document.webkitIsFullScreen
}
@MAKIO135
MAKIO135 / LPD8Template.js
Last active Mar 27, 2019
canvas-sketch x akai-lpd8
View LPD8Template.js
const canvasSketch = require('canvas-sketch')
const p5 = require('p5')
const LPD8 = require('akai-lpd8')
new p5()
const settings = {
dimensions: [600, 600],
p5: true,
animate: true
@MAKIO135
MAKIO135 / array.prototype.count.js
Last active Dec 4, 2018
JS snippet to get the number of occurence in an array
View array.prototype.count.js
Array.prototype.count = function( n ) {
return this.filter( d => d === n ).length;
}
View notes_midi_freq.csv
Note Midi Frequency
C1 0 8.1757989156
Db1 1 8.6619572180
D1 2 9.1770239974
Eb1 3 9.7227182413
E1 4 10.3008611535
F1 5 10.9133822323
Gb1 6 11.5623257097
G1 7 12.2498573744
Ab1 8 12.9782717994
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Hello WebMIDI</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
@MAKIO135
MAKIO135 / gif.worker.js
Created Sep 18, 2018
beesandbombs template JS
View gif.worker.js
// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var NeuQuant=require("./TypedNeuQuant.js");var LZWEncoder=require("./LZWEncoder.js");function ByteArray(){this.page=-1;this.pages=[];this.newPage()}ByteArray.pageSize=4096;ByteArray.charMap={};for(var i=0;i<256;i++)ByteArray.charMap[i]=String.fromCharCode(i);ByteArray.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ByteArray.pageSize);this.cursor=0};ByteArray.prototype.getData=function(){var rv="";for(var p=0;p<this.pages.length;p++){for(var i=0;i<ByteArray.p
View flatten.js
// https://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays-in-javascript/39000004#39000004
const flatten = function(arr, result = []) {
for (let i = 0, length = arr.length; i < length; i++) {
const value = arr[i];
if (Array.isArray(value)) {
flatten(value, result);
} else {
result.push(value);
}