Skip to content

Instantly share code, notes, and snippets.

View ZachMassia's full-sized avatar

Zach Massia ZachMassia

  • MacEwen Petroleum Inc.
  • Ontario, Canada
View GitHub Profile
PC=0x478b42
syscall.Syscall()
/usr/lib/go/src/pkg/syscall/asm_linux_amd64.s:16 +0x5
syscall.read(0x3, 0xc200086000, 0x1000, 0x1000, 0x100000000000003, ...)
/usr/lib/go/src/pkg/syscall/zerrors_linux_amd64.go:2337 +0x70
syscall.Read(0x3, 0xc200086000, 0x1000, 0x1000, 0x408c18, ...)
/usr/lib/go/src/pkg/syscall/syscall_unix.go:132 +0x5a
os.(*File).read(0xc2000009a8, 0xc200086000, 0x1000, 0x1000, 0x412e14, ...)
/usr/lib/go/src/pkg/os/file_unix.go:174 +0x60
@ZachMassia
ZachMassia / capability_resp.txt
Last active December 20, 2015 12:09
The output of the CAPABILITY_QUERY command from Firmata running on an Arduino Mega ADK.
The function used to produce output seen below.
func (b *Board) handleCapabilityResponse(m message) {
log.Printf("Capability: -- HEXDUMP --\n%s", hex.Dump(m.data))
pin := byte(0) // start with pin 0
buf := bytes.NewBuffer(m.data[2 : len(m.data)-1])
for buf.Len() > 0 {
d, _ := buf.ReadBytes(0x7F)
S | 83 | 53
| 0 | 0
t | 116 | 74
| 0 | 0
a | 97 | 61
| 0 | 0
n | 110 | 6E
ù | 249 | F9
 | 2 | 2
 | 3 | 3
@ZachMassia
ZachMassia / out
Last active December 20, 2015 09:49
GoGoGadget Message Parsing
➜ gadget go run main.go
Version: got 2 3 | 2.3
Firmware: got 2 3 | 2.3
Firmware: StandardFirmata.ino
Firmware: HEXDUMP:
F0 79 02 03 53 00 74 00 61 00 6E 00
64 00 61 00 72 00 64 00 46 00 69 00
72 00 6D 00 61 00 74 00 61 00 2E 00
69 00 6E 00 6F 00 F7
type Message struct {
type string
midiData [3]byte
sysexData[255]byte
sysexLen int
}
func NewBoard() *Board {
b := &Board{}
// Start the message loops
@ZachMassia
ZachMassia / blink.go
Created July 28, 2013 07:11
Concurrent blinking.
@ZachMassia
ZachMassia / chat.go
Created July 14, 2013 03:52
bufio.ReadWriter from net.Conn
type Client struct {
rw *bufio.ReadWriter
// ...
}
func NewClient(conn net.Conn) *Client {
rw := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))
// ...
}
resolving dependencies...
looking for inter-conflicts...
error: failed to prepare transaction (could not satisfy dependencies)
:: haskell-citeproc-hs: requires haskell-mtl=2.1.2-27
:: haskell-citeproc-hs: requires haskell-utf8-string=0.3.7-27
:: haskell-highlighting-kate: requires haskell-mtl=2.1.2-27
:: haskell-http: requires haskell-mtl=2.1.2-27
:: haskell-json: requires haskell-mtl=2.1.2-27
:: haskell-parsec: requires haskell-mtl=2.1.2-27
:: haskell-regex-base: requires haskell-mtl=2.1.2-27
CONFIG_FILE = File.expand_path_relative_to_caller('../hatterrc')
def initialize(config_file = CONFIG_FILE)
reader = ConfigToolkit::KeyValueReader.new user_config || config_file
load reader
end
def user_config
path = File.join(Dir.home, '.hatterrc')
File.exists?(path) ? path : nil
@ZachMassia
ZachMassia / configuration_spec.rb
Created May 6, 2013 02:20
Hatter config spec
require 'spec_helper'
require 'relative'
require 'configtoolkit/keyvaluereader'
describe 'Configuration' do
let(:config_file) { File.expand_path_relative_to_caller("../hatterrc") }
let(:maildir_path) { "/path/to/maildir" }
let(:maildir_format) { "maildir" }
let(:termbox_library_path) { "/usr/lib/libtermbox.so" }