Skip to content

Instantly share code, notes, and snippets.

@tamird
tamird / module.rb
Last active August 29, 2015 14:06
Real constants in Ruby
Module.send(
:prepend,
Module.new do
def const_set(p1, p2)
p2.freeze unless p2.is_a?(Module)
super
end
end
)
if defined?(JRUBY_VERSION)
puts 'Applying https://github.com/jruby/jruby/wiki/UnlimitedStrengthCrypto'
security_class = java.lang.Class.for_name('javax.crypto.JceSecurity')
restricted_field = security_class.get_declared_field('isRestricted')
restricted_field.accessible = true
restricted_field.set(nil, false)
end
require 'openssl'
require 'securerandom'
$ CFG_ENABLE_VALGRIND=1 VALGRIND_COMPILE=1 make
...
UNKNOWN __pthread_sigmask is unsupported. This warning will not be repeated.
==40497== 16 bytes in 1 blocks are definitely lost in loss record 32 of 836
==40497== at 0x66BB: malloc (in /usr/local/Cellar/valgrind/3.10.1/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==40497== by 0x360228D: operator new(unsigned long) (in /usr/lib/libc++.1.dylib)
==40497== by 0x1F4CACF: void* llvm::object_creator<llvm::sys::ThreadLocal<llvm::PrettyStackTraceEntry const> >() (in /Users/tamird/src/rust-build/x86_64-apple-darwin/stage1/lib/librustc_llvm-4e7c5e5c.dylib)
==40497== by 0x1F43C56: llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void (*)(void*)) const (in /Users/tamird/src/rust-build/x86_64-apple-darwin/stage1/lib/librustc_llvm-4e7c5e5c.dylib)
extern crate libc;
extern crate native;
use libc::{c_short, c_int};
mod linux {
use native::io::file::FileDesc;
use libc::c_int;
pub fn socketpair(domain: int, type_: int, protocol: int) -> Result<(FileDesc, FileDesc), int> {
diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs
index 93a2a5d..629ec97 100644
--- a/src/librustc_bitflags/lib.rs
+++ b/src/librustc_bitflags/lib.rs
@@ -12,6 +12,7 @@
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "rustc_bitflags"]
+#![feature(associated_consts)]
#![feature(staged_api)]
diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs
index 93a2a5d..f40d730 100644
--- a/src/librustc_bitflags/lib.rs
+++ b/src/librustc_bitflags/lib.rs
@@ -12,6 +12,7 @@
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "rustc_bitflags"]
+#![feature(associated_consts)]
#![feature(staged_api)]
$ ./configure --with-llvm=/usr/local/Cellar/llvm36/3.6.0/lib/llvm-3.6
checking build system type... x86_64-apple-darwin13.4.0
checking host system type... x86_64-apple-darwin13.4.0
checking target system type... x86_64-apple-darwin13.4.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... autoconf/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
@tamird
tamird / gist:b4cdde131fe7aa464e92
Created May 28, 2015 20:51
crash in range_raftstorage.go
[tamird:~/src/go/src/github.com/cockroachdb/cockroach] acceptance-testing(+5/-1) ± docker logs 87a028887dcf
I0528 20:47:10.338175 1 start.go:110] build Vers: go1.4.2
I0528 20:47:10.339152 1 start.go:111] build Tag: alpha-2609-g7d5551f-dirty
I0528 20:47:10.339160 1 start.go:112] build Time: 2015/05/28 20:30:25
I0528 20:47:10.339167 1 start.go:113] build Deps: github.com/biogo/store:e1f74b3c58befe661feed7fa4cf52436de753128 github.com/cockroachdb/c-lz4:6e71f140a365017bbe0904710007f8725fd3f809 github.com/cockroachdb/c-protobuf:9e8dac59ca2a3fc82cd0665ad32b1a36f3df40b8 github.com/cockroachdb/c-rocksdb:e120ce0fb32f86b94188928743270ea11ff016b3 github.com/cockroachdb/c-snappy:618733f9e5bab8463b9049117a335a7a1bfc9fd5 github.com/cockroachdb/cockroach:7d5551f323428df5868f467c0b0c121c7820f904 github.com/coreos/etcd:5d741e4945d7c5f613d37b1be39ae6a8488d27b9 github.com/elazarl/go-bindata-assetfs:bea323321994103859d60197d229f1a94699dde3 github.com/gogo/protobuf:b9e369e8ffb6773efc654ea13594566404314ee1
ok github.com/cockroachdb/cockroach/base 0.248s
W0529 23:00:06.788593 37016 http_sender.go:114] failed to send HTTP request with status code 503, 503 Service Unavailable
W0529 23:00:06.815420 37016 http_sender.go:114] failed to send HTTP request with status code 504, 504 Gateway Timeout
W0529 23:00:06.842140 37016 http_sender.go:114] failed to send HTTP request with status code 429, 429 Too Many Requests
W0529 23:00:06.867605 37016 http_sender.go:114] failed to send HTTP request with status code 408, 408 Request Timeout
W0529 23:00:06.890632 37016 http_sender.go:114] failed to send HTTP request with status code 400, 400 Bad Request
W0529 23:00:06.914263 37016 http_sender.go:114] failed to send HTTP request with status code 404, 404 Not Found
W0529 23:00:06.938017 37016 http_sender.go:114] failed to send HTTP request with status code 401, 401 Unauthorized
W0529 23:00:06.966121 37016 http_sender.go:114] failed to send HTTP request with status code 403, 403 Forbidden
W0529 23:00:06.994746 37
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 1 column, instead of 4. in line 3.
[tamird:~/src/go/src/github.com/cockroachdb/rpc-bench] master ± go test -cpu 1,2,4 -timeout 5s -bench .
testing: warning: no tests to run
PASS
BenchmarkGRPC1K 10000 149654 ns/op 13.68 MB/s
BenchmarkGRPC1K-2 20000 84011 ns/op 24.38 MB/s
BenchmarkGRPC1K-4 30000 61769 ns/op 33.16 MB/s
BenchmarkGRPC64K 2000 867688 ns/op 151.06 MB/s
BenchmarkGRPC64K-2 3000 549554 ns/op 238.51 MB/s
BenchmarkGRPC64K-4 3000 530154 ns/op 247.23 MB/s
BenchmarkGobRPC1K 20000 54553 ns/op 37.54 MB/s