Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Bob Maerten bobmaerten

🏠
Working from home
Block or report user

Report or block bobmaerten

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
@bobmaerten
bobmaerten / git-prune-tracked-branches
Created Oct 28, 2016
Merged tracked branches pruning to keep .git/config file clean
View git-prune-tracked-branches
#!/usr/bin/env bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
[ $current_branch == "master" ] || git checkout master
git fetch --all -p --tags
git pull
for BRANCH in $(git branch --merged origin/master | grep -v "\* master")
do
View gist:b69bbeca0cde95b99a7a7b285d977548
day-activity = "!f() { git log --all --committer=<Insert Name here> --pretty=tformat:'%<(80,trunc) %s %Cred%ci%Creset' --abbrev-commit --after='yesterday' | pbcopy; pbpaste; }; f"
@bobmaerten
bobmaerten / untitled
Created Feb 10, 2016
Docker create and serve default jekyll image
View untitled
$ docker-machine use bobmaerten
$ docker create --name jekyll_site -v /srv/jekyll jekyll/jekyll
$ docker run --rm --label=jekyll --volumes-from jekyll_site -it -p 4000:4000 jekyll/jekyll jekyll new .
$ docker run --rm --label=jekyll --volumes-from jekyll_site -it -p 4000:4000 jekyll/jekyll
View config
input {
file {
type => "apache"
path => [ "/data/*.log" ]
start_position => "beginning"
}
}
filter {
grok {
View keybase.md

Keybase proof

I hereby claim:

  • I am bobmaerten on github.
  • I am bobmaerten (https://keybase.io/bobmaerten) on keybase.
  • I have a public key whose fingerprint is D422 3721 3686 DA7E C0E8 DD95 90C3 B7F1 8142 244D

To claim this, I am signing this object:

@bobmaerten
bobmaerten / run_php.sh
Created May 27, 2015
Run PHP CLI script with Docker
View run_php.sh
#!/usr/bin/env bash
die() { echo "$@" 1>&2 ; exit 1; }
[ "$#" -ne 1 ] && die "usage: $0 <php script>"
head -n 1 $1 | grep -q "^<?php" || die "error: only runs php scripts"
eval "$(docker-machine env dev)"
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp php:5.6-cli php $1
@bobmaerten
bobmaerten / gist:c454ad03dbf81f72c220
Created Sep 30, 2014
Remember to update your docker images too!
View gist:c454ad03dbf81f72c220
❯ docker run --rm -i -t debian /bin/bash
root@bafbca8fc9af:/# env X='() { (a)=>\' bash -c "echo echo vuln"; [[ "$(cat echo)" == "vuln" ]] && echo "still vulnerable :("^C
root@bafbca8fc9af:/#
root@bafbca8fc9af:/#
root@bafbca8fc9af:/#
root@bafbca8fc9af:/# exit
❯ docker run --rm -i -t debian /bin/bash
root@feff7506db14:/# # test CVE-2014-6271
root@feff7506db14:/# env x='() { :;}; echo vulnerable' bash -c echo
View mysql-on-demand.sh
#!/usr/bin/env bash
usage() {
echo "Usage: `basename $0` {start|stop|status|connect}"
exit 1
}
if [ -z "$1" ]; then
usage
fi
@bobmaerten
bobmaerten / default
Created Apr 29, 2014
Reverse proxy configuration with Apache/httpd mod_macro
View default
<Macro RedirSSL ${domain}>
<VirtualHost *:80>
ServerName ${domain}.domain.com
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
</Macro>
#-------
@bobmaerten
bobmaerten / pgsql-docker
Last active Jul 27, 2018
Start/Stop/Status Shell script for managing docker-postgresql container from @kamui
View pgsql-docker
#!/usr/bin/env bash
PGSQL_DATA_PATH='/data/pg'
SERVER_CONTAINER="postgresql-server"
DATA_CONTAINER="postgresql-data"
function getStatus(){
CONTAINER_ID=$(docker ps -a | grep -v Exit | grep $SERVER_CONTAINER | awk '{print $1}')
if [[ -z $CONTAINER_ID ]] ; then
echo 'Not running.'
You can’t perform that action at this time.