This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use IO::Socket::INET; | |
my ($host, $msg) = @ARGV; | |
$host ||= '...'; | |
$msg ||= 'FEED ME A STRAY CAT'; | |
my $port = 9100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=pod | |
B<print_tree>($I<ROOT>, \&I<PROCESS_NODE>) | |
Prints a textual representation of a hierarchical tree structure. | |
I<ROOT> is the top-level node in the tree. | |
I<PROCESS_NODE> is a subroutine reference which is called for each node in the | |
tree. It is given one argument, which is the current node; C<$_> is also |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RED="\[\e[01;31m\]" | |
GREEN="\[\e[01;32m\]" | |
BLUE="\[\e[01;34m\]" | |
NORMAL="\[\e[00m\]" | |
JOBS='if [[ $(jobs) != "" ]]; then echo "(\j) "; fi' | |
STATUS="s=\$?; if [ \$s != 0 ]; then echo \"${RED}\$s${NORMAL} \"; fi" | |
HOST_COLOR="\[\e[1;38;5;$((22 + 10#$(hostname | cksum | cut -d' ' -f1) % 210))m\]" | |
case $USER in | |
root) | |
PROMPT_COLOR=$RED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# adapted from http://stackoverflow.com/questions/1075947/can-i-use-gnu-screen-completely-transparently-automatically | |
use strict; | |
use warnings; | |
use Getopt::Long qw(:config bundling require_order); | |
my $usage = "Usage: $0 [OPTION...] HOST [SESSION_NAME] [SSH_OPTION...]\n"; | |
my $helpmsg = $usage . <<'EOF;'; | |
Log into a remote machine and start a screen session named SESSION_NAME. If a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Start an xterm (and X if necessary) with a shortcut with this setting: | |
# C:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /path/to/startxterm | |
lockfile='/tmp/.X0-lock' | |
running=0 | |
if [[ -e $lockfile ]]; then | |
pid=`cat $lockfile` | |
if [[ -e /proc/$pid ]]; then |