Skip to content

Instantly share code, notes, and snippets.

['BandFmt', 'Bands', 'Bbits', 'Coding', 'Compression', 'Hist', 'Length', 'Level', 'Type', 'Xoffset', 'Xres', 'Xres_float', 'Xsize', 'Yoffset', 'Yres', 'Yres_float', 'Ysize', '__class__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__gdoc__', '__ge__', '__getattribute__', '__gpointer__', '__grefcount__', '__gsignals__', '__gt__', '__gtype__', '__hash__', '__info__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_force_floating', '_ref', '_ref_sink', '_unref', '_unsupported_data_method', '_unsupported_method', 'argument_isset', 'argument_needsstring', 'argument_table', 'baseaddr', 'bind_property', 'bind_property_full', 'build', 'chain', 'client1', 'client2', 'close', 'compat_control', 'connect', 'connect_after', 'connect_data', 'connect_object', 'connect_object_after', 'constructed', 'data', 'decode', 'decode_predict', 'delete_on_close', 'del
<?php
// Example to accompany blog post:
// http://blog.banksdesigns.co.uk/post/when-not-to-use-arrays-in-php
ini_set('memory_limit', '512M');
$array_2d = $array_strings = array();
$mem_start = memory_get_usage();
@banks
banks / ring.c
Created November 16, 2015 15:44
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include "../libmill.h"
void relay(chan in, chan out) {
int val = chr(in, int);
chs(out, int, val + 1);
// On Macbook pro quad-core 2014 retina 15inch
Opts: {}
Batches of 1
Inserting 5000 docs took 52808.177948ms @ 94.6822834187 per second
Batches of 10
Inserting 5000 docs took 9779.50787544ms @ 511.27290901 per second
Batches of 200
Inserting 5000 docs took 1662.64986992ms @ 3007.23692097 per second
Opts: {'durability': 'soft'}
Batches of 1

Keybase proof

I hereby claim:

  • I am banks on github.
  • I am banksyw (https://keybase.io/banksyw) on keybase.
  • I have a public key ASD34ru5nha4p16hYT9Ye62vPO3FM-d3r3Is6xmFLhhH5Ao

To claim this, I am signing this object:

bash-4.4$ export STEP=120
bash-4.4$ for i in $(seq 1 10 600); do START=$((1485176922 + i)); END=$((1485263322 + $i)); echo "$START - $END"; curl 2>/dev/null "http://prometheus.1.dblayer.com:9090/api/v1/query_range?query=cpu_usage_user%7Bhost%3D%22candidate.57%22%7D%20&start=$START&end=$END&step=$STEP" | jq '.data.result[0].values[] | .[1] | tonumber' | awk -v max=0 -v min=9999 '{ total += $1; count++; if($1>max){max=$1}; if($1<min){min=$1} } END { print " " total/count, max, min}'; done
1485176923 - 1485263323
45.4626 91.07730456963016 12.89468239168138
1485176933 - 1485263333
30.1437 86.16109881174854 10.058442152821929
1485176943 - 1485263343
30.1437 86.16109881174854 10.058442152821929
1485176953 - 1485263353
23.3495 71.28118644816615 6.88269494352532
$ ./grpc_proxy_bug.sh
Putting /grpc_proxy_bug/001
OK
Putting /grpc_proxy_bug/002
OK
Putting /grpc_proxy_bug/003
OK
Putting /grpc_proxy_bug/004
OK
Putting /grpc_proxy_bug/005
package main
import (
"bytes"
"compress/lzw"
"crypto/md5"
"encoding/gob"
"fmt"
"log"
"time"
-----BEGIN CERTIFICATE-----
MIICpzCCAk2gAwIBAgIUDWOb2bgBLZ+Vuqr7H0dlNxpyfoIwCgYIKoZIzj0EAwIw
FDESMBAGA1UEAxMJVGVzdCBDQSAxMB4XDTE4MDYxOTE2NDMyMFoXDTI4MDYxNjE2
NDMyMFowFDESMBAGA1UEAxMJVGVzdCBDQSAxMFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAEOF9GX0vk+fia1Es114uBi3w+4AK1k+VLvladnJQQzosePPLSnOdE36MY
/cYnc+hAWasoqGoZFFCt/xA7+B0HaaOCAXswggF3MA4GA1UdDwEB/wQEAwIBhjAP
BgNVHRMBAf8EBTADAQH/MGgGA1UdDgRhBF84YTpjNDozZjo2Mjo5MDo5NzoxMzo1
ODpiOTo4Zjo3NTpmYjplMDo1Yzo5Yjo2Nzo3YTplZjo2Nzo4YjozMjozNTo1Nzow
YjowMzpiYzpiNTphMzo5Zjo5YjozMjpkYTBqBgNVHSMEYzBhgF84YTpjNDozZjo2
Mjo5MDo5NzoxMzo1ODpiOTo4Zjo3NTpmYjplMDo1Yzo5Yjo2Nzo3YTplZjo2Nzo4
Test setup
==========
DO droplet with 8vcpu 32GB RAM 640GB SSD/
// Master (boltdb log store)
Running 10s test @ http://localhost:8500/v1/kv/foo
4 threads and 50 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.91ms 2.84ms 49.55ms 91.78%