Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kelvl on github.
  • I am kelvin (https://keybase.io/kelvin) on keybase.
  • I have a public key ASCTOVqxNcf7Fw7O-oXWpvD_6wNXBkLmoMWSL64QGGNKnQo

To claim this, I am signing this object:

# So I what I am reading is that you have 4 arrays, where each position is the gene
# and the corresponding value is the expression value of the gene
# so for 4 genes and their corresponding expression values will be expressed as
A = [1,2,2,4]
B = [1,5,3,4]
C = [1,2,6,4]
D = [1,10,1,4]
@kelvl
kelvl / shadow-demo.conf
Created April 26, 2013 22:35
Sample Shadow Proxy configuration for AWS Summit Demo
akka {
loglevel = INFO
}
shadow {
version = "0.1-SNAPSHOT"
# where shadow listens for incoming requests
proxy-host = "0.0.0.0"
proxy-port = 8000
object DisjointGraphs extends App {
val disjoints = findThem(List((1,2), (2,3), (5,6), (7,8), (1,8)))
println(disjoints)
def findThem(edges: List[(Int, Int)]) = {
edges.foldLeft(List[Set[Int]]())({ (sets:List[Set[Int]], nextEdge: (Int, Int)) =>
// break up the list into 2 lists,
@kelvl
kelvl / README.md
Last active December 10, 2015 18:58 — forked from TMcManus/README.md

The python port of libphonenumber is pretty complete, but is a little short on examples and sample code. Here are some simple examples for some common uses of this fantastic library.

Note: Because libphonenumber uses static number range data, it is not the definitive refernce for number validity. However it serves as a great starting point to identify invalid numbers and format numbers into E.164 format.

@kelvl
kelvl / gist:1638954
Created January 19, 2012 09:31
Dumping Speech Packets
if object["class"] == "SpeechPacket"
refId = object["refId"]
speechPacket = object["properties"]["packets"]
packet = speechPacket[0].unpack("H*")[0].upcase + "\n"
if self.speechPackets.has_key? refId
self.speechPackets[refId].concat(packet)
else
self.speechPackets[refId] = packet
end
puts "[Info - Dropping Object from Guzzoni] Writing speech packet from #{refId} of length #{speechPacket.to_s.length}"
@kelvl
kelvl / gist:1638935
Created January 19, 2012 09:22
Siri.txt
-> Uses HTTPS
-> host is guzzoni.apple.com
-> Request is an ACE http request (custom HTTP method)
-> Requests and responses are *streamed* (no luck trying to re-use any existing HTTP tools. HTTP content-lenght is ~20 Gb)
-> Body of request is as follow :
0xAACCEE02 : Magic number (notice the 'ACE' again)
*** = zlib compressed data. (header is 0x78DA). Once uncompressed, you get :
0x030000ABAB : "ping" command. You can ignore. ABAB is the ping id. It's autoincremented, starts at 1
0x020000ABCD : Packet marker. ABCD = packet length
*** packet content. This is actually a binary property list