Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jellea on github.
  • I am jelle (https://keybase.io/jelle) on keybase.
  • I have a public key ASCCbfx5XywLwcsDKNvAOgV7-zfJKRe923odcGVwyE_0pwo

To claim this, I am signing this object:

@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
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
|}];
@jellea
jellea / core.clj
Created October 31, 2016 23:13
Lastpass csv to Keepass xml converter
(ns last2kee.core
(:require [clojure.set :as set]
[clojure.data.csv :as csv]
[clojure.data.xml :as xml]
[clojure.string :as string]
[clojure.java.io :as io]))
(defn csvvec-to-map [csvdata]
(map #(zipmap (first csvdata) %) (rest csvdata)))
@jellea
jellea / fifo-map.cljs
Created September 16, 2016 10:46
You have a map and want to prune the oldest values (fifo) on add.
(defn assoc-ordered
[[m v :as mv] k value]
[(assoc m k value)
(if (get m k)
(->
(remove #{k} v)
vec
(conj k))
(conj (or v []) k))])
// inslude the SPI library:
#include <SPI.h>
#include "Pixi.h" // dependency: https://github.com/wolfgangfriedrich/Pixi_demo
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiUdp.h>
#include <OSCMessage.h> // dependency: https://github.com/CNMAT/OSC
#include <OSCBundle.h>
#include <OSCData.h>
@jellea
jellea / init.lua
Created June 6, 2016 07:58
Nodemcu connecting with max113300
pin = 8;
gpio.mode(pin,gpio.OUTPUT);
gpio.write(pin,gpio.HIGH);
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0,spi.FULLDUPLEX);
gpio.write(pin,gpio.LOW);
function readRegister(address)
gpio.write(pin,gpio.HIGH);
gpio.write(pin,gpio.LOW);
spi.send(1, bit.lshift(0x01, address));
@jellea
jellea / ofApp.cpp
Created May 21, 2016 15:37
Small testing env with MLP (GRT) and Openframeworks
#include "ofApp.h"
bool learning = false;
bool training = false;
bool running = false;
int selectedClass = 1;
int numInputs = 6;
@jellea
jellea / keybase.md
Last active February 5, 2016 16:35

Keybase proof

I hereby claim:

  • I am jellea on github.
  • I am jelle (https://keybase.io/jelle) on keybase.
  • I have a public key ASAxoAkXEHFrdx4IzDC-DAO5Tcx3-asO-HhIT5pwLzTPtgo

To claim this, I am signing this object:

@jellea
jellea / 1-protocols.cljs
Last active February 3, 2016 10:54
Minimal Redux implementation in clojurescript. Two versions.
(def initial-state {:counter 0})
(defonce !state (r/atom initial-state))
(defonce !actions (atom []))
(defprotocol Action
(reducer [action state]))
(defn dispatch! [action]