Skip to content

Instantly share code, notes, and snippets.

@ric03uec
ric03uec / client.out
Created September 25, 2014 18:08
libswarm local test(failed)
// cloned libswarm
// installed using: cd path/to/libswarm/ && make deps && go install github.com/ric03uec/libswarm/swarmd
// swarmd then present in $GOPATH/bin/
$ docker -H localhost:4243 ps
@ric03uec
ric03uec / find.py
Last active August 29, 2015 14:05
glob comparison
#!/usr/bin/python
import os, subprocess
import glob2
import glob
curr_dir = os.getcwd()
def initialize():
print("current directory: {0}".format(curr_dir))
init_cmd = "cd {0} && rm -rf testing && mkdir -p testing && touch testing/coverage.xml && echo 'coveragedata' >> testing/coverage.xml".format(curr_dir)
@ric03uec
ric03uec / output
Last active August 29, 2015 14:02
python subprocess i/o redirection
$ ./runner.py
__NO_REDIRECTION_ON_PARENT__
------ executing main thread ----------
----- parent stdout --------
executing script 1
executing script 2
----- parent stderr --------
@ric03uec
ric03uec / ls.conf
Created February 2, 2014 10:19
logstash dockerfile
FROM ubuntu:12.04
MAINTAINER Devashish "[email protected]"
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN locale-gen en_US en_US.UTF-8;
RUN dpkg-reconfigure locales;
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections;
input {
stdin {
type => "stdin-type"
}
rabbitmq {
exchange => "rabbimq_exchange"
host => "172.17.0.2"
key => "key.exceptions"
queue => "queue.exceptions"
$ java -jar logstash.jar agent -f ls.conf
hello world
{
"message" => "hello world",
"@version" => "1",
"@timestamp" => "2014-02-02T09:47:17.232Z",
"type" => "stdin-type",
"host" => "<hostname>"
@ric03uec
ric03uec / ls.conf
Last active August 29, 2015 13:55
lsconfig
input {
stdin {
type => "stdin-type"
}
}
output {
stdout { codec => rubydebug }
}
@ric03uec
ric03uec / installls.sh
Created February 2, 2014 09:24
install logstash
$ mkdir ~/lsdocker && cd ~/lsdocker
$ wget https://download.elasticsearch.org/logstash/logstash/logstash-1.3.3-flatjar.jar
$ mv logstash-1.3.3-flatjar.jar logstash.jar
$ free -k
total used free shared buffers cached
Mem: 502936 479724 23212 0 7872 89016
-/+ buffers/cache: 382836 120100
Swap: 1048572 940600 107972
@ric03uec
ric03uec / vmstat
Created September 28, 2013 23:15
system fluctuation on starting too many docker containers at once
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 726436 9584 9372 72132 0 0 0 66 94 259 6 5 89 0
2 0 915176 13468 8312 77440 100 5818 11028 5976 1605 1494 28 61 11 1
4 1 855756 40216 2940 52516 344 64056 32980 74284 2949 3885 24 72 5 1
1 0 908288 10860 2412 82680 2684 29272 26826 39244 1858 4379 23 57 21 0
4 2 908000 10196 2416 83600 194 0 632 0 181 472 10 10 80 0
0 0 907756 10124 2560 83680 238 0 312 2 149 403 5 7 88 0