Skip to content

Instantly share code, notes, and snippets.

@mmaassen
mmaassen / playbook-unbound.yml
Created September 27, 2021 14:18
Ansible playbook to install unbound docker container
---
- hosts: unbound_docker
become: true
handlers:
- name: "Re/Start unbound"
shell: docker-compose up -d --force-recreate
args:
chdir: "{{ unbound_compose_dir | default('/opt/unbound') }}"
listen: "handler_restart_unbound"
#!/bin/bash
BASEPATH=$(dirname $0)
source $BASEPATH/functions.sh
LOGFILE="$LOGPATH/$(basename $0).log"
exec > >(tee -i $LOGFILE)
checkSudo
ARRAY="$@"
@mmaassen
mmaassen / install_psql_php.sh
Last active October 13, 2015 07:35 — forked from giorgiofellipe/install_psql_php.sh
Install PHP PGSQL extensions on Mac OS X Yosemite (change PHP_VER with your PHP version)
PHP_VER=$(php -v | head -1 | awk '{print $2}')
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
# Download PHP source and extract
@mmaassen
mmaassen / clearJenkinsBuilds.sh
Created March 6, 2015 09:48
Script to cleanup jenkins build
#!/bin/bash
## How many builds do you want to keep
KEEP_LAST_BUILDS=5
if [[ $# -lt 2 ]]; then
echo "Usage: $(basename $0) 'url' 'project name'"
echo "Example: $(basename $0) 'http://jenkins.example.com' 'example'"
exit 1
fi
@mmaassen
mmaassen / monitorConnection.sh
Created February 17, 2014 08:18
Script to notify you when a connection restores
#!/bin/bash
SLEEP=30
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <host> <port>"
exit
fi
TESTHOST=$1
@mmaassen
mmaassen / logstash_stacktrace_find.conf
Created December 10, 2013 11:19
Logstash filter to add a tag if a stack trace is found in the message
filter {
grep {
match => [ "message", "(^.+Exception: .+)|(^\s+at .+)|(^at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)|(^Caused by:.+)" ]
add_tag => [ "has_stacktrace" ]
}
}
@mmaassen
mmaassen / weblogic-shipper.conf
Last active May 11, 2019 16:31
LogStash (1.2.2) WebLogic Server shipper
input {
## WebLogic Server Log
file {
type => "weblogic"
path => [ "/var/log/weblogic/domain/managedserver.log" ]
codec => multiline {
pattern => "^####"
negate => true
what => previous
}
@mmaassen
mmaassen / gist:7783808
Last active December 30, 2015 05:39
Remove key from known_hosts, OSX
#!/bin/bash
## use on OSX
if [[ $# -eq 0 ]]; then
echo "Remove key from known"
echo "Usage: $0 <linenum>"
else
sed -i '' "${1},${1}d" ~/.ssh/known_hosts
fi
#!/bin/bash
CURL=`which curl`
GAWK=`which gawk`
case $1 in
10 )
URL="http://www.speedtest2.nl/download/10mb.bin.zip"
;;
http*)
URL=$1
;;
@mmaassen
mmaassen / m3u8sort.sh
Created July 27, 2013 18:07
Was cutting a m3u8 file containing IPTV channels. Figured the best way to sort them is by scripting it just for the fun of it. m3u8sort.sh does what it says it sorts it.
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <path/to/m3u8>"
exit
fi
FILE=$1
TMPFILE="$FILE.new"