Skip to content

Instantly share code, notes, and snippets.

View pjvds's full-sized avatar
:octocat:
‏‏‎

Pieter Joost van de Sande pjvds

:octocat:
‏‏‎
View GitHub Profile
go test -bench=. github.com/gdamore/mangos/test
PASS
BenchmarkLatencyInp-6 100000 20056 ns/op
BenchmarkLatencyIPC-6 20000 100229 ns/op
BenchmarkLatencyTCP-6 10000 118770 ns/op
BenchmarkLatencyTLS-6 10000 185343 ns/op
BenchmarkTPut4kInp-6 200000 6807 ns/op 601.66 MB/s
BenchmarkTPut4kIPC-6 300000 6639 ns/op 616.93 MB/s
BenchmarkTPut4kTCP-6 200000 12042 ns/op 340.14 MB/s
BenchmarkTPut4kTLS-6 100000 15285 ns/op 267.96 MB/s
yum localinstall -y http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum install -y mosh
echo '<?xml version="1.0" encoding="utf-8"?> <service> <short>mosh</short> <description>mobile shell server</description> <port protocol="udp" port="60000-61000"/></service>' > /etc/firewalld/services/mosh.xml
restorecon /etc/firewalld/services/mosh.xml
chmod 640 /etc/firewalld/services/mosh.xml
firewall-cmd --reload
firewall-cmd --permanent --add-service=mosh
@pjvds
pjvds / setup-fdb-cluster-centos.sh
Last active August 29, 2015 14:13
provision fdb server
yum update -y
yum localinstall -y https://foundationdb.com/downloads/token/6af12ae4-e7f6-4200-983a-627cd5f9bd1b/key-value-store/3.0.5/foundationdb-clients-3.0.5-1.el7.x86_64.rpm https://foundationdb.com/downloads/token/6266c756-3c66-4913-8dfd-d234bdf66e79/key-value-store/3.0.5/foundationdb-server-3.0.5-1.el7.x86_64.rpm
sudo /usr/lib/foundationdb/make_public.py
echo '<?xml version="1.0" encoding="utf-8"?> <service> <short>fdb</short> <description>foundationdb server</description> <port protocol="tcp" port="4500-4600"/></service>' > /etc/firewalld/services/fdb.xml
restorecon /etc/firewalld/services/fdb.xml
chmod 640 /etc/firewalld/services/fdb.xml
firewall-cmd --reload
firewall-cmd --permanent --add-service=fdb
echo "Drtu0T4S:SdzTe7B4@109.74.5.254:4500,109.74.5.151:4500" > /etc/foundationdb/fdb.cluster
sudo yum update
sudo yum install zsh terminator git tig mercurial vim
chsh --shell /bin/zsh
sudo yum install i3 i3-ipc i3status i3lock
ssh-keygen
echo "ADD PUBLIC KEY TO GITHUB NOW!"
sudo yum install autojump autojump-zsh
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
'.active.pane':
'ctrl-;': 'gocode:toggle'
'.autocomplete-plus input.hidden-input':
'enter': 'autocomplete-plus:confirm'
'ctrl-k': 'autocomplete-plus:select-next'
'ctrl-j': 'autocomplete-plus:select-previous'
Now we setup a workspace by doing the following:
- Install Go as described in <http://golang.org/doc/install>
- Open an terminal and change the directory to your `$HOME` dir (My Documents for Windows).
- Create a new directory called `go` and add the following 3 folders to is: `src`, `pkg` and `bin`.
- Add an environment variable `GOPATH` with the value `$HOME/go`.
- Get the workshop code by executing: `go get github.com/pjvds/goworkshop`. The code will be located in `$GOPATH/src/github.com/pjvds/goworkshop`
- `cd` into that directory and open the `readme`.
https://github.com/pjvds/goworkshop/archive/master.zip
@pjvds
pjvds / like-button--controller.js
Created September 24, 2014 13:59
Profile controller creates a like-button child components and passes values via params so that the like-button can build a model out of it. This works perfectly on the server, the model is available when rendering the view of the like-button. But it never gets dehydrated on the client.
define(["lazoCtl"], function(Ctl) {
"use strict";
return Ctl.extend({
index: function(options) {
var self = this;
// create model passed on the params we get passed in.
self.createModel("like-button",
initialize: function() {
_.bindAll(this, 'detect_scroll');
// bind to window
$(window).scroll(this.detect_scroll);
}
func sleepSort(input []int) []int {
length := len(input)
sorting := make(chan int)
for i := 0; i < length; i++ {
go func(n int) {
time.Sleep(time.Duration(n) * time.Millisecond * slack)
sorting <- n
}(input[i])
}