Skip to content

Instantly share code, notes, and snippets.

View purbon's full-sized avatar

Pere Urbón purbon

View GitHub Profile
@purbon
purbon / zook_grow.md
Created May 8, 2020 15:39 — forked from miketheman/zook_grow.md
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble

@purbon
purbon / cpu_stress.sh
Created April 18, 2019 10:51 — forked from yalla/cpu_stress.sh
Small CPU load testing script which uses openssl and is kinda bulletproof on Linux.
#!/bin/bash
NUMCPUS=`grep -c processor /proc/cpuinfo`
if [ -z "$1" ] ; then
NUMINSTANCES=2
else
echo $1 | grep "^[0-9]*$" >/dev/null
if [ "$?" -ne 0 ] ; then
echo Argument $1 is not a number. Aborting.
@purbon
purbon / SSLPoke.java
Created October 25, 2018 14:58 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the commet #1 for howto.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@purbon
purbon / ECDH_BC.java
Created April 18, 2018 16:21 — forked from wuyongzheng/ECDH_BC.java
Elliptic curve Diffie–Hellman using Bouncy Castle v1.50 example code
import java.math.BigInteger;
import java.security.PublicKey;
import java.security.PrivateKey;
import java.security.KeyFactory;
import java.security.Security;
import java.security.KeyPairGenerator;
import java.security.KeyPair;
import java.security.SecureRandom;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.ECGenParameterSpec;
@purbon
purbon / yardoc_cheatsheet.md
Created June 2, 2016 15:59 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

@purbon
purbon / es.sh
Last active August 29, 2015 14:14 — forked from anonymous/es.sh
#!/bin/bash
ES_URL='https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.1.tar.gz'
ES_HOME='/tmp/es'
DATA_DIR_ES='/tmp/es/data'
ES_PID=$ES_HOME/es.pid
update_config ()
{
config="cluster.name: temp-tal-elasticsearch
  1. General Background and Overview
/**
* Read the value of a header in the current document.
*
* This uses a [single] XMLHTTPRequest to do a HEAD of the current document
* and fetch HTTP response header values. Note that the implementation is
* rather stupid in that it spins waiting for the XMLHTTPRequest to complete
* if it hasn't been called yet.
*
* @param name string
@purbon
purbon / package.json
Created September 21, 2012 18:54
Stream live web cam video using Node.js and Gstreamer
{
"name": "streamingtest",
"version": "0.0.1",
"engines": {
"node": ">=0.6.0"
},
"dependencies": {
"express": "2.5.x",
"coffee-script": "1.2.x"
},
@purbon
purbon / otsbjs.md
Created July 20, 2012 14:05 — forked from agnoster/otsbjs.md
Open Tech School Berlin JS

In the spirit of Railsgirls Berlin, we want to start a programming education group for JavaScript. We need your help to get all the coaching done.

If you are interested in coaching JavaScript, fork this gist and add yourself or leave your contact data in a comment: