View ttn publish
# -*- coding: utf-8 -*-
import paho.mqtt.client as mqtt
import time
import json
import base64
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
dev_eui = 'ZZZZZ'
// m:2-2=10 for scanning for URL frames (00 = UID, 20 = TLM)
BeaconParser eddystoneURLBeaconParser = new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-13,i:14-19");
//....(search for beacons with didRangeBeaconsInRegion() etc.)
String url = new String(beacon.getId1().toByteArray(), "UTF-8");
View gist:10524497
### Keybase proof
I hereby claim:
* I am dermatthias on github.
* I am dermatthias ( on keybase.
* I have a public key whose fingerprint is AC02 AA14 BA11 3F8D E75E 9D0A D870 E61F DA5A 94C4
To claim this, I am signing this object:
View otto - send to main thread
import android.os.Handler;
import android.os.Looper;
import com.squareup.otto.Bus;
public class MainThreadBus extends Bus {
private final Handler mainThread = new Handler(Looper.getMainLooper());
@Override public void post(final Object event) {
if (Looper.myLooper() == Looper.getMainLooper()) {
View appengine setup for clojure
(ns com.freiheit.clojure.appengine.appengine-local
[compojure.http routes servlet helpers]
[clojure.contrib def str-utils duck-streams])
[clojure.contrib.logging :as log])
[ LocalTaskQueue]
View pearson-fast.clj
(defn pearson-fast
[v1 v2]
(let [dim (double (count v1))
meanv1 (/ (areduce v1 i ret 0
(+ ret (aget v1 i))) dim)
meanv2 (/ (areduce v2 i ret 0
(+ ret (aget v2 i))) dim)
sum (areduce v1 i ret 0
(+ ret (* (- (aget v1 i) meanv1)
(- (aget v2 i) meanv2))))
View sweeeeeeeeeet! :)
(defn euclidean
"berechnet den (modifizierten) euklidischen abstand zwischen zwei usern"
[active other]
(Math/sqrt (reduce + (map (fn [movie]
(let [features (item-map movie)]
(reduce + (map (fn [feat] (diff active other movie feat)) features)) ))
(common-items active other)))))
View gnnnaaahhhhhhh
(defn process-file
[file-name line-func line-acc]
(reduce line-func line-acc (read-lines file-name)))
(defn process-line-data
[acc line]
(let [l (.split line "\t")]
(assoc acc (first l) (vec (rest l)))))