Skip to content

Instantly share code, notes, and snippets.

@piavlo
piavlo / 0_reuse_code.js
Created April 22, 2016 15:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@piavlo
piavlo / gist:8306135
Last active January 2, 2016 12:49 — forked from dropwhile/py27.txt
mkdir download /tmp/installdir; cd download;
curl -LO http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar xf Python-2.7.6.tgz
cd Python-2.7.6
yum -y install openssl-devel.x86_64 readline-devel.x86_64 bzip2-devel.x86_64 sqlite-devel.x86_64 zlib-devel.x86_64 ncurses-devel.x86_64 db4-devel.x86_64 expat-devel.x86_64 rpm-build.x86_64
env CC=gcc44 CXX=g++44./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared --enable-ipv6
make -j2
make install DESTDIR=/tmp/installdir
echo '/sbin/ldconfig' > /tmp/installdir/run-ldconfig.sh
fpm -s dir -t rpm -n python27 -v 2.7.6 -C /tmp/installdir \
#!/bin/bash
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
echo >&2 "fatal: hooks/functions: GIT_DIR not set"
exit 1
fi
read oldrev newrev refname
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
input {
redis {
data_type => "list"
host => "10.0.0.1"
key => "q1"
port => 6379
type => "redis2_q1"
threads => 1
batch_events => 100
}
@piavlo
piavlo / backup.sh
Created July 20, 2012 18:53 — forked from karussell/backup.sh
Backup ElasticSearch with rsync
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing