Skip to content

Instantly share code, notes, and snippets.

View diegows's full-sized avatar
🏡
Working from home!

Diego Woitasen diegows

🏡
Working from home!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am diegows on github.
  • I am diegows (https://keybase.io/diegows) on keybase.
  • I have a public key ASBqPwzFYpkxlzwC40CZ4EyQEXb-MFNj6m0_4gYPSTP0Wgo

To claim this, I am signing this object:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/upstream-hash-by: "$arg_predictorid"
nginx.ingress.kubernetes.io/upstream-hash-by-subset: "true"
nginx.ingress.kubernetes.io/upstream-hash-by-subset-size: "3"
name: nginxhello-ingress
namespace: default
spec:
@diegows
diegows / lb_hash_subset.py
Created September 21, 2018 02:38
Hash load balance to a sub set of nodes
import collections
import random
from hash_ring import HashRing
from pprint import pprint
nodes = range(10)
nodes_dist = []
for i in range(len(nodes)):
# env | grep -i proxy
http_proxy=http://10.12.61.56:8080
ftp_proxy=http://10.12.61.56:8080
https_proxy=http://10.12.61.56:8080
diegows@diegows-laptop:/tmp$ bash -x test.sh ; echo $?
+ '[' -f /bin/false ']'
+ /bin/false
+ echo 1
1
0
diegows@diegows-laptop:/tmp$
varnish:
vhost:
example.com:
- backend1
- backend2
- backend3
example2.com:
- backend4
- backend5
- backend6
[20/Jan/2014:21:12:50 -0300] - _csngen_adjust_local_time: gen state
before 52ddb8ec0001:1390262479:0:29
[20/Jan/2014:21:12:50 -0300] - _csngen_adjust_local_time: gen state
after 52ddbb9f0000:1390263170:0:29
[20/Jan/2014:21:12:50 -0300] NSMMReplicationPlugin -
ruv_add_csn_inprogress: successfully inserted csn 52ddbb9f000000630000
into pending list
[20/Jan/2014:21:12:50 -0300] NSMMReplicationPlugin - Purged state
information from entry
uid=zzj,ou=People,ou=branch,ou=branches,dc=site,dc=ar up to CSN
@diegows
diegows / gist:8533410
Last active January 3, 2016 23:09
3 nodes Accumulo cluster (m1.large) kvlayer node m1.xlarge
100 MB written in 20.2 seconds --> 5.0 MB/sec across 1 workers for storage_type=accumulo
100 MB written in 21.0 seconds --> 4.8 MB/sec across 1 workers for storage_type=accumulo
500 MB written in 23.2 seconds --> 21.5 MB/sec across 5 workers for storage_type=accumulo
500 MB written in 15.3 seconds --> 32.6 MB/sec across 5 workers for storage_type=accumulo
1000 MB written in 54.0 seconds --> 18.5 MB/sec across 10 workers for storage_type=accumulo
1000 MB written in 38.0 seconds --> 26.3 MB/sec across 10 workers for storage_type=accumulo
2500 MB written in 159.9 seconds --> 15.6 MB/sec across 25 workers for storage_type=accumulo
2500 MB written in 162.9 seconds --> 15.3 MB/sec across 25 workers for storage_type=accumulo
5000 MB written in 376.1 seconds --> 13.3 MB/sec across 50 workers for storage_type=accumulo
5000 MB written in 402.3 seconds --> 12.4 MB/sec across 50 workers for storage_type=accumulo
@diegows
diegows / base.py
Last active December 23, 2015 06:59
CSDocument class, a class to be used with Mongoengine's Document class to create documents. It allows DB switch on the fly.
import threading
import warnings
from collections import defaultdict
from mongoengine import *
from mongoengine.connection import get_db
def dbconnect(company):
global company_name
@diegows
diegows / ssh-agent
Last active December 21, 2015 04:49 — forked from rezlam/ssh-agent
pgrep is better for this job. ps ax | grep ssh-agent founds the grep itself and fails.
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null