Skip to content

Instantly share code, notes, and snippets.

View wojons's full-sized avatar

Alexis Okuwa wojons

View GitHub Profile
@wojons
wojons / openresty-nchan-luarocks.sh
Created September 20, 2017 17:43 — forked from jmealo/openresty-nchan-redis-luarocks.sh
OpenResty + LuaRocks + Nchan
apt-get install -y libreadline-dev libncurses5-dev libpcre3-dev \
libssl-dev perl make build-essential git curl \
unzip
git clone https://github.com/openresty/stream-lua-nginx-module.git \
--branch master \
--single-branch /tmp/stream-lua-nginx-module-master
curl -L https://github.com/slact/nchan/archive/v1.1.7.tar.gz | tar xz -C /tmp
curl -L https://openresty.org/download/openresty-1.11.2.4.tar.gz | tar xz -C /tmp
@wojons
wojons / git+clone+ssh+agent+forward+sudo
Created August 11, 2016 03:13 — forked from scottjacobsen/git+clone+ssh+agent+forward+sudo
Git clone using ssh agent forwarding and sudo
SSH agent forwarding is great. It allows you to ssh from one server to
another all the while using the ssh-agent running on your local
workstation. The benefit is you don't need to generate ssh key pairs
on the servers you are connecting to in order to hop around.
When you ssh to a remote machine the remote machine talks to your
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK
environment variable.
So you the remote server you can do something like:
@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
@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:
#!/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 / 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
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
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(),
#!/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)) \
@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){