Skip to content

Instantly share code, notes, and snippets.

View tolleiv's full-sized avatar

Tolleiv Nietsch tolleiv

  • Bare.ID Gmbh - an AOE Group company
  • Wiesbaden, Deutschland
View GitHub Profile
set -e # Fail fast
DISTRIBUTION_ID=xxxxxxxxxxxxxxxx
BUCKET_NAME=xxxxxxxxxxxxxx
aws s3 sync --acl "public-read" --sse "AES256" public/ s3://$BUCKET_NAME --exclude 'post'
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths /index.html / /page/*
@tolleiv
tolleiv / helm.sh
Created July 15, 2017 06:43
Have a service account for helm/tiller only
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade
helm list
@tolleiv
tolleiv / transform.sh
Created June 28, 2017 12:09
Minimal script to transform a list of files into the full tree with all parent folders (used to generate rsync-filters)
#!/bin/sh
while read -r line ; do
DIR=$(dirname $line)
ORIG_IFS=$IFS
IFS='/'
subpath=""
for i in $DIR; do
subpath+="$i/"
echo "$subpath"
done
@tolleiv
tolleiv / README.md
Last active April 18, 2017 21:19
Small project which sends measurements from an DHT22 sensor via MQTT into my home automation void.
begin remote
name pacman
bits 16
flags SPACE_ENC
eps 30
aeps 100
header 9101 4482
#!/bin/bash
docker network create --driver bridge es_nw
docker run -d --name es_master --network=es_nw -p 9200:9200 tolleiv/misc:elaticsearch_w_hq
docker run -d --name es_node1 --network=es_nw tolleiv/misc:elaticsearch_w_hq elasticsearch --discovery.zen.ping.unicast.hosts=es_master
docker run -d --name es_node2 --network=es_nw tolleiv/misc:elaticsearch_w_hq elasticsearch --discovery.zen.ping.unicast.hosts=es_master
docker run --rm -e ES_URL=es_master:9200 --network=es_nw tolleiv/misc:es_sampledata
@tolleiv
tolleiv / check-braces.sh
Last active October 14, 2016 11:54
Compare the amount of opening and closing braces in a file. This can be used as trivial check for Puppet scripts before Puppetlint is used. It might show false positive in case curly braces are embedded in strings.
#!/bin/bash
FILE=$1
function remove_comments {
sed -e 's/#.*$//'
}
OPEN_BRACES=$(cat $FILE | remove_comments | fgrep -o \{ | wc -l)

Keybase proof

I hereby claim:

  • I am tolleiv on github.
  • I am tolleiv (https://keybase.io/tolleiv) on keybase.
  • I have a public key ASAhYrggSYUZyL__mexfVzK1c5YE7nVPf1GbW4NZZ-tzJQo

To claim this, I am signing this object:

@tolleiv
tolleiv / php.conf
Created August 23, 2016 07:39
Logstash PHP multiline
#
# Configure php error log filtering
#
filter {
if [type] == "php-error" {
multiline {
pattern => "%{SYSLOG5424SD:timestamp} PHP (?:%{LOGLEVEL:loglevel})"
negate => true
what => "previous"
}
@tolleiv
tolleiv / Installation.md
Created June 30, 2016 09:35 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges