Skip to content

Instantly share code, notes, and snippets.

@mschoch
mschoch / rt.rl
Created August 28, 2015 03:24
ragle + go + alphtype rune + unicode?
package rt
import "testing"
func TestRt(t *testing.T) {
tests := []struct {
input string
err error
}{
{
{
"Hostname": "172.23.96.68",
"Database": "db",
"DocSizeDistribution": [
{
"Prob": 20,
"MinSize": 32,
"MaxSize": 127
},
{
package workload
import (
"math/rand"
"time"
)
type Schedule []time.Duration
type ScheduleBuilder struct {
{
"Hostname": "172.23.96.68",
"Database": "db",
"DocSizeDistribution": [
{
"Prob": 20,
"MinSize": 32,
"MaxSize": 127
},
{
@mschoch
mschoch / build-your-own-database-named-after-relaxing-furniture.Dockerfile
Last active August 29, 2015 13:57
Build your own database named after relaxing furniture
FROM dustin/tiny
MAINTAINER Marty Schoch "marty.schoch@gmail.com"
RUN apt-get update
# deps
RUN apt-get install -y build-essential git-core python cmake libcurl4-openssl-dev libevent-dev libicu-dev libv8-dev erlang-nox erlang-dev erlang-src
ADD https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz /tmp/snappy-1.1.1.tar.gz
RUN cd /tmp && tar zxvf snappy-1.1.1.tar.gz
@mschoch
mschoch / test-coverage.sh
Last active August 29, 2015 14:00
submit multi-package code coverage reports to coveralls - modified from https://github.com/gopns/gopns/blob/master/test-coverage.sh
#!/bin/bash
echo "mode: set" > acc.out
for Dir in . $(find ./* -maxdepth 10 -type d );
do
if ls $Dir/*.go &> /dev/null;
then
returnval=`go test -coverprofile=profile.out $Dir`
echo ${returnval}
if [[ ${returnval} != *FAIL* ]]
1. Get github repo info JSON:
curl -U username:password https://api.github.com/repos/couchbaselabs/bleve
{
"id": 18893367,
"name": "bleve",
"full_name": "couchbaselabs/bleve",
"owner": {
"login": "couchbaselabs",
"id": 636956,
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 8091, host: 8091
config.vm.network "forwarded_port", guest: 8092, host: 8092
config.vm.network "forwarded_port", guest: 11210, host: 11210
config.vm.network "forwarded_port", guest: 9091, host: 9091
config.vm.network "forwarded_port", guest: 9200, host: 9200
config.vm.network "forwarded_port", guest: 9300, host: 9300
config.vm.network "forwarded_port", guest: 3133, host: 3133
end
@mschoch
mschoch / output
Created October 3, 2014 16:50
golang present tool show line numbers?
$ go get -u code.google.com/p/go.tools/cmd/present
$ present -orighost=localhost
2014/10/03 09:49:52 Open your web browser and visit http://localhost:3999
2014/10/03 09:49:57 accepting connection from: 127.0.0.1:50701
@mschoch
mschoch / test.c
Created October 31, 2014 01:47
ForestDB test program with no fdb_commit()
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "libforestdb/forestdb.h"
int main(int argc, char**argv) {
fdb_handle *db;
fdb_status status;
fdb_config config;