Skip to content

Instantly share code, notes, and snippets.

View wojons's full-sized avatar

Alexis Okuwa wojons

View GitHub Profile
#!/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
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 4
MinSpareServers 4
@wojons
wojons / Apex, North Carolina, USA (AT&T)
Last active December 30, 2015 17:44
AWS Latency from locations
US-East (Virginia) 40 ms
US-West (California) 98 ms
US-West (Oregon) 120 ms
Europe (Ireland) 140 ms
Europe (Frankfurt) 153 ms
Asia Pacific (Singapore) 271 ms
Asia Pacific (Sydney) 279 ms
Asia Pacific (Japan) 207 ms
South America (Brazil) 178 ms
try:
ai_list = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
self.payload['latency'][host] = 0 #set default
counter = 0;
except socket.gaierror:
self.stderr(host+" - getaddrinfo() error: {0}".format(sys.exc_info()[1]))
continue
for (family, socktype, proto, canon, sockaddr) in ai_list:
@wojons
wojons / 1 of 4 nodes
Last active August 29, 2015 14:02
rethinkdb-crash-1.2.5 6/16/14
error: Error in src/rdb_protocol/btree.cc at line 532:
error: Guarantee failed: [!mod_info->deleted.second.empty() && mod_info->added.second.empty()]
error: Backtrace:
addr2line: 'rethinkdb': No such file
error: Thu May 29 02:14:37 2014
1: backtrace_t::backtrace_t() at 0x115e912 (rethinkdb)
2: lazy_backtrace_formatter_t::lazy_backtrace_formatter_t() at 0x115ec0d (rethinkdb)
3: format_backtrace(bool) at 0x115fe71 (rethinkdb)
4: report_fatal_error(char const*, int, char const*, ...) at 0x11aceb5 (rethinkdb)
@wojons
wojons / crash.log
Created May 4, 2014 05:32
rethinkdb 1.12.3 crash
error: Error in ./src/buffer_cache/alt/alt.hpp at line 327:
error: Guarantee failed: [block_size == lock_->cache()->max_block_size().value()]
error: Backtrace:
addr2line: 'rethinkdb': No such file
error: Sun May 4 07:30:26 2014
1: backtrace_t::backtrace_t() at 0x115e872 (rethinkdb)
2: lazy_backtrace_formatter_t::lazy_backtrace_formatter_t() at 0x115eb6d (rethinkdb)
3: format_backtrace(bool) at 0x115fdd1 (rethinkdb)
4: report_fatal_error(char const*, int, char const*, ...) at 0x11ace15 (rethinkdb)
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)) \