Skip to content

Instantly share code, notes, and snippets.

Jonathan D Strootman strootman

Block or report user

Report or block strootman

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
@strootman
strootman / git-log2json.sh
Created Oct 12, 2017 — 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
View git-log2json.sh
#!/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/},]/}]/'
View etc-nginx-nginx.conf
# /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 / gist:90ee221198c71dfad34f6abb15ed837a
Created Apr 10, 2017 — 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.
View gist:90ee221198c71dfad34f6abb15ed837a
// 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 / elasticsearch.md
Created Apr 10, 2017 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index
View elasticsearch.md

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@strootman
strootman / default-w-var-sub.yml
Created Jul 22, 2016
Example of using the `default()` jinja filter with a variable
View default-w-var-sub.yml
# 1.
# $ ansible-playbook default-w-var-sub.yml
#
# PLAY [Test default variable using substitution] ********************************
#
@strootman
strootman / pr.md
Created Mar 30, 2016 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@strootman
strootman / journal.go
Created Mar 3, 2016 — forked from stuart-warren/journal.go
Golang read from systemd journal
View journal.go
package journal
// #cgo pkg-config: --cflags --libs libsystemd-journal
// #include <systemd/sd-journal.h>
import (
"C"
)
func New() (j *C.struct_sd_journal) {
j = new(C.struct_sd_journal)
@strootman
strootman / groups_for_hosts.txt.j2
Created Nov 24, 2015
A means of determining which inventory groups are associated with a given host
View groups_for_hosts.txt.j2
{{inventory_hostname}}
========================
{% for group in group_names %}
{{ group }}
{% endfor %}
---
@strootman
strootman / dump_all_vars.yaml
Created Nov 24, 2015
A way to dump all the vars for a host. Must be used with `--limit`, otherwise, last host wins.
View dump_all_vars.yaml
---
- name: Dump all vars
hosts: all
tasks:
- name: Dump all vars
template: src=scripts/dump_vars.j2 dest=/tmp/ansible.all
@strootman
strootman / pre-push
Last active May 20, 2019 — forked from chadmaughan/pre-commit.sh
A pre-push git hook which runs a gradle test task
View pre-push
#!/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'
You can’t perform that action at this time.