Skip to content

Instantly share code, notes, and snippets.

View wojons's full-sized avatar

Alexis Okuwa wojons

View GitHub Profile
@wojons
wojons / gist:4290902
Last active October 14, 2015 02:07 — forked from cmer/gist:1566734
apt-get install -y build-essential libx11-dev libgl1-mesa-dev libxext-dev perl perl-modules make
cd /tmp
wget http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz
tar xzvf UnixBench5.1.3.tgz
cd UnixBench
./Run
// Data inserted
r.db('test').table('multi').insert({
id:1,
field: [
{key1: 1}, {key1: 2}, {key1: 3}
]
})
r.db('test').table('multi').insert({
id:2,
field: [
@wojons
wojons / test query
Created November 25, 2013 08:21 — forked from AtnNn/test query
r.table('lexi2').insert([
{net:{lo:{tx:1, rx:2}, eth0:{tx:2, rx:4}}},
{net:{lo:{tx:4, rx:6}, wl0ps4:{tx:7, rx:1}}},
{net:{lo:{tx:14, rx:8}, eth0:{tx:1, rx:5}}}])
r.table('lexi2').reduce(
function(left, right){
return { net:
left('net').keys().setUnion(right('net').keys()).map(
function(iface){
#!/bin/bash
# Splits a given table into n evenly-spaced shards.
# call with ./split-table <tablename> <numshards>
table=$1
shards=$2
cluster="localhost:29015"
splits=`seq 0 $((16**4/$shards)) $((16**4+1)) \
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
import httplib
import urllib2
import ssl
import certifi
from backports.ssl_match_hostname import match_hostname
class CertValidatingHTTPSConnection(httplib.HTTPConnection):
default_port = httplib.HTTPS_PORT
@wojons
wojons / nginx.init.d
Last active August 29, 2015 14:21 — forked from vdel26/nginx
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
#!/bin/sh
#
# openresty adapted script to start and stop the openresty compiled
# nginx daemon
# --- original nginx comment ---
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
@wojons
wojons / README
Last active February 19, 2019 05:18 — forked from sasha-id/README
mongos mongoc mongod upstart
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
@wojons
wojons / openresty-luarocks.sh
Last active October 31, 2017 23:34 — forked from yagop/openresty-luarocks.sh
OpenResty + LuaRocks + Nchan
apt-get install -y libreadline-dev libncurses5-dev libpcre3-dev \
libssl-dev perl make build-essential
wget https://github.com/openresty/stream-lua-nginx-module/archive/v0.0.1.tar.gz \
-O /tmp/stream-lua-nginx-module-0.0.1.tar.gz
mkdir /tmp/stream-lua-nginx-module-0.0.1
tar xzvf /tmp/stream-lua-nginx-module-0.0.1.tar.gz -C /tmp/stream-lua-nginx-module-0.0.1