Skip to content

Instantly share code, notes, and snippets.

nmap <Left> <<
nmap <Right> >>
vmap <Left> <gv
vmap <Right> >gv
git rev-list --all --objects | \
sed -n $(git rev-list --objects --all | \
cut -f1 -d' ' | \
git cat-file --batch-check | \
grep blob | \
sort -n -k 3 | \
tail -n40 | \
while read hash type size; do
echo -n "-e s/$hash/$size/p ";
done) | \
from jinja2 import Environment
tmpl = Environment().from_string("""\
{% set fluentd_tokens_dict = {'appName' : {'prod': {'app' : 45}}, 'app2': { 'app' : 21 }} %}
{% for item in fluentd_tokens_dict %}
{{ item }}:
{% for key in fluentd_tokens_dict[item] %}
{{ key }}:
{% for skey in fluentd_tokens_dict[item][key] %}
{{ skey }}: {{ fluentd_tokens_dict[item][key][skey] }}
[foo]
10.1.200.5
[bar]
10.1.200.6
[production:children]
foo
bar
listen foo-bar-something--test--sst-12300
bind 0.0.0.0:12300
option tcplog
balance leastconn
mode http
cookie LKS insert nocache maxidle 30m maxlife 1h
server foo-bar-something--test--sst-1 10.23.9.232:31005 check cookie 64c42efaaAA9d132AA24fb5eAA042fc7
<134>Feb 8 16:13:43 haproxy[4621]: 172.0.0.0:52831 [08/Feb/2015:16:13:43.483] foo foo/bar 0/0/15 673 -- 22/5/5/0/0 0/0a
# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:24224 0.0.0.0:* LISTEN -
udp 0 0 0.0.0.0:24224 0.0.0.0:* -
Active UNIX domain sockets (only servers)
upstream series {
server 127.0.0.1:32400;
}
server {
listen 0.0.0.0:80;
server_name series.hito.be;
access_log /var/log/nginx/series.hito.log;
location / {
{
"query" : {
"bool" : {
"must" : {
"match": { "message": "foo" },
"range": { "price": { "gte": 0, "lte": 5000 } }
}
}
}
}
filter {
if [type] == "apache" {
grep {
match => [ "message", "\/bars\/get\/id\/.{24}"]
}
grok {
pattern => "%{COMBINEDAPACHELOG}"
add_field => {
"barid" = > someRegexHereToExtractIdFromRequest
}