Skip to content

Instantly share code, notes, and snippets.

View jamwt's full-sized avatar

Jamie Turner jamwt

View GitHub Profile
@jamwt
jamwt / keybase.md
Created May 23, 2014 18:52
keybase.md

Keybase proof

I hereby claim:

  • I am jamwt on github.
  • I am jamwt (https://keybase.io/jamwt) on keybase.
  • I have a public key whose fingerprint is 9187 BBB5 9A2E 835A 1065 EF05 EC63 C37B 9089 B161

To claim this, I am signing this object:

struct Foo<A: Send> {
transformer: |A| -> A,
}
$ cargo build
Compiling iron v0.0.9 (file:///home/jamwt/contrib/iron)
src/lib.rs:25:24: 25:41 error: multiple matching crates for `log`
src/lib.rs:25 #[phase(plugin, link)] extern crate log;
^~~~~~~~~~~~~~~~~
note: candidates:
note: path: /usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblog-4e7c5e5c.so
note: path: /usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblog-4e7c5e5c.rlib
note: crate name: log
note: path: /home/jamwt/contrib/iron/target/deps/liblog-b6110bc38225692d.rlib
impl<'a, C: 'a + AbstractConnection + Send> ConnPool<'a, C> {
pub fn borrow(&'a self) -> Result<ScopedConn<C>, IoError> {
// With pool-wide lock, pick a host.
let host_pool: Arc<HostPool<'a, C>> = try!({
let mut pool = self.pool.lock();
pool.pick_host().clone()
});
// Acquire connection with narrower locking.
host_pool.lease(self.max_idle_conns, &self.make_conn)
}
@jamwt
jamwt / gist:2992f25fc45791337267
Last active August 29, 2015 14:16
Dropbox Rust HTTP
# New rust http stack
jamwt@tango ~
$ wrk -t12 -c400 -d30s http://127.0.0.1:8000/index.html
Running 30s test @ http://127.0.0.1:8000/index.html
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 15.68ms 31.18ms 473.37ms 99.35%
Req/Sec 2.67k 693.06 9.40k 80.67%
916396 requests in 29.99s, 45.45MB read
/home/jamwt/.cargo/registry/src/github.com-1ecc6299db9ec823/docopt-0.6.45/src/lib.rs:992:49: 992:58 error: the trait `core::iter::FromIterator<unicode::char::ToLowercase>` is not implemented for the type `collections::string::String` [E0277]
/home/jamwt/.cargo/registry/src/github.com-1ecc6299db9ec823/docopt-0.6.45/src/lib.rs:992 s.chars().map(|c| c.to_lowercase()).collect()
// Basic idea is to perturb a PRNG state using each word in a bytestream.
#include <assert.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "pcg_variants.h"
#0 0x00007ffff6fda0d5 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6fdd83b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6fd2d9e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6fd2e42 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00007ffff207021f in llvm::ICmpInst::AssertOK() () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#5 0x00007ffff20702cb in llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateICmp(llvm::CmpInst::Predicate, llvm::Value*, llvm::Value*, llvm::Twine const&) [clone .part.491] () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#6 0x00007ffff3108e8f in LLVMBuildICmp () from /usr/local/lib/librustc_llvm-4e7c5e5c.so
#7 0x00007ffff6b42900 in trans::build::ICmp::h70eb28ee2d0546d5aMp () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#8 0x00007ffff6b3eefe in trans::adt::trans_get_discr::h6649ce41ceb444a9zFH () from /usr/local/lib/librustc_trans-4e7c5e5c.so
#9 0x00007ffff6c176b9 in trans::_m
[[package]]
name = "mio"
version = "0.2.1"
source = "git+https://github.com/carllerche/mio.git#e0afd68779f3a4f74d2c4b021e4cc5fdb01e557f"
dependencies = [
"bytes 0.1.3 (git+https://github.com/carllerche/bytes)",
"log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.2.3 (git+https://github.com/carllerche/nix-rust)",
"time 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
me:
foo: "==3.0.8",
bar: "==4.0.7",
bar:
foo: "3.0.X"
Day 1: foo is 3.0.8. we're all good
Day 2: cargo update, foo 3.0.9 is available.