####Install git with git mainteners ppa
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
git config color.ui true
| #launch jstatd daemon | |
| jstatd -J-Djava.security.policy=jstatd.all.policy |
| 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 |
| #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 |
| 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). |
| # 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) |
| #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 | |
| #generate a time series | |
| SELECT to_(DATE '2008-01-01' + (interval '12 second' * generate_series(0,57)), 'YYYY-MM-DD') AS ym |