Skip to content

Instantly share code, notes, and snippets.

Mik Kocikowski mkocikowski

Block or report user

Report or block mkocikowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mkocikowski / ca.cnf
Last active May 19, 2016
openssl CA configuration file
View ca.cnf
[ ca ]
default_ca = ca_default
[ ca_default ]
base_dir = $ENV::HOME/.ssh
certificate = $base_dir/datapipe-ca.crt
copy_extensions = copy
database = $base_dir/index.txt
default_days = 365
default_md = sha256
mkocikowski /
Created May 13, 2016
Check amount of RAM used by current python process
import os
# pip install psutil
import psutil
mb = psutil.Process(os.getpid()).memory_info()[0]>>20
mkocikowski /
Last active Feb 9, 2016
get IP of eth1 on Vagrant private network (DHCP)
vagrant ssh -c 'ifconfig eth1' | awk '/inet addr/{print substr($2,6)}'
mkocikowski /
Last active Nov 10, 2015
Check elasticsearch cluster status
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true' -s \
| grep 'status' \
| test 'green' == `awk -F '"' '{ print $4 }'` ;
mkocikowski / gist:aeca878d58d313e902bb
Last active Dec 11, 2019
Setting up Redis to run as a daemon under systemd
View gist:aeca878d58d313e902bb

This can be used to daemonize anything that would normally run in the foreground; I picked Redis. Put this in /etc/systemd/system/redis.service:


ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
View .vimrc
syntax on
filetype indent plugin on
map <C-\> {gq}
execute pathogen#infect()
" yaml
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" always display status line
mkocikowski / gist:37114a5232bd3fa2d145
Last active Aug 29, 2015
Delete all closed indexes from Elasticsearch cluster
View gist:37114a5232bd3fa2d145
curl -s 'localhost:9200/_cat/indices' | grep close | awk '{ printf "http://localhost:9200/%s\n", $2 }' | xargs -n 1 curl -i -XDELETE
mkocikowski / gist:8fd2728a9c66e5bb9aa2
Created Jun 3, 2015
Iterable chunker with no batch size limits
View gist:8fd2728a9c66e5bb9aa2
def chunker(iterable=None, chunklen=None):
"""Collects data into fixed-length chunks.
Returns: iterator of iterators. Does not pad the last chunk.
Raises: TypeError on bad iterable or chunklen
Example: chunker("abcde", 2) returns (('a', 'b'), ('c', 'd'), ('e'))
This is better than the functools 'grouper' recipe (using izip on
[iter(iterable)] * n) in that there is no performance penalty for
View gist:f4c943358bc428a6d897
$ foo='() { echo not patched; }' bash -c foo
bash: foo: command not found
w00t! Not vulnerable.
mkocikowski / gist:59971a1bcf207628134c
Created May 9, 2014
.bash_profile for maven and jdk 7 mavericks
View gist:59971a1bcf207628134c
export M2_HOME=/usr/local/share/apache-maven-3.2.1
export PATH=$PATH:$M2_HOME/bin
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
You can’t perform that action at this time.