Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am ryanchang on github.
  • I am brewgeek ( on keybase.
  • I have a public key ASCBwvM5xZjt6NBpf3AAuvxRe4-eeuN_CUv8Rl1PuCVPIQo

To claim this, I am signing this object:

ryanchang /
Last active Jul 17, 2017
for file in $( find . -name \*.m|grep -v lib ); do
echo "$file"
cat $file
echo "\n"
for file in $( find . -name \*.h|grep -v lib ); do
echo "$file"
cat $file
ryanchang / gio_export_example.rb
Created May 15, 2017
View gio_export_example.rb
require 'date'
require 'openssl'
require 'rest-client'
require 'json'
def auth_token(secret, project, ai, tm)
message = ("POST\n/auth/token\nproject=" + project + "&ai=" + ai + "&tm=" + tm).encode("utf-8")
digest ='sha256')
OpenSSL::HMAC.hexdigest(digest, secret.encode("utf-8"), message)
ryanchang /
Last active Sep 7, 2015
Python client for websocket_rails.
import websocket
import thread
import time
import json
def on_message(ws, message):
print "recieved: " + message
response = json.loads(message)[0]
event = response[0]
print "event: " + event
ryanchang /
Last active Aug 29, 2015
Upload audio file to rails server with paperclip with python requests HTTP client.
import requests
import base64
from datetime import datetime
import json
f = open('output.mp3')
recording = base64.b64encode(
current_time ='%Y-%m-%d %H:%M:%S')
payload = {'audio_clip': {'device':'0005', 'time':current_time, 'recording':{'filename':'output.mp3', 'content_type':'audio/mp3', 'content':recording}}}

Fullstack Arsenal


Full web stack No browser required PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast andnative support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.


Immutable provides Persistent Immutable List, Stack, Map, OrderedMap, Set, OrderedSet and Record. They are highly efficient on modern JavaScript VMs by using structural sharing via hash maps tries and vector tries as popularized by Clojure and Scala, minimizing the need to copy or cache data.


ryanchang / svg2pdfs.rb
Created Nov 26, 2014
Convert all the .svg file in the current directory to .pdf with svg2pdf tool
View svg2pdfs.rb
sources = Dir["./*.svg"]
puts sources
sources.each do |svg|
pdf = "#{svg[0...-4]}.pdf"
%x(svg2pdf #{svg} #{pdf})

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type