I hereby claim:
- I am johnptoohey on github.
- I am johnptoohey (https://keybase.io/johnptoohey) on keybase.
- I have a public key ASBKv9Gn4o7QFYq9CM_2QiYvaZULIr2h8RGlr5DW4ONNHQo
To claim this, I am signing this object:
# Rust type conversions String, &str, Vec<u8> and &[u8] | |
```rust | |
let s:String = ... | |
let st:&str = ... | |
let u:&[u8] = ... | |
let v:Vec<u8> = ... | |
&str -> String String::from(st) | |
&str -> &[u8] st.as_bytes() |
extern crate rustc_serialize as serialize; | |
use self::serialize::hex::{FromHex, ToHex}; | |
use std::str; | |
fn parse_hex(hex_asm: &str) -> Vec<u8> { | |
let mut hex_bytes = hex_asm | |
.as_bytes() | |
.iter() | |
.filter_map(|b| match b { |
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" | |
) |
I hereby claim:
To claim this, I am signing this object:
{ | |
"@id": "http://example.com/app-profile.json", | |
"@context": { | |
"title": "http://purl.org/dc/terms/title", | |
"description": "http://purl.org/dc/terms/description", | |
"creator": "http://purl.org/dc/terms/creator" | |
}, | |
"title": "JSON-LD Dublin Core Application Profile", | |
"description": "This is an example of a Dublin Core Application Profile as a JSON-LD. The point is to demonstrate that a JSON-LD context document could contain metadata. If it is desirable to annotate the use of particular properties they could theoretically fit into @graph using existing or a new DCAP vocabulary, etc.", | |
"creator": "http://twitter.com/edsu", |
Test |
A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
Internet Scale Services Checklist: A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
System Design Cheatsheet :Picking the right architecture = Picking the right battles + Managing trade-offs
(defn model-from-sequence | |
"Returns a transition matrix of 'depth' from 'sequence'" | |
[depth sequence] | |
(loop [accum {} chunks (partition (inc depth) 1 (seq sequence))] | |
(if (seq? chunks) | |
(let [chunk (first chunks) | |
prefix (drop-last chunk) | |
suffix (last chunk)] | |
(recur (assoc accum prefix (conj (get accum prefix []) suffix)) (next chunks))) | |
accum))) |
; Depends on [com.notnoop.apns/apns "0.1.6"]. | |
(:import ('com.notnoop.apns APNS)) | |
(defn send-push-notification [device-token message] | |
(let [service (.build (.withSandboxDestination | |
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password"))) | |
payload (.build (.alertBody (APNS/newPayload) message))] | |
(.push service device-token payload))) |