Skip to content

Instantly share code, notes, and snippets.

View eqhmcow's full-sized avatar

Daniel S. Sterling eqhmcow

View GitHub Profile
@eqhmcow
eqhmcow / check_time.pl
Created August 20, 2009 10:58
script that automatically resets a virtual machine's system time after the host resumes from sleep. This is handy e.g. when using vmware on a laptop
#!/usr/bin/perl
use strict;
use warnings;
=pod
check_time.pl
This script automatically resets a virtual machine's system time after the
host resumes from sleep. This is handy e.g. when using vmware on a laptop.
@eqhmcow
eqhmcow / git-add-svn-trunk.pl
Created September 3, 2009 17:43
script to track multiple svn repos in one git repo
#!/usr/bin/perl
use strict;
use warnings;
use File::Path;
# This script pulls in subversion files and history into a git repo.
# The subversion files are merged into the master branch under a specific
# subdirectory. This is useful if you have multiple svn repos that you want
# track in a single git repo, with a separate directory for each repo.
@eqhmcow
eqhmcow / macports-reinstall.sh
Created September 30, 2009 01:59
This automates (more or less) the process described at http://trac.macports.org/wiki/Migration
#!/bin/bash
# This automates (more or less) the process described at http://trac.macports.org/wiki/Migration
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
port installed active | /usr/bin/perl -p -e 'undef $_ unless $b++; # the first line is info for humans
s/^\s*(.*)\s*\(active\).*/$1/; s/\s\@[^+\n]+//; # remove (active) and the version number
s/(\+[^+\n]+)/ $1/g' > active.macports # put spaces before each +
port clean --all all
port -f uninstall installed
#!/usr/bin/perl -w
use strict;
use warnings;
use Benchmark qw(:all);
use YAML::Syck ();
use Data::Dumper ();
use Storable ();
use JSON::XS ();
use YAML::XS ();
From: Niko Tyni <ntyni@debian.org>
Subject: Add support for Abstract namespace sockets.
Closes: 490660, 329291
blead commits
99f13d4c3419e967e95c5ac6a3af61e9bb0fd3c0
89904c08923161afd23c629d5c2c7472a09c16bb
by Lubomir Rintel <lkundrak@v3.sk>
trivially backported for 5.10.1 by Niko Tyni <ntyni@debian.org>
@eqhmcow
eqhmcow / sp.sh
Created December 30, 2009 16:00
interactive aspell
#!/bin/bash
while read i
do echo "$i"; for w in $(echo "$i" | aspell list)
do echo "$w" | aspell pipe | grep --color=auto '^&'
done
done
@eqhmcow
eqhmcow / puppet NFS
Created December 23, 2010 14:12
share NFS mounts on RHEL/CentOS with puppet, using augeas to manage exports file
# modules/nfs/manifests/init.pp
class nfs_server {
file { "destroy_exports":
path => "/etc/exports.puppet",
ensure => present,
source => "puppet://$servername/modules/nfs/empty",
}
package { "portmap":
@eqhmcow
eqhmcow / logger.pl
Created March 22, 2011 21:10
logger.pl reimplements (most of) logger(1). Thanks to Perl, this logger hasn't got arbitrary message length limits; so you can syslog(3) messages bigger than the default logger(1) buffer (usually 1k) -- as long as your syslogd supports doing that.
#!/usr/bin/perl
use strict;
use warnings;
=pod
=head1 NAME
B<logger.pl> - a shell command interface to the syslog(3) system log module
@eqhmcow
eqhmcow / hfsc-shape.sh
Last active August 2, 2023 11:59
HFSC - linux traffic shaping's best kept secret
#!/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.
@eqhmcow
eqhmcow / apache-logtop-README
Last active July 29, 2019 14:54
Real-time top-like requests-per-second average for httpd request logs - similar to apachetop
DESCRIPTION
logstat.pl and logtop.pl
These scripts show current and average request-per-second counts based on
apache access logs in real-time.
You can see the total requests-per-second as well as a breakdown by:
* vhost
* URL