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 ) ;;;
@blakejakopovic
blakejakopovic / SparkGraph.playground
Created July 2, 2014 08:57
Simple spark graph NSView example written in Swift. Open with Xcode for live preview and coding.
import Cocoa
import XCPlayground
@IBDesignable
class SparkGraph: NSView {
// Background Colour
@IBInspectable var backgroundColor:NSColor?
// Border
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')

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
#!/usr/bin/ruby -rubygems
#
# Point appcrush at an .ipa file from the iTunes AppStore and it
# - expands the zip file
# - finds all the images
# - runs pngcrush with the revert-iphone-optimizations option on each image
#
# Requirements Xcode with iOS SDK 3.2 or higher
#
# Usage: appcrush '/Users/boctor/Music/iTunes/Mobile Applications/iBooks.ipa'
@blakejakopovic
blakejakopovic / Lircmap.xml
Created April 14, 2013 09:03
Lircmap.xml for DVICO_MCE2 and XBMC
<lircmap>
<remote device="DVICO_MCE2">
<pause>playpause</pause>
<stop>stop</stop>
<forward>ff</forward>
<reverse>rew</reverse>
<left>left</left>
<right>right</right>
<up>up</up>
<down>down</down>