Skip to content

Instantly share code, notes, and snippets.

View blakejakopovic's full-sized avatar

Blake Jakopovic blakejakopovic

View GitHub Profile
@blakejakopovic
blakejakopovic / cljs-nw-serial.cljs
Created August 3, 2014 08:21
FirmataSerial Nodejs Clojurescript clj-firmata serial adapter
(ns cljs-nw-serial.core
(:require [cljs.nodejs :as nodejs]))
(enable-console-print!)
(def SerialPort (.-SerialPort (nodejs/require "serialport")))
(defprotocol FirmataStream
(open! [this] "opens the stream")
@blakejakopovic
blakejakopovic / sysex.clj
Created July 23, 2014 06:22
Extending clj-firmata in TestDrive
(ns testdrive.sysex
(:require [firmata.core :refer [read-sysex-event consume-sysex read-two-byte-data]]))
(def ^{:private true} SYSEX_TYPE_EVENT 0x01 )
(def ^{:private true} SYSEX_TYPE_REGISTER 0x02 )
(def ^{:private true} KIND_ACCELEROMETER 0x01 ) ;;;
(def ^{:private true} KIND_MAGNETIC_FIELD 0x02 ) ;;;
(def ^{:private true} KIND_ORIENTATION 0x03 ) ;
(def ^{:private true} KIND_GYROSCOPE 0x04 ) ;;;
user=> (ns there)
nil
there=> (defmulti ^:private doit identity)
#'there/doit
there=> (defmethod doit 1 [x] x)
#<MultiFn clojure.lang.MultiFn@d2de489>
there=> (doit 1)
1
there=> (in-ns 'user)
#<Namespace user>
@blakejakopovic
blakejakopovic / README.md
Last active August 29, 2015 14:01
Spark Core UDP Echo

UDP Echo Sketch for Spark Core

A simple UDP echo program for the Spark Core Arduino based device. You can send a single byte (ie. 'a') of data and have it sent back. This program serves no real practical application, but can be used to learn and tinker with UDP and inter-device communication.

Testing UDP

You can test sending and receiving UDP packets using the Packet Sender application, available for Windows, Mac, Ubuntu and Andriod.

@blakejakopovic
blakejakopovic / read_twitter_favourites
Created April 18, 2014 01:03
read_twitter_favourites
#!/usr/bin/env ruby
require 'dotenv'
Dotenv.load '~/bin/.env'
require 'twitter' # v5.0
require 'terminal-notifier'
HOST_IGNORE_LIST = [
'www.techmeme.com' #ignored because direct article link is desired
@blakejakopovic
blakejakopovic / read_reddit_saved
Created April 18, 2014 01:02
read_reddit_saved
#!/usr/bin/env ruby
require 'dotenv'
Dotenv.load '~/bin/.env'
require 'snoo'
require 'terminal-notifier'
username = ENV.fetch('REDDIT_USERNAME')
password = ENV.fetch('REDDIT_PASSWORD')