Skip to content

Instantly share code, notes, and snippets.

View fsodogandji's full-sized avatar

Fabrice Sodogandji fsodogandji

View GitHub Profile
@fsodogandji
fsodogandji / cmd.sh
Last active December 20, 2015 06:59
java tips
#launch jstatd daemon
jstatd -J-Djava.security.policy=jstatd.all.policy
@fsodogandji
fsodogandji / fibonacci_matrix.py
Last active December 21, 2015 05:09
Fibonacci calculation with matrix ...
from numpy import matrix
F = matrix('0 1; 1 1')
"""
F = [[ Fn-1 Fn ] = [[0 1]
Fn Fn+1]] [1, 1]]
"""
result = F**5
app.config field riak.conf variable
-------------------------------------------------------------------------------------------
yokozuna.enabled yokozuna
yokozuna.solr_port yokozuna.solr_port
yokozuna.solr_jmx_port yokozuna.solr_jmx_port
yokozuna.solr_jvm_args yokozuna.solr_jvm_args
yokozuna.yz_dir yokozuna.data_dir
riak_repl.data_root mdc.data_root
riak_core.cluster_mgr mdc.cluster_manager
riak_repl.max_fssource_cluster mdc.max_fssource_cluster
@fsodogandji
fsodogandji / git-tips_tricks.md
Last active January 1, 2016 07:29
Install the last version ogf git

####Install git with git mainteners ppa

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
Enabling colors in git command-line interface
git config color.ui true    
@fsodogandji
fsodogandji / saltstack_tips.sh
Last active January 1, 2016 12:49
salt tips & tricks
#run a test.ping on all minions:
salt '*' test.ping
# run a command on all minions:
salt '*' cmd.run "service salt-minion restart"
# run a command on a nodegroup calls warm_stdby:
salt -N warm_stdby cmd.run "hostname"
#list les id with x86_64 cpu
@fsodogandji
fsodogandji / bench_sort.erl
Created January 9, 2014 16:04
A Renaud's powered bench :)
f(F),F=fun(N)->S=self(),G=fun(_,0,_,L)->L;(G1,N1,Ref,L)->receive {Ref, Ret}-> G1(G1,N1-1,Ref,[Ret|L]) end end,
Ref=erlang:make_ref(),L=[random:uniform(1000)||_<-lists:seq(1,N)],
FW=fun()->S ! {Ref,lists:foldl(fun(J,A)->lists:sort(L) end,1,L)} end,
{T,_V}=timer:tc(fun()->[spawn( FW )||_I <-L],G(G,length(L),Ref,[]) end),T/1000 end.
F(100).
@fsodogandji
fsodogandji / vectors-field-latex.py
Created January 10, 2014 09:56
Visualize vectors field with matplotlib & Latex legends. Taken from http://numbercrunch.de/blog/2013/05/visualizing-vector-fields/
# import useful modules
import matplotlib
from numpy import *
from pylab import *
# use LaTeX, choose nice some looking fonts and tweak some settings
matplotlib.rc('font', family='serif')
matplotlib.rc('font', size=16)
matplotlib.rc('legend', fontsize=16)
matplotlib.rc('legend', numpoints=1)
@fsodogandji
fsodogandji / socat-tips.sh
Last active August 8, 2025 04:36
socat tips & tricks
#To create a classic TCP listening daemon, similar to netcat -l, use a variation of the following command.
socat TCP-LISTEN:8080 stdout
#use remotly a command shell
socat TCP4-LISTEN:1234,reuseaddr,fork 'SYSTEM:/bin/cat /home/infos.txt'
#sslify a server
socat OPENSSL-LISTEN:443,reuse‐addr,pf=ip4,fork,cert=server.pem,cafile=client.crt TCP4-CONNECT:localhost:80
#from http://en.wikipedia.org/wiki/Function_composition_(computer_science)
def compose(*funcs):
"""Compose a group of functions (f(g(h(..)))) into a single composite func"""
return reduce(lambda f, g: lambda *args, **kwargs: f(g(*args, **kwargs)), funcs)
# Example
f = lambda x: x+1
g = lambda x: x*2
h = lambda x: x-3
@fsodogandji
fsodogandji / postgresql_tips_tricks.sql
Created January 29, 2014 17:59
postgresql queries, tips & tricks
#generate a time series
SELECT to_(DATE '2008-01-01' + (interval '12 second' * generate_series(0,57)), 'YYYY-MM-DD') AS ym