Skip to content

Instantly share code, notes, and snippets.

View mschmitt's full-sized avatar
🥾
Busier than a one-legged man in an ass-kicking contest.

Martin Schmitt mschmitt

🥾
Busier than a one-legged man in an ass-kicking contest.
View GitHub Profile
@mschmitt
mschmitt / ssl.conf
Created July 29, 2013 13:50
Apache mod_rewrite reverse proxy with SSL bound to two ports, proxying to two separate backends
<VirtualHost _default_:443 _default_:8443>
# Force %{SERVER_PORT} to contain the actual local port of the connection
UseCanonicalPhysicalPort On
RewriteEngine On
# Reverse Proxy to localhost:80 if connection was to port 443
RewriteCond %{SERVER_PORT} =443
RewriteRule (.*) http://localhost$1 [P]
mount | perl -a -n -e '$F[4]!~/^ext\d/&&next;
$F[2]=~/(^\/oracle|sapdata|oraarch|mirrlog|origlog|^\/(|boot|home|tmp|var)$)/&&next;
$F[0]=~s/\/dev\/mapper\/datavg-//;
printf"command[check_disk_%s]=/usr/lib64/nagios/plugins/check_disk -w 25%% -c 20%% -p %s\n",$F[0],$F[2]'
@mschmitt
mschmitt / photostamper.sh
Last active December 22, 2015 01:39
Script to overlay a PNG logo on JPG files. (To stamp your wonderful photographer logo onto your photos.)
#!/bin/bash
# Overlay PNG logo on JPG files. Operation is done in-place,
# so please work only on copies of your original files.
#
# The logo is stored inline within this script, so we don't have
# to schlepp around an additional file. Replace the logo by using:
#
# openssl base64 < myownlogo.png
#
@mschmitt
mschmitt / gist:6498703
Created September 9, 2013 17:16
Merge continuation lines in mail header
perl -ne'/^$/&&last;$d.=$_;END{$d=~s/\n\s+/ /g;print $d;}'
<?php phpinfo(); ?>
@mschmitt
mschmitt / find_package_in_channels.pl
Created November 18, 2013 15:07
Script to find the satellite channels that provide a given package.
#!/usr/bin/perl -w
use strict;
use Frontier::Client;
use Data::Dumper;
use Term::ReadKey;
my $find_package;
if ($ARGV[0]){
$find_package = $ARGV[0];
@mschmitt
mschmitt / ShadowMangler.pl
Created February 19, 2014 08:45
Helper for generating and checking password hashes.
#!/usr/bin/perl -w
use diagnostics;
use strict;
use POSIX qw(setsid);
use Crypt::Passwd::XS;
use Tk;
# Fork off.
if (1){
fork() && exit;
@mschmitt
mschmitt / dyn-bind-updater.sh
Created March 12, 2014 15:01
dyn-bind-updater.sh
#!/bin/sh
# Aktuelle IP
IP=`lynx --dump --source http://www.ipv4.dyn.f00.net/ip.php`
IP6=2001:db8::1234:5678
KEY='dynupdate-meinkey:UGVuaXMhCg=='
HOST='meinhost.dyn.meinedomain.de'
nsupdate -y $KEY <<Ende
@mschmitt
mschmitt / sshgrouplog.pl
Created April 23, 2014 11:56
This correlates per-session sshd logfile entries on a very busy server with many concurrent sessions.
#!/usr/bin/perl -w
use strict;
use diagnostics;
#use File::Navigate; (bundled below)
my $nav = File::Navigate->new($ARGV[0]);
my @connects = @{$nav->find(qr/sshd\[\d+\]: Connection from .+ port \d/)};
foreach (@connects){
// Arduino Leonardo: Send key when a button is pressed.
void setup() {
pinMode(12, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
//if the button is pressed
if(digitalRead(12)==LOW){