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
cd /tmp
wget https://foundationdb.com/downloads/I_accept_the_FoundationDB_Community_License_Agreement/2.0.0/foundationdb-clients_2.0.0-1_amd64.deb
sudo dpkg -i foundationdb-clients_2.0.0-1_amd64.deb
wget https://foundationdb.com/downloads/I_accept_the_FoundationDB_Community_License_Agreement/2.0.0/foundationdb-server_2.0.0-1_amd64.deb
sudo dpkg -i foundationdb-server_2.0.0-1_amd64.deb
@pjvds
pjvds / rc.lua
Created February 16, 2014 12:33
Gnome quit awesome fix
-- Override awesome.quit when we're using GNOME
_awesome_quit = awesome.quit
awesome.quit = function()
if os.getenv("DESKTOP_SESSION") == "awesome-gnome" then
os.execute("/usr/bin/gnome-session-quit")
else
_awesome_quit()
end
end
# Running terminator
docker pull quay.io/happypancake/terminator
docker stop terminator || echo "nothing to stop"
docker rm terminator || echo "nothing to remove"
docker run -lxc-conf="lxc.cgroup.cpuset.cpus=0-1" -e "GOMAXPROCS=2" -t -p="0.0.0.0:80:80" -name=terminator quay.io/happypancake/terminator
# Running web-aggregator
docker pull quay.io/happypancake/web
docker stop web || echo "nothing to stop"
docker rm web || echo "nothing to remove"
docker run -lxc-conf="lxc.cgroup.cpuset.cpus=0-5" -e "GOMAXPROCS=6" -t -p="0.0.0.0:80:80" -name=terminator quay.io/happypancake/terminator -http-address=0.0.0.0:80 -bus-pull-address=0.0.0.0:10001 -bus-push-address=0.0.0.0:10002
@pjvds
pjvds / Dockerfile
Last active August 29, 2015 13:57
Docker file with single run to prevent unnecessary image creation.
FROM ubuntu:12.04
RUN \
apt-get update -qq; \
apt-get install build-essential dh-autoreconf git -y -qq; \
echo "* hard nofile 200000" >> "/etc/security/limits.conf"; \
echo "* soft nofile 200000" >> "/etc/security/limits.conf"; \
echo "root hard nofile 200000" >> "/etc/security/limits.conf"; \
echo "root soft nofile 200000" >> "/etc/security/limits.conf"; \
cd /tmp; \
sudo apt-get update && \
sudo apt-get install build-essential git libev-dev -y && \
git clone https://github.com/lighttpd/weighttp.git && \
cd weighttp && \
./waf configure && \
./waf build && \
cp build/default/weighttp /usr/local/bin
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
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])
}
initialize: function() {
_.bindAll(this, 'detect_scroll');
// bind to window
$(window).scroll(this.detect_scroll);
}
@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",