Skip to content

Instantly share code, notes, and snippets.

View strootman's full-sized avatar
🤘

Jonathan D Strootman strootman

🤘
View GitHub Profile
@strootman
strootman / gist:90ee221198c71dfad34f6abb15ed837a
Created April 10, 2017 20:46 — forked from lukas-vlcek/gist:5143799
Adding a new analyzer into existing index in Elasticsearch (requires close/open the index). Tested with Elasticsearch 0.19.12.
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{
@strootman
strootman / etc-nginx-nginx.conf
Created April 18, 2017 22:40 — forked from aaronfeng/etc-nginx-nginx.conf
nginx json log format
# /etc/nginx/nginx.conf
log_format main '{'
'"remote_addr": "$remote_addr",'
'"remote_user": "$remote_user",'
'"time_local": "$time_local",'
'"request": "$request",'
'"status": "$status",'
'"body_bytes_sent": "$body_bytes_sent",'
'"http_referer": "$http_referer",'
@strootman
strootman / git-log2json.sh
Created October 12, 2017 22:11 — forked from textarcana/git-log2json.sh
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features :) UPDATED 2017: Today I would just use https://github.com/tarmstrong/git2json
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@strootman
strootman / pre-push
Last active May 20, 2019 03:41 — forked from chadmaughan/pre-commit.sh
A pre-push git hook which runs a gradle test task
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'