Skip to content

Instantly share code, notes, and snippets.

View camathieu's full-sized avatar
💭
Feeling Awesome

Charles-Antoine Mathieu camathieu

💭
Feeling Awesome
View GitHub Profile
@camathieu
camathieu / supervisorctl.bash_completion
Created April 3, 2018 08:26
bash completion for supervisorctl
# pfreixes, 2012-07-27
# Add to /etc/bash_completion.d/supervisorctl
_supervisor()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@camathieu
camathieu / fmm.go
Created August 30, 2017 15:07
Full mesh monitoring
package main
import (
"log"
"flag"
"net"
"strings"
"time"
"os"
"os/signal"
@camathieu
camathieu / vhost
Created July 5, 2015 20:42
plik nginx configuration
upstream plik {
server 127.0.0.1:8080;
server 127.0.0.1:8081;
}
upstream stream {
server 127.0.0.1:8080;
server 127.0.0.1:8081;
hash $key;
}
@camathieu
camathieu / FuzzyRowFilter.java
Last active August 29, 2015 14:13
FuzzyRowFilter
/*
* Copyright (C) 2014 The Async HBase Authors. All rights reserved.
* This file is part of Async HBase.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
@camathieu
camathieu / cidr_tree.go
Created October 7, 2014 08:08
CIDR tree for blacklist matching purpose.
package utils
/*
* Charles-Antoine.Mathieu <skatkatt@root.gg>
* CIDR tree for blacklist matching purpose.
*
* It's actually a simple binary tree with each node matching a byte
* of the cidr until the mask is exhausted. The tree has to be walked
* from the root following one of the two available pointers depending
* if the ip to be matched is above of below the median stored in the node.
@camathieu
camathieu / Big-O
Created October 1, 2014 20:07
Big-O
The simplest definition I can give for Big-O notation is this:
Big-O notation is a relative representation of the complexity of an algorithm.
There are some important and deliberately chosen words in that sentence:
relative: you can only compare apples to apples. You can't compare an algorithm to do arithmetic multiplication to an algorithm that sorts a list of integers. But a comparison of two algorithms to do arithmetic operations (one multiplication, one addition) will tell you something meaningful;
representation: Big-O (in its simplest form) reduces the comparison between algorithms to a single variable. That variable is chosen based on observations or assumptions. For example, sorting algorithms are typically compared based on comparison operations (comparing two nodes to determine their relative ordering). This assumes that comparison is expensive. But what if comparison is cheap but swapping is expensive? It changes the comparison; and
complexity: if it takes me one second to sort 10,000 elements h
@camathieu
camathieu / create-table.sh
Created September 16, 2014 10:22
my opentsdb create-table.sh
#!/bin/sh
# Small script to setup the HBase tables used by OpenTSDB.
# Taken from git://github.com/stumbleupon/opentsdb.git
# Version: 1.1.0
test -n "$HBASE_HOME" || {
echo >&2 'The environment variable HBASE_HOME must be set'
exit 1
}
test -d "$HBASE_HOME" || {
@camathieu
camathieu / parse_rs_logs.sh
Last active August 29, 2015 14:06
Parse hbase regions server logs
#!/bin/bash
###
# Charles-Antoine Mathieu <skatkatt@root.gg>
#
# Parse memstore flushes in hbase rs logs (tested against hbase 0.96)
# $1 : rs log file
# $2 : command : flush | major
###

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination
@camathieu
camathieu / Best Hello World ever
Created February 2, 2014 01:27
Best Hello World ever
''=~('('."\?".
'{'.('`'|'%').('['^'-'
).('`'|'!'). ("\`"| ','
).'"'.('['^'.'). ((( '['
))^'(').('`'|('%')).( '{'
^'[').('{'^'/').('`'|')') .+(
'`'|'-').('`'|'%').':'.':'.( '`'
^'(').('`'|')').('{'^')').( '`'
|(( '%'))).('['^'(').'\\'.'"' .+(
'[' ^'.').('['^'(').("\`"| ','