View gist:886717fc3b584118c954e9be5544dc28
# remove IP / set IP to one that won't be used for other systems
# clear ssh host key
rm -rf /etc/ssh/ssh_host_*
# remove /etc/hosts entries as applicable
# remove utmp data - wtmp and btmp and lastlog
rm /var/log/{w,b}tmp /var/log/lastlog ;
touch /var/log/{w,b}tmp /var/log/lastlog ;
View timestamp.sh
#!/bin/bash
perl -pe '$_=(scalar localtime) . " $_"'
View doit.pl
#!/usr/bin/perl
use strict;
use warnings;
use Net::CLI::Interact;
use Parallel::ForkManager;
# servers
my @doit = qw( server1 server2 server3 );
View multi shape
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
View reload_iptables.sh
IPTABLES=iptables
IPV=${IPTABLES%tables} # ip for ipv4 | ip6 for ipv6
PROC_IPTABLES_NAMES=/proc/net/${IPV}_tables_names
/sbin/modprobe --version 2>&1 | grep -q module-init-tools \
&& NEW_MODUTILS=1 \
|| NEW_MODUTILS=0
# Do not stop if iptables module is not loaded.
[ -e "$PROC_IPTABLES_NAMES" ] || exit 1
View unzip.pl
#!/usr/bin/perl
# example perl code, this may not actually run without tweaking, especially on Windows
use strict;
use warnings;
=pod
IO::Uncompress::Unzip works great to process zip files; but, it doesn't include a routine to actually
extract an entire zip file.
View backup.sh
#!/bin/bash
# backup mysql tables - does an initial dump and then backs up to final
# location using rdiff-backup
# NOTE: do NOT manually edit or update the rdiff-backup managed final backup
# location. ONLY use rdiff-backup to update files in that backup directory. if
# the files are changed directly, the historical backups that rdiff-backup
# maintains will be corrupted.
View apache-preconnect-workaround-README
script to kill apache 1.3 / 2.x prefork httpd processes serving preconnect connections, in an attempt to prevent chrome from causing a DoS against the httpd
This is version 2 of https://gist.github.com/eqhmcow/4774549
The major change is the use of two processes instead of one:
One process makes server-status requests, the other kills idle prefork processes.
This allows the kill script to continue killing idle processes even when Chrome has effectively DoS'd the apache server. When this happens, the check script can't get an updated status response back immediately, but the kill script can hopefully free up a slot by killing some processes. Having an uninterrupted request in the socket queue allows us to get an updated response after killing the Chrome preconnections are killed.
View kill_idle_cms_httpd.pl
#!/bin/env perl
# kill_idle_cms_httpd.pl - kill idle httpd connections
# $Id$
use strict;
use warnings;
use Time::HiRes 'time';