First import
git-svn-id: http://photonzero.com/dotfiles/trunk@1 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
commit
83d40113d2
60 changed files with 4264 additions and 0 deletions
16
bin/ansiabuse
Executable file
16
bin/ansiabuse
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/python
|
||||
import random
|
||||
import sys
|
||||
import commands
|
||||
colors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white"]
|
||||
for line in sys.stdin:
|
||||
echostring = ""
|
||||
line = line.rstrip();
|
||||
for x in line:
|
||||
if x == '\\':
|
||||
x = '\\\\'
|
||||
colorname = colors[random.randint(0,6)]
|
||||
echostring += "$(color lt" + colorname +")" + x
|
||||
echostring += "$(color off)"
|
||||
o = commands.getoutput('echo "' + echostring + '"')
|
||||
print o.rstrip()
|
||||
4
bin/baraksetup
Executable file
4
bin/baraksetup
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd ~
|
||||
tar -czf baraksetup.tar.gz bin/ .vim/ .vimrc .bashrc .bash_aliases .bash_logout .profile .muttrc .screenrc .procmailrc
|
||||
chmod 600 baraksetup.tar.gz
|
||||
7
bin/build/Makefile
Normal file
7
bin/build/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
all:
|
||||
gcc -o ./gettermsize ./src/gettermsize/gettermsize.c
|
||||
gcc -o ./wye ./src/wye/wye.c
|
||||
|
||||
install:
|
||||
cp ./wye ~/bin
|
||||
cp ./gettermsize ~/bin
|
||||
15
bin/build/src/gettermsize/gettermsize.c
Normal file
15
bin/build/src/gettermsize/gettermsize.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
struct winsize size;
|
||||
ioctl(STDIN_FILENO, TIOCGWINSZ, (char *) &size);
|
||||
printf("%d x %d\n", size.ws_col, size.ws_row);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
59
bin/build/src/wye/wye.1
Normal file
59
bin/build/src/wye/wye.1
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
.\" $Id: wye.1,v 1.1 1999-05-03 10:04:59-07 mconst Exp mconst $
|
||||
.TH WYE 1
|
||||
.fi
|
||||
.SH NAME
|
||||
wye \- another pipe fitting
|
||||
.SH SYNOPSIS
|
||||
\fC`\fIsubcommand\fP | wye`\fR (note the backquotes!)
|
||||
.SH DESCRIPTION
|
||||
The \fCwye\fR utility is used to create systems of pipes and fifos
|
||||
(named pipes) more complicated than standard shell syntax allows.
|
||||
A single invocation of \fCwye\fR has the following effect: a temporary
|
||||
fifo is created; the name of this fifo is printed on standard output;
|
||||
and \fCwye\fR exits, leaving a child process in the background to copy
|
||||
any data received on standard input to the fifo. The net effect of
|
||||
this is that you can use the expression \fC`\fIsubcommand\fP | wye`\fR
|
||||
anywhere on a command line that you would use a filename, and the output of
|
||||
\fIsubcommand\fP will be piped appropriately to create the illusion that
|
||||
\fC`\fIsubcommand\fP | wye`\fR is a file, containing the output of
|
||||
\fIsubcommand\fR.
|
||||
.SH EXAMPLES
|
||||
Since \fCwye\fR is a simple command, I have given it a simple
|
||||
description; however, some examples are certainly in order.
|
||||
To print all lines of the standard input which contain the name
|
||||
of a file in the current directory:
|
||||
.nf
|
||||
|
||||
\fCfgrep \-f `ls | wye`\fR
|
||||
|
||||
.fi
|
||||
To show which users log on or off in the next minute:
|
||||
.nf
|
||||
|
||||
\fCdiff \-h `who | wye` `sleep 60; who | wye`\fR
|
||||
|
||||
.fi
|
||||
To change the names of all the files in the current directory to lowercase:
|
||||
.nf
|
||||
|
||||
\fCpaste `ls | wye` `ls | tr A\-Z a\-z | wye` | xargs \-n2 mv\fR
|
||||
.fi
|
||||
.SH FILES
|
||||
\fC/tmp/wye.??????\fR temporary fifos
|
||||
.SH BUGS
|
||||
The background \fCwye\fR process has a (hardcoded) one-hour timeout: if the
|
||||
fifo is not opened for reading by another process in that time, then the
|
||||
background \fCwye\fR process will terminate silently. Note that this will
|
||||
probably never happen unless the user has made a mistake and forgotten to
|
||||
use the fifo for anything.
|
||||
.PP
|
||||
There is no equivalent of \fCmkstemp\fR(\fC3\fR) for fifos, so we
|
||||
must provide the same functionality ourselves with \fCmktemp\fR(\fC3\fR)
|
||||
and \fCmkfifo\fR(\fC2\fR), repeating the calls if
|
||||
.SM EEXIST
|
||||
is returned.
|
||||
.SH AUTHOR
|
||||
Michael Constant (mconst@csua.berkeley.edu).
|
||||
.SH "SEE ALSO"
|
||||
\fCmktemp\fR(\fC3\fR), \fCmkstemp\fR(\fC3\fR), \fCmkfifo\fR(\fC2\fR),
|
||||
\fCtee\fR(\fC1\fR)
|
||||
72
bin/build/src/wye/wye.c
Normal file
72
bin/build/src/wye/wye.c
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* wye.c, written by Michael Constant (mconst@csua.berkeley.edu) and placed
|
||||
* in the public domain. $Id: wye.c,v 1.1 1999-05-03 10:04:59-07 mconst $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define TEMPMASK "/tmp/wye.XXXXXX" /* the name of our tempfile */
|
||||
#define TIMEOUT 3600 /* time we wait for the fifo to open */
|
||||
|
||||
void cleanup(int sig);
|
||||
|
||||
char tempfile[]=TEMPMASK;
|
||||
|
||||
int main()
|
||||
{
|
||||
int ch;
|
||||
FILE *fp;
|
||||
|
||||
/* create the fifo. if we get EEXIST, then someone else created a
|
||||
* file with our intended name right before we did; we should pick
|
||||
* a new name and try again. see the source to mkstemp(3). */
|
||||
while (mkfifo(mktemp(tempfile), 0600) == -1) {
|
||||
if (errno != EEXIST) {
|
||||
perror("wye: couldn't create fifo");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(tempfile, TEMPMASK);
|
||||
}
|
||||
|
||||
/* remove our tempfile if we die */
|
||||
signal(SIGHUP, cleanup);
|
||||
signal(SIGINT, cleanup);
|
||||
signal(SIGTERM, cleanup);
|
||||
signal(SIGALRM, cleanup);
|
||||
|
||||
/* fork a child to do the work */
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
perror("wye: couldn't fork");
|
||||
exit(1);
|
||||
|
||||
case 0:
|
||||
fclose(stdout); /* this is necessary for `cmd | wye` */
|
||||
alarm(TIMEOUT); /* this is if the fifo never opens */
|
||||
|
||||
/* this will block until someone else opens the fifo */
|
||||
if ((fp = fopen(tempfile, "w")) == NULL) {
|
||||
perror("wye: couldn't open fifo");
|
||||
exit(1); /* not as if anyone cares */
|
||||
}
|
||||
|
||||
alarm(0); /* cancel the alarm */
|
||||
unlink(tempfile); /* so it disappears when we're done */
|
||||
while ((ch = getchar()) != EOF) putc(ch, fp);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* output the name of the fifo */
|
||||
printf("%s\n", tempfile);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void cleanup(int sig)
|
||||
{
|
||||
unlink(tempfile);
|
||||
exit(2);
|
||||
}
|
||||
13
bin/callout
Executable file
13
bin/callout
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
x = readline()
|
||||
x = x.strip
|
||||
(x.length() + 4).times {print "*"}
|
||||
print "\n"
|
||||
print "* "
|
||||
print x
|
||||
print " *\n"
|
||||
|
||||
(x.length() + 4).times {print "*"}
|
||||
print "\n"
|
||||
|
||||
34
bin/contract
Executable file
34
bin/contract
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
loadfile = sys.stdin
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
print "No command to run"
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) == 3:
|
||||
if sys.argv[2] != "-":
|
||||
loadfile = open(sys.argv[2])
|
||||
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
def sub(x, y):
|
||||
return x - y
|
||||
|
||||
def mult(x, y):
|
||||
return x * y
|
||||
|
||||
def div(x,y):
|
||||
return x / y;
|
||||
|
||||
lis = []
|
||||
for line in loadfile:
|
||||
if line.strip() <> "":
|
||||
x = float(line)
|
||||
lis.append(x)
|
||||
|
||||
print reduce(eval(sys.argv[1]), lis)
|
||||
|
||||
10
bin/createindex
Executable file
10
bin/createindex
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "<center><h1>"
|
||||
#echo `basename \`pwd\``
|
||||
pwd | xargs basename | xargs echo
|
||||
echo "</h1></center>"
|
||||
for file in *
|
||||
do
|
||||
echo "<a href='./${file}'>${file}</a><br>"
|
||||
done
|
||||
6
bin/createtextimage
Executable file
6
bin/createtextimage
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
#This is a hack for now, as Debian has an older version of ImageMagick. The better (>= IM 6.8.5) way is below
|
||||
#perl -pe 's/\n/\\n/' | convert -background lightblue -fill blue label:@- $*
|
||||
#convert -background lightblue -fill blue label:@- $*
|
||||
#convert -background none -box lightblue -font Courier -fill blue -pointsize 14 text:- -trim +repage -bordercolor lightblue -border 3 -background lightblue -flatten png:-
|
||||
convert -background none -box white -font Courier -fill black -strokewidth 2 -pointsize 16 text:- -trim +repage -bordercolor white -border 3 -background white -flatten png:-
|
||||
BIN
bin/gettermsize
Executable file
BIN
bin/gettermsize
Executable file
Binary file not shown.
19
bin/gnuplottoppm
Executable file
19
bin/gnuplottoppm
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
|
||||
$x = 0.6;
|
||||
$y = 0.6;
|
||||
$color = 1;
|
||||
$gnuplot = "/usr/bin/gnuplot";
|
||||
|
||||
open (GNUPLOT, "|$gnuplot");
|
||||
print GNUPLOT <<gnuplot_Commands_Done;
|
||||
|
||||
|
||||
set term pbm color small
|
||||
set title "Anoncon Thread Growth"
|
||||
set xlabel "Time (minutes)"
|
||||
set ylabel "Posts"
|
||||
set output "$ARGV[1]"
|
||||
plot "$ARGV[0]" title "" $color
|
||||
gnuplot_Commands_Done
|
||||
8
bin/grepsonnet
Executable file
8
bin/grepsonnet
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
#$G = `echo "($1 * 17) + 16" | bc`
|
||||
X=$((($1 * 17) + 16))
|
||||
head -n $X /home/michener/shakespeare/poetry/sonnets | tail -n 17
|
||||
X=$((($1 * 17) + 16))
|
||||
#Y=$((($1 * 17) - 1))
|
||||
#echo "sed -n $Y,$Xp /home/barak/shakespeare/poetry/sonnets"
|
||||
#sed -n $Y,$Xp sonnets
|
||||
7
bin/hosttest
Executable file
7
bin/hosttest
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
host $1.com
|
||||
host $1.net
|
||||
host $1.org
|
||||
host $1.cc
|
||||
|
||||
12
bin/htmlify
Executable file
12
bin/htmlify
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
concat = '<font face="courier new" size="-1"><br>'
|
||||
thisline = ""
|
||||
import sys
|
||||
for line in sys.stdin:
|
||||
thisline = line.expandtabs(7)
|
||||
thisline = thisline.replace("&", "&").replace("<","<").replace(">",">")
|
||||
thisline = thisline.replace("\n", "<br>")
|
||||
thisline = thisline.replace(" "," ")
|
||||
concat = concat + thisline # + "<br>"
|
||||
print concat + "</font>"
|
||||
46
bin/jytecheck
Executable file
46
bin/jytecheck
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/ruby
|
||||
require 'net/http'
|
||||
require 'getoptlong'
|
||||
|
||||
class JyteEntry
|
||||
def initialize(vfor, vagainst, title)
|
||||
@vfor = vfor
|
||||
@vagainst = vagainst
|
||||
@title = title
|
||||
end
|
||||
def print
|
||||
printf "[\033[32m#@vfor\033[0m "
|
||||
printf "\033[31m#@vagainst\033[0m]\t"
|
||||
printf "#@title\n"
|
||||
end
|
||||
end
|
||||
|
||||
opts = GetoptLong.new(
|
||||
["--number", "-n", GetoptLong::REQUIRED_ARGUMENT]
|
||||
)
|
||||
|
||||
donum = 10
|
||||
|
||||
opts.each do |opt, arg|
|
||||
if opt == "-n" or opt == "--number"
|
||||
donum = arg.to_i
|
||||
end
|
||||
end
|
||||
donuma = (donum / 10.0).ceil
|
||||
|
||||
|
||||
jytes = Array.new()
|
||||
|
||||
1.upto(donuma) do |num|
|
||||
response = Net::HTTP.start("jyte.com").post("/claims", "page=#{num}")
|
||||
|
||||
titles = (response.body.scan(%r{a class=\"claim_title\"\n\s*href=\"http:(.*?)\">\n\s*(.*?)\n\s*</a>}m))
|
||||
votesfor = (response.body.scan(%r{votes_left_text_\d*\" style=\"color:#fff;\">(.*?)</span>}m))
|
||||
votesagainst = (response.body.scan(%r{votes_right_text_\d*\" style=\"color:#fff;\">(.*?)</span>}m))
|
||||
0.upto(9) do |i|
|
||||
jytes.push(JyteEntry.new(votesfor[i][0],votesagainst[i][0],titles[i][1]))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
0.upto(donum - 1) {|x| jytes[x].print}
|
||||
2
bin/lessaccesslog
Executable file
2
bin/lessaccesslog
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
cat $1 | cut -d ] -f 2 | cut -d \" -f 2 | cut -d " " -f 2 | sort | uniq -c | sort -n | less
|
||||
21
bin/mailheaders
Executable file
21
bin/mailheaders
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/perl
|
||||
if ($#ARGV == 0) {
|
||||
$ARGV[1] = "michener\@csua.berkeley.edu";
|
||||
}
|
||||
print <<FOO;
|
||||
EHLO localhost
|
||||
MAIL FROM: rootcow\@csua.berkeley.edu
|
||||
RCPT TO: $ARGV[1]
|
||||
DATA
|
||||
From: RootCow\@csua.BERKELEY.edu
|
||||
To: $ARGV[1]
|
||||
Subject: $ARGV[0]
|
||||
|
||||
FOO
|
||||
while (<STDIN>) {
|
||||
print;
|
||||
}
|
||||
print ".";
|
||||
print "\n";
|
||||
print "QUIT";
|
||||
print "\n";
|
||||
184
bin/motdedit
Executable file
184
bin/motdedit
Executable file
|
|
@ -0,0 +1,184 @@
|
|||
#!/usr/local/bin/perl
|
||||
#
|
||||
# DESC:
|
||||
# Program is used to sychronize write access to public motd file.
|
||||
# Program acquires advisory exclusive lock, then brings up editor
|
||||
# to edit file. On return from editor, motd file will be unlocked.
|
||||
# If program cannot acquire exclusive lock, it prints out the current
|
||||
# user holding exclusive lock.
|
||||
#
|
||||
# WRITTEN BY:
|
||||
# Andrew Choi
|
||||
# Fixed by:
|
||||
# Ben Scott
|
||||
# Arvin Hsu
|
||||
|
||||
use strict;
|
||||
use Fcntl ':flock';
|
||||
use Errno;
|
||||
use Getopt::Std;
|
||||
use File::Copy;
|
||||
|
||||
my $motd = "/etc/motd.public";
|
||||
my $motdbackup = "/tmp/motd.public.b.$>.$$"; # EUID + PID
|
||||
my $motdcurrent = "/tmp/motd.public.r.$>.$$"; # EUID + PID
|
||||
my $motdtemp = "/tmp/motd.public.t.$>.$$"; # EUID + PID
|
||||
my $motdmerged = "/tmp/motd.public.m.$>.$$"; # EUID + PID
|
||||
|
||||
$motd = "/csua/tmp/motd.kinney" if (getpwuid($<))[0] eq 'kinney';
|
||||
my $editor = $ENV{MOTDEDITOR};
|
||||
$editor ||= $ENV{VISUAL};
|
||||
$editor ||= $ENV{EDITOR};
|
||||
$editor ||= "/usr/bin/ed";
|
||||
|
||||
my %opt;
|
||||
|
||||
$opt{t} = 600;
|
||||
getopts("mnst:h?",\%opt);
|
||||
&Usage if $opt{h};
|
||||
|
||||
## Set environment vars for vi users
|
||||
## Thanks, jon.
|
||||
|
||||
$ENV{NEXINIT} ||= $ENV{EXINIT};
|
||||
unless ( $ENV{NEXINIT} ) {
|
||||
unless (open (EXRC,"$ENV{HOME}/.nexrc")) {
|
||||
unless (open (EXRC,"$ENV{HOME}/.exrc")) {
|
||||
$ENV{NEXINIT} = "set nolock";
|
||||
}
|
||||
}
|
||||
unless ($ENV{NEXINIT}) {
|
||||
($ENV{NEXINIT} = join ("",<EXRC>)) && close EXRC;
|
||||
}
|
||||
}
|
||||
$ENV{NEXINIT} .= "\nset nolock\n";
|
||||
|
||||
# Set alarm for being locked too damn long
|
||||
$SIG{ALRM} = \&Unlock;
|
||||
alarm $opt{t};
|
||||
|
||||
# Open file as append so that lock can be used on it
|
||||
open(M, "$motd") || die "open $motd: $!";
|
||||
|
||||
# Lock file. If success, execute edit command and exit
|
||||
flock(M, LOCK_EX|LOCK_NB);
|
||||
if ($!{EWOULDBLOCK}) {
|
||||
if ($opt{n}) {
|
||||
print "Motd currently locked. Editing anyways.";
|
||||
&Edit;
|
||||
}
|
||||
else {
|
||||
flock (M, LOCK_UN);
|
||||
print "Motd currently locked\nWait to acquire lock [y/N] ";
|
||||
chomp(my $ans = <>);
|
||||
if ($ans =~ /^y$/i) {
|
||||
flock(M, LOCK_EX);
|
||||
&Edit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
&Edit;
|
||||
}
|
||||
|
||||
close M;
|
||||
system "/csua/bin/mtd";
|
||||
exit 0;
|
||||
|
||||
sub Unlock {
|
||||
flock(M, LOCK_UN);
|
||||
print
|
||||
"\r*** MOTD GOD PRONOUNCES: *** \r\n*** You have locked the motd for too long, you idle hoser... *** \r\n*** Your lock has been removed. *** \r\n";
|
||||
}
|
||||
|
||||
sub Usage {
|
||||
print STDERR
|
||||
"$0 Edit /etc/motd.public with locking and merge.
|
||||
|
||||
Usage: $0 [-m] [-s] [-t n]
|
||||
-t n Set timeout for releasing lock to n seconds (default $opt{t})
|
||||
-m Turns auto-merging off.
|
||||
-s If merge fails, will stomp over other changes.
|
||||
-n Does not wait for lock before allowing edit.
|
||||
(the other person may overwrite your post)
|
||||
";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
sub Edit {
|
||||
alarm $opt{t};
|
||||
print "";
|
||||
#check if merge option is desired
|
||||
if (!$opt{m}) {
|
||||
copy($motd,$motdbackup);
|
||||
copy($motd,$motdcurrent);
|
||||
my $lastmodtime = (stat($motd))[9];
|
||||
system("$editor $motdcurrent");
|
||||
my $currmodtime = (stat($motd))[9];
|
||||
if ($currmodtime > $lastmodtime) {
|
||||
&Merge;
|
||||
}
|
||||
else {
|
||||
copy($motdcurrent,$motd);
|
||||
}
|
||||
unlink </tmp/motd.public.*>;
|
||||
}
|
||||
else {
|
||||
system("$editor $motd");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Attempts to auto-merge using "merge, diff -c | patch, diff | patch"
|
||||
# If auto-merge fails, allows manual merge
|
||||
# Saves final version as $motd
|
||||
sub Merge {
|
||||
copy($motd,$motdmerged);
|
||||
system("merge -p -q -L \"Other Changes Below\" -L \"Original MOTD\" -L \"Your Changes Above\" $motd $motdbackup $motdcurrent > $motdtemp");
|
||||
|
||||
# Check to see if merge failed. if fail, try diff -c | patch
|
||||
if (($? >> 8) > 0) {
|
||||
system("diff -c $motdbackup $motdcurrent | patch -s -f $motdmerged 2> /dev/null");
|
||||
|
||||
# Check to see if diff -c | patch, if fail, try diff | patch
|
||||
if (($? >> 8) > 0) {
|
||||
system("diff $motdbackup $motdcurrent | patch -s -f $motdmerged 2> /dev/null");
|
||||
|
||||
# If everything has failed, put the merge notation in, and let the user edit.
|
||||
if (($? >> 8) > 0) {
|
||||
if ($opt{s}) {
|
||||
copy($motdcurrent,$motdmerged);
|
||||
}
|
||||
else {
|
||||
print "CONCURRENT CHANGES\r\nAll merge & patch attempts have failed.\r\nMerge Manually? [y/n]";
|
||||
chomp(my $answ = <>);
|
||||
if ($answ =~ /^y$/i) {
|
||||
copy($motdtemp,$motdcurrent);
|
||||
copy($motd,$motdbackup);
|
||||
my $lastmodtime = (stat($motd))[9];
|
||||
system("$editor $motdcurrent");
|
||||
my $currmodtime = (stat($motd))[9];
|
||||
if ($currmodtime > $lastmodtime) {
|
||||
&Merge;
|
||||
}
|
||||
else {
|
||||
copy($motdcurrent,$motdmerged);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "Stomp on other people's changes? [y/n]";
|
||||
chomp(my $answ = <>);
|
||||
if ($answ =~ /^y$/i) {
|
||||
copy($motdcurrent,$motdmerged);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Merge was successful, copy it over.
|
||||
copy($motdtemp,$motdmerged);
|
||||
}
|
||||
copy($motdmerged,$motd);
|
||||
}
|
||||
|
||||
21
bin/movingaverage
Executable file
21
bin/movingaverage
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$averageto = $ARGV[0];
|
||||
for ($i = 0; $i < $averageto; $i++) {
|
||||
$temp[$i] = 0;
|
||||
}
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
$x = 0;
|
||||
for ($i = 0; $i < $averageto; $i++) {
|
||||
$x += $temp[$i];
|
||||
}
|
||||
$x = $x + $_;
|
||||
$x = $x / ($averageto + 1);
|
||||
print "$x\n";
|
||||
for ($i = 0; $i < $averageto - 1; $i++) {
|
||||
$temp[$i] = $temp[($i + 1)];
|
||||
}
|
||||
$temp[($averageto -1)] = $_;
|
||||
}
|
||||
8
bin/noblanks
Executable file
8
bin/noblanks
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp($_);
|
||||
if ($_){
|
||||
print "$_\n";
|
||||
}
|
||||
}
|
||||
119
bin/orly
Executable file
119
bin/orly
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# Globals
|
||||
#
|
||||
use vars qw/$deftext %opt /;
|
||||
|
||||
#
|
||||
# Command line options processing
|
||||
#
|
||||
sub init()
|
||||
{
|
||||
use Getopt::Std;
|
||||
my $opt_string = 'hdoynsi';
|
||||
getopts( "$opt_string", \%opt ) or usage();
|
||||
usage() if $opt{h};
|
||||
}
|
||||
|
||||
#
|
||||
# Message about this program and how to use it
|
||||
#
|
||||
sub usage()
|
||||
{
|
||||
print STDERR << "EOF";
|
||||
|
||||
orly -- Print an O RLY owl
|
||||
|
||||
usage: $0 [-hdoyn] [<MESSAGE>]
|
||||
|
||||
-h : this (help) message
|
||||
-o, -d : print the "O RLY" owl
|
||||
-y : print the "YA RLY" owl
|
||||
-n : print the "NO WAI!" owl
|
||||
-s : Print "SRSLY" as a question, statement or
|
||||
exclamation, respectively for the above.
|
||||
-i : take MESSAGE from STDIN
|
||||
|
||||
EOF
|
||||
exit;
|
||||
}
|
||||
|
||||
sub printorly() {
|
||||
$deftext = "O RLY?";
|
||||
print << "EOO"
|
||||
___
|
||||
{o,o}
|
||||
|)__)
|
||||
-"-"-
|
||||
EOO
|
||||
}
|
||||
|
||||
sub printyarly() {
|
||||
$deftext = "YA RLY";
|
||||
print << "EOO"
|
||||
___
|
||||
{o.o}
|
||||
|)_(|
|
||||
-"-"-
|
||||
EOO
|
||||
}
|
||||
|
||||
sub printnowai() {
|
||||
$deftext = "NO WAI!";
|
||||
print << "EOO"
|
||||
___
|
||||
{o,o}
|
||||
(__(|
|
||||
-"-"-
|
||||
EOO
|
||||
}
|
||||
|
||||
$givenstatement = "";
|
||||
for ($i=0; $i<($#ARGV + 1); $i++)
|
||||
{
|
||||
if (substr($ARGV[$i],0,1) ne "-")
|
||||
{
|
||||
$up = uc($ARGV[$i]);
|
||||
$givenstatement = "$givenstatement$up ";
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
if ($opt{i}) {
|
||||
while (<STDIN>) {
|
||||
$givenstatement = $givenstatement.uc($_);
|
||||
}
|
||||
chomp($givenstatement);
|
||||
}
|
||||
if ($opt{y}) {
|
||||
printyarly();
|
||||
$deftext = "SRSLY" if ($opt{s});
|
||||
}
|
||||
elsif ($opt{n}) {
|
||||
printnowai();
|
||||
$deftext = "SRSLY!" if ($opt{s});
|
||||
}
|
||||
elsif ($opt{d} || $opt {o}) {
|
||||
printorly();
|
||||
$deftext = "SRSLY?" if ($opt{s});
|
||||
}
|
||||
elsif ($opt{s}) {
|
||||
printyarly();
|
||||
$deftext = "SRSLY";
|
||||
}
|
||||
else {
|
||||
printorly();
|
||||
}
|
||||
|
||||
if ($givenstatement)
|
||||
{
|
||||
print "$givenstatement\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$deftext\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
3
bin/ownerof
Executable file
3
bin/ownerof
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
X=`ls -al $1 | awk '{print $3 ":" $4}'`
|
||||
echo $X
|
||||
8
bin/planout
Executable file
8
bin/planout
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
cat ~/.plan_real
|
||||
echo ""
|
||||
echo "Politburo Meeting .plan:"
|
||||
sed -n '/^*/p' ~/.csua.plan
|
||||
wc ~/.csua.plan
|
||||
echo ""
|
||||
~/bin/randsonnet
|
||||
2
bin/port25cow
Executable file
2
bin/port25cow
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
cowsay $1 | mailheaders $1 $2
|
||||
24
bin/ps_warriors
Executable file
24
bin/ps_warriors
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$cnt = ($ARGV[0] eq "-n" && $ARGV[1] =~ /^\d+$/) ? $ARGV[1] : 20;
|
||||
|
||||
opendir(PROC, "/proc");
|
||||
while ($_ = readdir(PROC)) {
|
||||
next if (/curproc/);
|
||||
$id = (stat("/proc/$_"))[4];
|
||||
next unless defined $id;
|
||||
$procs{$id}++;
|
||||
}
|
||||
closedir(PROC);
|
||||
|
||||
$procs{$<}--;
|
||||
@ids = reverse sort { $procs{$a} <=> $procs{$b} } keys(%procs);
|
||||
|
||||
format STDOUT =
|
||||
@>>> @<<<<<<<
|
||||
$procs{$id}, (getpwuid($id))[0]
|
||||
.
|
||||
|
||||
for $id (($cnt) ? @ids[0..($cnt-1)] : @ids) {
|
||||
write;
|
||||
}
|
||||
7
bin/randsonnet
Executable file
7
bin/randsonnet
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
import random
|
||||
import commands
|
||||
x = random.randint(1,154)
|
||||
o = commands.getoutput("~/bin/grepsonnet %d" % x)
|
||||
print "Random Shakespeare Sonnet:"
|
||||
print o
|
||||
195
bin/rcpt
Executable file
195
bin/rcpt
Executable file
|
|
@ -0,0 +1,195 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# This script connects to a mail server and issues MAIL and RCPT
|
||||
# commands. It's a good way to check whether an address exists --
|
||||
# many modern mail servers actually respond usefully to RCPT, even
|
||||
# if they ignore VRFY and EXPN. It's also convenient for testing
|
||||
# whether a server allows relaying.
|
||||
#
|
||||
# usage: rcpt [options] email-address [mailserver]
|
||||
# rcpt [options] -n [hostname] [mailserver]
|
||||
#
|
||||
# -n
|
||||
# nonexistent: Make up an email address that probably doesn't
|
||||
# exist at the specified hostname. For example,
|
||||
# "rcpt -n foobar.com" will use an address like
|
||||
# <vsMAWCGul96-nonexistent@foobar.com>. If you don't
|
||||
# specify a hostname, it'll make up a local address.
|
||||
# (If you specify an email address instead of a hostname,
|
||||
# it's treated as if you just gave the hostname part.)
|
||||
#
|
||||
# -v
|
||||
# verbose: Show the entire SMTP exchange.
|
||||
#
|
||||
# -f ADDR
|
||||
# from: Specify the address you're sending mail from.
|
||||
# By default, the script uses its best guess at your
|
||||
# email address, constructed from your username and
|
||||
# the local host name.
|
||||
#
|
||||
# -h HOSTNAME
|
||||
# helo: Specify the hostname to send in the HELO command.
|
||||
# By default, the script uses its best guess at the
|
||||
# fully-qualified domain name of the local host.
|
||||
#
|
||||
# By default, the script connects to the first MX listed for the
|
||||
# email address you're testing. If that's not what you want, you
|
||||
# can specify a mail server explicitly; you can even give a mail
|
||||
# server of the form "mx:hostname", which means the first MX listed
|
||||
# for "hostname".
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# rcpt user@foobar.com
|
||||
# Connect to the first MX for foobar.com, and try the
|
||||
# address <user@foobar.com>.
|
||||
#
|
||||
# rcpt user@foobar.com mail.baz.com
|
||||
# Connect to mail.baz.com, and try the address <user@foobar.com>.
|
||||
#
|
||||
# rcpt user@foobar.com mx:baz.com
|
||||
# Connect to the first MX for baz.com, and try the address
|
||||
# <user@foobar.com>.
|
||||
#
|
||||
# rcpt user
|
||||
# Connect to localhost, and try the address <user>.
|
||||
#
|
||||
# rcpt -n foobar.com
|
||||
# Connect to the first MX for foobar.com, and try an
|
||||
# address like <vsMAWCGul96-nonexistent@foobar.com>.
|
||||
#
|
||||
# rcpt -n
|
||||
# Connect to localhost, and try an address like
|
||||
# <vsMAWCGul96-nonexistent>.
|
||||
#
|
||||
# The script outputs the name of the server it connects to, followed
|
||||
# by the response to the RCPT command. It returns success if the
|
||||
# server accepts the address.
|
||||
#
|
||||
# $Id: rcpt,v 1.3 2006-10-12 01:37:51-07 mconst Exp mconst $
|
||||
|
||||
|
||||
use IO::Socket;
|
||||
use Email::Address;
|
||||
use Net::DNS;
|
||||
use Net::SMTP;
|
||||
use Sys::Hostname::Long;
|
||||
use Getopt::Std;
|
||||
use String::Random;
|
||||
|
||||
$0 =~ s|.*/||;
|
||||
|
||||
|
||||
# Return the first MX for the specified host.
|
||||
sub get_mx {
|
||||
my ($host) = @_;
|
||||
|
||||
my @mx = mx($host) or die "$0: can't find MX for $host\n";
|
||||
return $mx[0]->exchange;
|
||||
}
|
||||
|
||||
|
||||
sub Net::SMTP::debug_print {
|
||||
my ($self, $dir, @text) = @_;
|
||||
return unless $self =~ /GLOB/;
|
||||
|
||||
$arrows = $dir ? ">>> " : "";
|
||||
print $arrows, @text;
|
||||
}
|
||||
|
||||
|
||||
getopts "nvf:h:", \my %options;
|
||||
my $verbose = $options{v};
|
||||
my $nonexistent = $options{n};
|
||||
my $helo_hostname = $options{h} || hostname_long;
|
||||
|
||||
my $from_address = $options{f};
|
||||
if (!defined($from_address)) {
|
||||
my $my_username = $ENV{USER} || getpwuid $<
|
||||
|| die "$0: can't find local username\n";
|
||||
|
||||
$from_address = "$my_username\@" . hostname_long;
|
||||
}
|
||||
|
||||
|
||||
my ($address, $server) = @ARGV;
|
||||
@ARGV == 1 || @ARGV == 2 || (@ARGV == 0 && $nonexistent)
|
||||
or die "usage: $0 email-address [mailserver]\n";
|
||||
|
||||
if ($nonexistent) {
|
||||
my $nonexistent_user = String::Random::random_regex '[a-z]\w{10}'
|
||||
. "-nonexistent";
|
||||
|
||||
if (!defined($address)) {
|
||||
# The user didn't give us anything. Make up a local address.
|
||||
|
||||
$address = $nonexistent_user;
|
||||
} elsif ($address =~ /\@/) {
|
||||
# The user gave us an entire email address -- we'll assume
|
||||
# they want us to replace the user part with a made-up
|
||||
# nonexistent username.
|
||||
|
||||
$address = "$nonexistent_user\@$'";
|
||||
} else {
|
||||
# The user gave us a hostname. Make up an address at that
|
||||
# host.
|
||||
|
||||
$address = "$nonexistent_user\@$address";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!defined($server)) {
|
||||
# The user didn't specify what mail server to connect to; try to
|
||||
# figure it out from the address.
|
||||
|
||||
my @addr_objects = Email::Address->parse($address);
|
||||
|
||||
if (@addr_objects) {
|
||||
# We found an address. Look up the MX for that host.
|
||||
|
||||
die "$0: we only handle one address at a time for now\n"
|
||||
if @addr_objects > 1;
|
||||
my $addr_object = $addr_objects[0];
|
||||
|
||||
$server = get_mx($addr_object->host);
|
||||
} else {
|
||||
# We couldn't parse the address, so assume it's local.
|
||||
# Local delivery is potentially a lot more complicated than
|
||||
# this, but let's ignore that for now.
|
||||
|
||||
$server = "localhost";
|
||||
}
|
||||
} elsif ($server =~ /^mx:/i) {
|
||||
# The user has explicitly requested that we look up the MX for
|
||||
# a particular host, and use that as our server.
|
||||
|
||||
$server = get_mx($');
|
||||
}
|
||||
|
||||
|
||||
print "Connecting to $server...\n" if $verbose;
|
||||
my $exit_code = 0;
|
||||
|
||||
my $smtp = Net::SMTP->new($server, Hello => $helo_hostname,
|
||||
ExactAddresses => 1, Debug => $verbose)
|
||||
or die "$0: can't connect to $server\n";
|
||||
|
||||
if ($smtp->mail($from_address)) {
|
||||
# The server accepted our MAIL command; go ahead and try the RCPT.
|
||||
|
||||
$smtp->to($address) or $exit_code = 1;
|
||||
$output = "$server: " . $smtp->code . " " . $smtp->message;
|
||||
} else {
|
||||
# The server rejected out MAIL command. We're done here.
|
||||
|
||||
$exit_code = 2;
|
||||
$output = "server rejected our From address of <$from_address>:\n"
|
||||
. "$server: " . $smtp->code . " " . $smtp->message;
|
||||
}
|
||||
|
||||
$smtp->quit;
|
||||
|
||||
print $output unless $verbose;
|
||||
|
||||
exit $exit_code;
|
||||
4
bin/shakegrep
Executable file
4
bin/shakegrep
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
#echo $2
|
||||
#agrep -n -i -d '$$' -t -r "$*" ~/shakespeare | sed '/\/.*\/[A-Za-z]*:/ s/:\s*/:\n/'
|
||||
agrep -i -d '$$' -t -r "$1" /home/michener/shakespeare/**/*$2* | sed '/\/.*\/[A-Za-z0-9]*:/ s/:\s*/:\n/'
|
||||
18
bin/showansicol
Executable file
18
bin/showansicol
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
############################################################
|
||||
# Nico Golde nico@ngolde.de Homepage: http://www.ngolde.de
|
||||
# Letzte Änderung: Mon Feb 16 16:24:41 CET 2004
|
||||
############################################################
|
||||
|
||||
for attr in 0 1 4 5 7 ; do
|
||||
echo "----------------------------------------------------------------"
|
||||
printf "ESC[%s;Foreground;Background - \n" $attr
|
||||
for fore in 30 31 32 33 34 35 36 37; do
|
||||
for back in 40 41 42 43 44 45 46 47; do
|
||||
printf '\033[%s;%s;%sm %02s;%02s ' $attr $fore $back $fore $back
|
||||
done
|
||||
printf '\n'
|
||||
done
|
||||
printf '\033[0m'
|
||||
done
|
||||
|
||||
3
bin/splitquerystring
Executable file
3
bin/splitquerystring
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo $QUERY_STRING | sed 's/%20/ /g' | sed 's/&/\n/g'
|
||||
2
bin/streamvideo
Executable file
2
bin/streamvideo
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
pv /home/michener/src/videostream/testscript.txt $1 | nc -l -p 49300
|
||||
346
bin/tfc
Executable file
346
bin/tfc
Executable file
|
|
@ -0,0 +1,346 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
TFCStrings = { 'he' => [
|
||||
[
|
||||
"a superhumanly strong",
|
||||
"an underprivileged",
|
||||
"a globe-trotting",
|
||||
"an impetuous",
|
||||
"a shy",
|
||||
"a suave",
|
||||
"a notorious",
|
||||
"a one-legged",
|
||||
"an all-American",
|
||||
"a short-sighted",
|
||||
"an otherworldly",
|
||||
"a hate-fuelled",
|
||||
"a scrappy",
|
||||
"an unconventional",
|
||||
"a jaded",
|
||||
"a leather-clad",
|
||||
"a fiendish",
|
||||
"a Nobel prize-winning",
|
||||
"a suicidal",
|
||||
"a maverick",
|
||||
"a bookish",
|
||||
"an old-fashioned",
|
||||
"a witless",
|
||||
"a lounge-singing",
|
||||
"a war-weary",
|
||||
"a scarfaced",
|
||||
"a gun-slinging",
|
||||
"an obese",
|
||||
"a time-tossed",
|
||||
"a benighted",
|
||||
"an uncontrollable",
|
||||
"an immortal",
|
||||
"an oversexed",
|
||||
"a world-famous",
|
||||
"an ungodly",
|
||||
"a fast talking",
|
||||
"a deeply religious",
|
||||
"a lonely",
|
||||
"a sword-wielding",
|
||||
"a genetically engineered",
|
||||
],[
|
||||
"white trash",
|
||||
"zombie",
|
||||
"shark-wrestling",
|
||||
"playboy",
|
||||
"guitar-strumming",
|
||||
"Jewish",
|
||||
"sweet-toothed",
|
||||
"bohemian",
|
||||
"crooked",
|
||||
"chivalrous",
|
||||
"moralistic",
|
||||
"amnesiac",
|
||||
"devious",
|
||||
"drug-addicted",
|
||||
"voodoo",
|
||||
"Catholic",
|
||||
"overambitious",
|
||||
"coffee-fuelled",
|
||||
"pirate",
|
||||
"misogynist",
|
||||
"skateboarding",
|
||||
"arachnophobic",
|
||||
"Amish",
|
||||
"small-town",
|
||||
"Republican",
|
||||
"one-eyed",
|
||||
"gay",
|
||||
"guerilla",
|
||||
"vegetarian",
|
||||
"dishevelled",
|
||||
"alcoholic",
|
||||
"flyboy",
|
||||
"ninja",
|
||||
"albino",
|
||||
"hunchbacked",
|
||||
"neurotic",
|
||||
"umbrella-wielding",
|
||||
"native American",
|
||||
"soccer-playing",
|
||||
"day-dreaming",
|
||||
],[
|
||||
"grifter",
|
||||
"stage actor",
|
||||
"paramedic",
|
||||
"gentleman spy",
|
||||
"jungle king",
|
||||
"hairdresser",
|
||||
"photographer",
|
||||
"ex-con",
|
||||
"vagrant",
|
||||
"filmmaker",
|
||||
"werewolf",
|
||||
"senator",
|
||||
"romance novelist",
|
||||
"shaman",
|
||||
"cop",
|
||||
"rock star",
|
||||
"farmboy",
|
||||
"cat burglar",
|
||||
"cowboy",
|
||||
"cyborg",
|
||||
"inventor",
|
||||
"assassin",
|
||||
"boxer",
|
||||
"dog-catcher",
|
||||
"master criminal",
|
||||
"gangster",
|
||||
"firefighter",
|
||||
"househusband",
|
||||
"dwarf",
|
||||
"librarian",
|
||||
"paranormal investigator",
|
||||
"Green Beret",
|
||||
"waffle chef",
|
||||
"vampire hunter",
|
||||
"messiah",
|
||||
"astronaut",
|
||||
"sorceror",
|
||||
"card shark",
|
||||
"matador",
|
||||
"barbarian",
|
||||
],[
|
||||
"with a robot buddy named Sparky.",
|
||||
"whom everyone believes is mad.",
|
||||
"gone bad.",
|
||||
"with a mysterious suitcase handcuffed to his arm.",
|
||||
"living undercover at Ringling Bros. Circus.",
|
||||
"searching for his wife's true killer.",
|
||||
"who dotes on his loving old ma.",
|
||||
"looking for 'the Big One.'",
|
||||
"who knows the secret of the alien invasion.",
|
||||
"on the edge.",
|
||||
"on a mission from God.",
|
||||
"with a secret.",
|
||||
"in drag.",
|
||||
"",
|
||||
"plagued by the memory of his family's brutal murder.",
|
||||
"looking for a cure to the poison coursing through his veins.",
|
||||
"moving from town to town,
|
||||
helping folk in trouble.",
|
||||
"who must take medication to keep him sane.",
|
||||
"who hangs with the wrong crowd.",
|
||||
"possessed of the uncanny powers of an insect.",
|
||||
"with a winning smile and a way with the ladies.",
|
||||
"fleeing from a secret government programme.",
|
||||
"from the 'hood.",
|
||||
"haunted by an iconic dead American confidante.",
|
||||
"with a passion for fast cars.",
|
||||
"trapped in a world he never made.",
|
||||
"in a wheelchair.",
|
||||
"on the hunt for the last specimen of a great and near-mythical creature.",
|
||||
"on the run.",
|
||||
"for the 21st century.",
|
||||
"who hides his scarred face behind a mask.",
|
||||
"on the wrong side of the law.",
|
||||
"with no name.",
|
||||
"from the Mississippi delta.",
|
||||
"with acid for blood.",
|
||||
"with nothing left to lose.",
|
||||
"haunted by memories of 'Nam.",
|
||||
"on a search for his missing sister.",
|
||||
"on his last day in the job.",
|
||||
"from a doomed world.",
|
||||
"who believes he can never love again.",
|
||||
]
|
||||
], 'she' => [
|
||||
[
|
||||
"a radical",
|
||||
"a green-fingered",
|
||||
"a tortured",
|
||||
"a time-travelling",
|
||||
"a vivacious",
|
||||
"a scantily clad",
|
||||
"a mistrustful",
|
||||
"a violent",
|
||||
"a transdimensional",
|
||||
"a strong-willed",
|
||||
"a ditzy",
|
||||
"a man-hating",
|
||||
"a high-kicking",
|
||||
"a blind",
|
||||
"an elegant",
|
||||
"a supernatural",
|
||||
"a foxy",
|
||||
"a bloodthirsty",
|
||||
"a cynical",
|
||||
"a beautiful",
|
||||
"a plucky",
|
||||
"a sarcastic",
|
||||
"a psychotic",
|
||||
"a hard-bitten",
|
||||
"a manipulative",
|
||||
"an orphaned",
|
||||
"a cosmopolitan",
|
||||
"a chain-smoking",
|
||||
"a cold-hearted",
|
||||
"a warm-hearted",
|
||||
"a sharp-shooting",
|
||||
"an enchanted",
|
||||
"a wealthy",
|
||||
"a pregnant",
|
||||
"a mentally unstable",
|
||||
"a virginal",
|
||||
"a brilliant",
|
||||
"a disco-crazy",
|
||||
"a provocative",
|
||||
"an artistic"
|
||||
],[
|
||||
"tempestuous",
|
||||
"Buddhist",
|
||||
"foul-mouthed",
|
||||
"nymphomaniac",
|
||||
"green-skinned",
|
||||
"impetuous",
|
||||
"African-American",
|
||||
"punk",
|
||||
"hypochondriac",
|
||||
"junkie",
|
||||
"blonde",
|
||||
"goth",
|
||||
"insomniac",
|
||||
"gypsy",
|
||||
"mutant",
|
||||
"renegade",
|
||||
"tomboy",
|
||||
"French-Canadian",
|
||||
"motormouth",
|
||||
"belly-dancing",
|
||||
"communist",
|
||||
"hip-hop",
|
||||
"thirtysomething",
|
||||
"cigar-chomping",
|
||||
"extravagent",
|
||||
"out-of-work",
|
||||
"Bolivian",
|
||||
"mute",
|
||||
"cat-loving",
|
||||
"snooty",
|
||||
"wisecracking",
|
||||
"red-headed",
|
||||
"winged",
|
||||
"kleptomaniac",
|
||||
"antique-collecting",
|
||||
"psychic",
|
||||
"gold-digging",
|
||||
"bisexual",
|
||||
"paranoid",
|
||||
"streetsmart"
|
||||
],[
|
||||
"archaeologist",
|
||||
"pearl diver",
|
||||
"mechanic",
|
||||
"detective",
|
||||
"hooker",
|
||||
"femme fatale",
|
||||
"former first lady",
|
||||
"barmaid",
|
||||
"fairy princess",
|
||||
"magician's assistant",
|
||||
"schoolgirl",
|
||||
"college professor",
|
||||
"angel",
|
||||
"bounty hunter",
|
||||
"opera singer",
|
||||
"cab driver",
|
||||
"soap star",
|
||||
"doctor",
|
||||
"politician",
|
||||
"lawyer",
|
||||
"nun",
|
||||
"snake charmer",
|
||||
"journalist",
|
||||
"bodyguard",
|
||||
"vampire",
|
||||
"stripper",
|
||||
"Valkyrie",
|
||||
"wrestler",
|
||||
"mermaid",
|
||||
"single mother",
|
||||
"safe cracker",
|
||||
"traffic cop",
|
||||
"research scientist",
|
||||
"queen of the dead",
|
||||
"Hell's Angel",
|
||||
"museum curator",
|
||||
"advertising executive",
|
||||
"widow",
|
||||
"mercenary",
|
||||
"socialite"
|
||||
],[
|
||||
"on her way to prison for a murder she didn't commit.",
|
||||
"trying to make a difference in a man's world.",
|
||||
"with the soul of a mighty warrior.",
|
||||
"looking for love in all the wrong places.",
|
||||
"with an MBA from Harvard.",
|
||||
"who hides her beauty behind a pair of thick-framed spectacles.",
|
||||
"with the power to see death.",
|
||||
"descended from a line of powerful witches.",
|
||||
"from a family of eight older brothers.",
|
||||
"with a flame-thrower.",
|
||||
"with her own daytime radio talk show.",
|
||||
"living on borrowed time.",
|
||||
"who can talk to animals.",
|
||||
"prone to fits of savage,
|
||||
blood-crazed rage.",
|
||||
"who don't take no shit from nobody.",
|
||||
"with a knack for trouble.",
|
||||
"who believes she is the reincarnation of an ancient Egyptian queen.",
|
||||
"fleeing from a Satanic cult.",
|
||||
"on the trail of a serial killer.",
|
||||
"with a birthmark shaped like Liberty's torch.",
|
||||
"in the witness protection scheme.",
|
||||
"from out of town.",
|
||||
"from aristocratic European stock.",
|
||||
"living homeless in New York's sewers.",
|
||||
"with only herself to blame.",
|
||||
"from beyond the grave.",
|
||||
"married to the Mob.",
|
||||
"from the wrong side of the tracks.",
|
||||
"from a secret island of warrior women.",
|
||||
"from Mars.",
|
||||
"with someone else's memories.",
|
||||
"from a different time and place.",
|
||||
"operating on the wrong side of the law.",
|
||||
"who inherited a spooky stately manor from her late maiden aunt.",
|
||||
"who dreams of becoming Elvis.",
|
||||
"with a song in her heart and a spring in her step.",
|
||||
"in the wrong place at the wrong time.",
|
||||
"with an incredible destiny.",
|
||||
"with the power to bend men's minds.",
|
||||
"with an evil twin sister."
|
||||
]
|
||||
] }
|
||||
|
||||
def descr(gender)
|
||||
(0..3).to_a.map { |n|
|
||||
TFCStrings[gender][n][rand(TFCStrings[gender][n].size)]
|
||||
}.join(' ').sub(/ $/, '.')
|
||||
end
|
||||
|
||||
puts("He's " + descr('he') + " She's " + descr('she') + ' They fight crime!')
|
||||
35
bin/theyfightcrime
Executable file
35
bin/theyfightcrime
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# They Fight Crime!
|
||||
#
|
||||
# taken from the Javascript at
|
||||
# http://home.epix.net/~mhryvnak/theyfightcrime.html
|
||||
# and translated into python by B. Michener
|
||||
#
|
||||
|
||||
import random
|
||||
|
||||
#init a;
|
||||
a = [0, 1, 2, 3, 4, 5, 6, 7]
|
||||
for i in range(0,8):
|
||||
a[i] = random.randint(0,39)
|
||||
|
||||
he1 = ["a superhumanly strong","an underprivileged","a globe-trotting","an impetuous","a shy","a suave","a notorious","a one-legged","an all-American","a short-sighted","an otherworldly","a hate-fuelled","a scrappy","an unconventional","a jaded","a leather-clad","a fiendish","a Nobel prize-winning","a suicidal","a maverick","a bookish","an old-fashioned","a witless","a lounge-singing","a war-weary","a scarfaced","a gun-slinging","an obese","a time-tossed","a benighted","an uncontrollable","an immortal","an oversexed","a world-famous","an ungodly","a fast talking","a deeply religious","a lonely","a sword-wielding","a genetically engineered"]
|
||||
|
||||
he2 = ["white trash","zombie","shark-wrestling","playboy","guitar-strumming","Jewish","sweet-toothed","bohemian","crooked","chivalrous","moralistic","amnesiac","devious","drug-addicted","voodoo","Catholic","overambitious","coffee-fuelled","pirate","misogynist","skateboarding","arachnophobic","Amish","small-town","Republican","one-eyed","gay","guerilla","vegetarian","dishevelled","alcoholic","flyboy","ninja","albino","hunchbacked","neurotic","umbrella-wielding","native American","soccer-playing","day-dreaming"]
|
||||
|
||||
he3 = ["grifter","stage actor","paramedic","gentleman spy","jungle king","hairdresser","photographer","ex-con","vagrant","filmmaker","werewolf","senator","romance novelist","shaman","cop","rock star","farmboy","cat burglar","cowboy","cyborg","inventor","assassin","boxer","dog-catcher","master criminal","gangster","firefighter","househusband","dwarf","librarian","paranormal investigator","Green Beret","waffle chef","vampire hunter","messiah","astronaut","sorceror","card sharp","matador","barbarian"]
|
||||
|
||||
he4 = ["with a robot buddy named Sparky.","whom everyone believes is mad.","gone bad.","with a mysterious suitcase handcuffed to his arm.","living undercover at Ringling Bros. Circus.","searching for his wife's true killer.","who dotes on his loving old ma.","looking for 'the Big One.'","who knows the secret of the alien invasion.","on the edge.","on a mission from God.","with a secret.","in drag.","","plagued by the memory of his family's brutal murder.","looking for a cure to the poison coursing through his veins.","moving from town to town, helping folk in trouble.","who must take medication to keep him sane.","who hangs with the wrong crowd.","possessed of the uncanny powers of an insect.","with a winning smile and a way with the ladies.","fleeing from a secret government programme.","from the 'hood.","haunted by an iconic dead American confidante","with a passion for fast cars.","trapped in a world he never made.","in a wheelchair.","on the hunt for the last specimen of a great and near-mythical creature.","on the run.","for the 21st century.","who hides his scarred face behind a mask.","on the wrong side of the law.","with no name.","from the Mississippi delta.","with acid for blood.","with nothing left to lose.","haunted by memories of 'Nam.","on a search for his missing sister.","on his last day in the job.","from a doomed world.","who believes he can never love again."]
|
||||
|
||||
she1 = ["a radical","a green-fingered","a tortured","a time-travelling","a vivacious","a scantily clad","a mistrustful","a violent","a transdimensional","a strong-willed","a ditzy","a man-hating","a high-kicking","a blind","an elegant","a supernatural","a foxy","a bloodthirsty","a cynical","a beautiful","a plucky","a sarcastic","a psychotic","a hard-bitten","a manipulative","an orphaned","a cosmopolitan","a chain-smoking","a cold-hearted","a warm-hearted","a sharp-shooting","an enchanted","a wealthy","a pregnant","a mentally unstable","a virginal","a brilliant","a disco-crazy","a provocative","an artistic"]
|
||||
|
||||
she2 = ["tempestuous","Buddhist","foul-mouthed","nymphomaniac","green-skinned","impetuous","African-American","punk","hypochondriac","junkie","blonde","goth","insomniac","gypsy","mutant","renegade","tomboy","French-Canadian","motormouth","belly-dancing","communist","hip-hop","thirtysomething","cigar-chomping","extravagent","out-of-work","Bolivian","mute","cat-loving","snooty","wisecracking","red-headed","winged","kleptomaniac","antique-collecting","psychic","gold-digging","bisexual","paranoid","streetsmart"]
|
||||
|
||||
she3 = ["archaeologist","pearl diver","mechanic","detective","hooker","femme fatale","former first lady","barmaid","fairy princess","magician's assistant","schoolgirl","college professor","angel","bounty hunter","opera singer","cab driver","soap star","doctor","politician","lawyer","nun","snake charmer","journalist","bodyguard","vampire","stripper","Valkyrie","wrestler","mermaid","single mother","safe cracker","traffic cop","research scientist","queen of the dead","Hell's Angel","museum curator","advertising executive","widow","mercenary","socialite"]
|
||||
|
||||
she4 = ["on her way to prison for a murder she didn't commit.","trying to make a difference in a man's world.","with the soul of a mighty warrior.","looking for love in all the wrong places.","with an MBA from Harvard.","who hides her beauty behind a pair of thick-framed spectacles.","with the power to see death.","descended from a line of powerful witches.","from a family of eight older brothers.","with a flame-thrower.","with her own daytime radio talk show.","living on borrowed time.","who can talk to animals.","prone to fits of savage, blood-crazed rage.","who don't take no shit from nobody.","with a knack for trouble.","who believes she is the reincarnation of an ancient Egyptian queen.","fleeing from a Satanic cult.","on the trail of a serial killer.","with a birthmark shaped like Liberty's torch.","in the witness protection scheme.","from out of town.","from aristocratic European stock.","living homeless in New York's sewers.","with only herself to blame.","from beyond the grave","married to the Mob.","from the wrong side of the tracks.","from a secret island of warrior women.","from Mars.","with someone else's memories.","from a different time and place.","operating on the wrong side of the law.","who inherited a spooky stately manor from her late maiden aunt.","who dreams of becoming Elvis.","with a song in her heart and a spring in her step.","in the wrong place at the wrong time.","with an incredible destiny.","with the power to bend men's minds.","with an evil twin sister."]
|
||||
|
||||
print "He's " + he1[a[0]] + " " + he2[a[1]] + " " + he3[a[2]] + " " + he4[a[3]],
|
||||
print "She's " + she1[a[4]] + " " + she2[a[5]] + " " + she3[a[6]] + " " + she4[a[7]],
|
||||
print "They fight crime!"
|
||||
87
bin/touchhtml
Executable file
87
bin/touchhtml
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Globals
|
||||
#
|
||||
use vars qw/$deftext %opt /;
|
||||
|
||||
#
|
||||
# Command line options processing
|
||||
#
|
||||
sub init()
|
||||
{
|
||||
use Getopt::Std;
|
||||
my $opt_string = 'hpci:o:t:j:';
|
||||
getopts( "$opt_string", \%opt ) or usage();
|
||||
usage() if $opt{h};
|
||||
}
|
||||
|
||||
#
|
||||
# Message about this program and how to use it
|
||||
#
|
||||
sub usage()
|
||||
{
|
||||
print STDERR << "EOF";
|
||||
|
||||
touchhtml -- Create a barebones HTML file
|
||||
|
||||
usage: $0 [-hpc][-i <FILE>][-o <FILE>][-t <TITLE>]
|
||||
|
||||
-h : This (help) message
|
||||
-p : Add <pre> tags
|
||||
-c : Print "Content-type" at the start (for CGI)
|
||||
-i FILE : Read body from given filename
|
||||
-o FILE : Output to given filename
|
||||
-t TITLE : Set the HTML <TITLE> field to given title
|
||||
-j FILE : Include this JavaScript filename in the body
|
||||
|
||||
EOF
|
||||
exit;
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
|
||||
if (!$opt{o}) {
|
||||
open(FILEH, ">-");
|
||||
}
|
||||
else
|
||||
{
|
||||
open(FILEH, ">$opt{o}") || die "Cannot open file for writing!";
|
||||
}
|
||||
|
||||
if ($opt{c}) {
|
||||
print "Content-type: text/html\n\n";
|
||||
}
|
||||
|
||||
print FILEH <<FOO;
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>$opt{t}</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
FOO
|
||||
print FILEH "<pre>\n" if $opt{p};
|
||||
if ($opt{i})
|
||||
{
|
||||
open (INFILE, "<$opt{i}") || die "Cannot open file for reading!";
|
||||
while (<INFILE>)
|
||||
{
|
||||
print FILEH;
|
||||
}
|
||||
close(INFILE);
|
||||
}
|
||||
elsif (!(-t STDIN))
|
||||
{
|
||||
while (<STDIN>)
|
||||
{
|
||||
print FILEH;
|
||||
}
|
||||
}
|
||||
print FILEH "</pre>\n" if $opt{p};
|
||||
print FILEH "<script src='$opt{j}'>\n</script>\n" if $opt{j};
|
||||
print FILEH <<FOO;
|
||||
</BODY>
|
||||
</HTML>
|
||||
FOO
|
||||
|
||||
close(FILEH);
|
||||
73
bin/unborkify
Executable file
73
bin/unborkify
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/local/bin/perl
|
||||
|
||||
use Getopt::Std;
|
||||
getopts('u');
|
||||
|
||||
$user = (getpwuid($<))[0];
|
||||
|
||||
%maps = (
|
||||
'a' => "\340\341\342\343\344\345",
|
||||
'c' => "\242\347",
|
||||
'd' => "\360",
|
||||
'e' => "\350\351\352\353",
|
||||
'i' => "\354\355\356\357",
|
||||
'n' => "\361",
|
||||
'o' => "\272\362\363\364\365\366\370",
|
||||
'p' => "\376",
|
||||
'q' => "\266",
|
||||
'u' => "\265\371\372\373\374",
|
||||
'x' => "\244\327",
|
||||
'y' => "\375",
|
||||
'A' => "\300\301\302\303\304\305",
|
||||
'B' => "\337",
|
||||
'C' => "\307\251",
|
||||
'D' => "\320",
|
||||
'E' => "\310\311\312\313",
|
||||
'I' => "\314\315\316\317",
|
||||
'L' => "\243",
|
||||
'N' => "\321",
|
||||
'O' => "\322\323\324\325\326",
|
||||
'P' => "\336",
|
||||
'R' => "\256",
|
||||
'U' => "\331\332\333\334",
|
||||
'Y' => "\245\335",
|
||||
'!' => "\241",
|
||||
'>' => "\273",
|
||||
'<' => "\253",
|
||||
'"' => "\250",
|
||||
'+' => "\367",
|
||||
'|' => "\246",
|
||||
',' => "\270",
|
||||
'?' => "\277",
|
||||
'0' => "\330",
|
||||
'2' => "\262",
|
||||
'3' => "\263"
|
||||
);
|
||||
|
||||
$| = 1;
|
||||
|
||||
while (<>) {
|
||||
CHAR: for $i (0..(length($_) - 1)) {
|
||||
$c = substr($_,$i,1);
|
||||
|
||||
# if ($c eq 'A' && substr($_,$i+1,1) eq 'E') {
|
||||
# print "\306";
|
||||
# $skip = 1; next;
|
||||
# } elsif ($c eq 'a' && substr($_,$i+1,1) eq 'e') {
|
||||
# print "\346";
|
||||
# $skip = 1; next;
|
||||
# } else {
|
||||
# print((defined $maps{$c}) ?
|
||||
# substr($maps{$c}, int rand(length($maps{$c})), 1) : $c);
|
||||
# }
|
||||
|
||||
for $x (keys %maps) {
|
||||
if ($maps{$x} =~ /\Q$c/) {
|
||||
print $x;
|
||||
next CHAR;
|
||||
}
|
||||
}
|
||||
|
||||
print $c;
|
||||
}
|
||||
}
|
||||
8
bin/vee
Executable file
8
bin/vee
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
open(OUTPIPE, "$ARGV[0]") || die;
|
||||
while(<STDIN>)
|
||||
{
|
||||
print STDOUT $_;
|
||||
print OUTPIPE $_;
|
||||
}
|
||||
close(OUTPIPE);
|
||||
120
bin/wd
Executable file
120
bin/wd
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# wd - what doing? get/set your twitter.com status
|
||||
# version 1.07, 2007-01-09
|
||||
#
|
||||
# Copyright (c) 2007, Andrew J. Cosgriff, http://polydistortion.net/
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# * The names of its contributors may not be used to endorse or
|
||||
# promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##########
|
||||
#
|
||||
# Configuration:
|
||||
#
|
||||
# set your username (e-mail address) and password here.
|
||||
#
|
||||
# note that you'll need to put a backslash \ in front of the @-sign in your
|
||||
# e-mail address.
|
||||
#
|
||||
my $username = "";
|
||||
my $password = "";
|
||||
##########
|
||||
use strict;
|
||||
use JSON;
|
||||
use LWP;
|
||||
use Getopt::Std;
|
||||
use DateTime::Format::Strptime;
|
||||
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->credentials('twitter.com:80','Twitter API',$username,$password);
|
||||
|
||||
my %opts = ();
|
||||
getopts('pvs', \%opts);
|
||||
|
||||
if (defined $opts{'p'}) {
|
||||
$ua->env_proxy;
|
||||
}
|
||||
|
||||
if ((! defined $opts{'s'}) and ($#ARGV > 0)) {
|
||||
print "[warning] hmm, are you sure you didn't mean to add a -s to that?\n\n";
|
||||
}
|
||||
|
||||
if (defined $opts{'s'}) {
|
||||
if ($#ARGV < 0) {
|
||||
print "well, what are you doing?\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $response = $ua->post('http://twitter.com/statuses/update.json',
|
||||
[ "status" => join(' ',@ARGV) ]);
|
||||
|
||||
die "Wrong content-type (",$response->content_type,") received - was expecting application/json\n"
|
||||
unless $response->content_type =~ m/^application\/json/;
|
||||
|
||||
my $status = jsonToObj($response->content);
|
||||
my %user = %{$status};
|
||||
if (defined $opts{'v'}) {
|
||||
print "status set to: ",$user{'text'},"\n";
|
||||
}
|
||||
} else {
|
||||
my $response = $ua->get('http://twitter.com/statuses/friends.json');
|
||||
|
||||
die "Can't get Twitter status: ", $response->status_line
|
||||
unless $response->is_success;
|
||||
|
||||
die "Wrong content-type (",$response->content_type,") received - was expecting application/json\n"
|
||||
unless $response->content_type =~ m/^application\/json/;
|
||||
|
||||
my $status = jsonToObj($response->content);
|
||||
my $strp = new DateTime::Format::Strptime(
|
||||
pattern => '%a %b %d %T %z %Y',
|
||||
locale => 'en_AU',
|
||||
time_zone => 'Australia/Melbourne',
|
||||
);
|
||||
my %stati=();
|
||||
foreach my $userobj (@{$status}) {
|
||||
my %user=%{$userobj};
|
||||
next if ((($#ARGV >= 0) and
|
||||
($user{screen_name} !~ m/$ARGV[0]/))
|
||||
or (! defined $user{status}));
|
||||
|
||||
$stati{$user{screen_name}}{"text"} = $user{status}->{text};
|
||||
$stati{$user{screen_name}}{"rel"} = $user{status}->{relative_created_at};
|
||||
$stati{$user{screen_name}}{"date"} = DateTime::Format::Strptime::strftime("%s",$strp->parse_datetime($user{status}->{created_at}));
|
||||
}
|
||||
|
||||
foreach my $user (sort {$stati{$a}{"date"} cmp $stati{$b}{"date"};} keys %stati) {
|
||||
print "$user ",$stati{$user}{text}," (",$stati{$user}{"rel"},")\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
bin/wye
Executable file
BIN
bin/wye
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue