Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am ryanchang on github.
  • I am brewgeek (https://keybase.io/brewgeek) on keybase.
  • I have a public key ASCBwvM5xZjt6NBpf3AAuvxRe4-eeuN_CUv8Rl1PuCVPIQo

To claim this, I am signing this object:

@ryanchang
ryanchang / print_source.sh
Last active Jul 17, 2017
软件著作权申请打印代码专用😂
View print_source.sh
#!/bin/bash
for file in $( find . -name \*.m|grep -v lib ); do
echo "$file"
cat $file
echo "\n"
done
for file in $( find . -name \*.h|grep -v lib ); do
echo "$file"
cat $file
@ryanchang
ryanchang / gio_export_example.rb
Created May 15, 2017
GrowingIO原始数据导出
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 = OpenSSL::Digest.new('sha256')
OpenSSL::HMAC.hexdigest(digest, secret.encode("utf-8"), message)
end
@ryanchang
ryanchang / websocket_rails_client.py
Last active Sep 7, 2015
Python client for websocket_rails.
View websocket_rails_client.py
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
ryanchang / upload_audio.py
Last active Aug 29, 2015
Upload audio file to rails server with paperclip with python requests HTTP client.
View upload_audio.py
import requests
import base64
from datetime import datetime
import json
f = open('output.mp3')
recording = base64.b64encode(f.read())
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
payload = {'audio_clip': {'device':'0005', 'time':current_time, 'recording':{'filename':'output.mp3', 'content_type':'audio/mp3', 'content':recording}}}
View fullstack_arsenal.md

Fullstack Arsenal

PhantomJS

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-js

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.

ReactJS

@ryanchang
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})
end
View lldb_cheat_sheet.md

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