Skip to content

Instantly share code, notes, and snippets.

@martinseener
martinseener / gist:9411739
Last active Aug 29, 2015
Shrinking Virtual Machine Boxes
View gist:9411739

Shrinking Virtual Boxes

  • Remove manuals

rm -rf /usr/share/doc

  • Remove VirtualBox OSE

rm -rf /usr/src/vboxguest*
rm -rf /usr/src/virtualbox-ose-guest*

View package-graphite.sh
#! /bin/bash
#
# This script needs "fpm". If you dont have it,
# run "gem install fpm"
#
# You also need to "apt-get install python-setuptools" (otherwise fpm fails)
clean() {
rm -rf whisper-0.9.9 carbon-0.9.9 graphite-web-0.9.9
@martinseener
martinseener / carbon-cache.sh
Last active Aug 29, 2015
Debian init script for Graphite's carbon-cache daemon
View carbon-cache.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@martinseener
martinseener / rork.sh
Created Jun 25, 2014
RORK (Redmine Orphaned Repositories Killer)
View rork.sh
#!/usr/bin/env bash
# Rork v.0.1 (Redmine Orphaned Repositories Killer)
# (c) 2014 Martin Seener (martin@seener.de)
# Deletes orphaned Redmine Repositories which cannot be deleted from within Redmine
# Usage: You only need the original path to the repository. The rest will be handled by this tool.
# Attention: This tool must be run from the "postgres" user, because it does not handle authentication yet.
@martinseener
martinseener / axwayactivator.sh
Created Aug 7, 2014
Axway Synchrony Activator Linux/Unix SysVinit Script v1.0
View axwayactivator.sh
#!/bin/bash
### BEGIN INIT INFO
# Provides: axwayactivator
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start / Stop / Restart / Status Axway Synchrony Activator
# Description: starts, stops, restarts or shows status of an Axway Synchrony Activator installation
### END INIT INFO
@martinseener
martinseener / shellshock_patcher_sh
Last active Aug 29, 2015
Shellshock Bash Patcher for Debian/Ubuntu (Rundeck-compatible)
View shellshock_patcher_sh
#!/bin/bash
env x='() { :;}; echo vulnerable' bash -c "echo this is a test" | grep vulnerable > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "Not vulnerable. Machine is safe."
exit 0
else
echo -n "Vulnerable. Version: "
/bin/bash --version
echo "Installing patch."
View keybase.md

Keybase proof

I hereby claim:

  • I am martinseener on github.
  • I am martinseener (https://keybase.io/martinseener) on keybase.
  • I have a public key whose fingerprint is 14EE 1425 C1E1 BC77 4089 65DD BE1D 4C25 0CC8 311A

To claim this, I am signing this object:

@martinseener
martinseener / modx-revolution-upgrade.php
Created May 13, 2014
MODX Revolution Quick Upgrade PHP-CLI Script
View modx-revolution-upgrade.php
<?php
if ( !shell_exec("type type")) { echo "Weak your PHP powers are, Luke."; die; }
exec('wget -O latest.zip http://modx.com/download/latest;');
exec('unzip latest.zip; rm latest.zip;');
exec('cd modx-*; cp -r ./* ../; cd ..; rm -R modx-*;');
exec('chmod 660 ./core/config/config.inc.php');
echo("Done. Now call /setup of your MODX installation to complete the Upgrade!");
?>
@martinseener
martinseener / gist:5318215
Last active Dec 15, 2015
Grok Apache2 Custom-Pattern (streamlined Custom-Log to comply Error Log and enhanced Custom Log by adding more information)
View gist:5318215
filter {
grok {
pattern => ['(?:%{SYSLOGTIMESTAMP:timestamp}|%{TIMESTAMP_ISO8601:timestamp8601}) (?:%{SYSLOGHOST:logsource}) (?:%{SYSLOGPROG}): (?<messagebody>\[%{DAY} %{MONTH} %{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} %{YEAR}\] \[%{LOGLEVEL:severity}\] \[client %{IP:a2_client_ip}\] (?:Request: \"%{GREEDYDATA:a2_request}\" %{INT:a2_http_code} (?:%{GREEDYDATA:a2_sent_bytes}|%{INT:a2_sent_bytes}) %{INT:a2_response_time} %{GREEDYDATA:a2_referer}\" \"%{GREEDYDATA:a2_user_agent}\" \"%{GREEDYDATA:a2_ssl_protocol}\" \"%{GREEDYDATA:a2_ssl_cipher}\"|Request: \"%{GREEDYDATA:a2_request}\" %{INT:a2_http_code} (?:%{GREEDYDATA:a2_sent_bytes}|%{INT:a2_sent_bytes}) %{INT:a2_response_time} \"%{GREEDYDATA:a2_referer}\" \"%{GREEDYDATA:a2_user_agent}\")|%{GREEDYDATA})']
type => "apache2"
}
}
# Apache 2 Logformat for customlog with SSL/TLS Logging (last part "rsysloghostnames" can be changed to anything else)
LogFormat "[%{%a %b %d %H:%M:%S %Y}t] [info] [client %h] Request: \"%m http(s)://%{Host}i%U%q %H\" %>s %b %D \"%{
@martinseener
martinseener / getOldestFile.sh
Created Jul 22, 2013
Bash Funcion which returns the oldest file for specified path (recursive)
View getOldestFile.sh
getOldestFile(){
# Returns oldest file in path specified by $1
if [ -z "$1" ]; then
echo "No Path argument given - exiting."
exit 1
fi
find $1 -type f -printf '%T+ %p\n' | sort | head -1 | cut -d' ' -f2
}