Mercurial > hg > paul
changeset 0:2aa53823fb21
new repo
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Sat, 06 Jun 2026 10:19:04 +0100 |
| parents | |
| children | 95740c6658a3 |
| files | bin/GET bin/acut bin/bobi.sh bin/boxi.sh bin/cdbdump bin/cdbget bin/cdbmake bin/cdbmake-12 bin/cdbmake-sv bin/cdbstats bin/cdbtest bin/char-hist bin/cygclean bin/decrypt bin/ep.sh bin/fetch bin/fetchH bin/fetchL bin/ff bin/fixu.sh bin/fixurl bin/fromE bin/fromL bin/fromM bin/fromQ bin/fromS bin/goE bin/goHome bin/goM bin/hist bin/invite.sh bin/ki bin/kir bin/makeAVI.sh bin/myscr.bat bin/newSS bin/newdoc bin/newpipe bin/normXML bin/nsgmlh bin/ovpn.sh bin/pd bin/psav bin/psp.sh bin/pub bin/rd.bat bin/rq bin/rq.py bin/runTest bin/screen_with_agent.sh bin/showMPA.sh bin/sshv bin/sync-me bin/toE bin/toH bin/toM bin/toS bin/txp.bat bin/unpack.pl bin/v.sh bin/watched.sh bin/wchar-hist bin/wxsv bin/xcp bin/xed bin/xed.bat bin/xls2tsv.pl bin/xmlDiff bin/xmlnorm |
| diffstat | 69 files changed, 1682 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/GET Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,547 @@ +#!/usr/bin/perl -w + +eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}' + if 0; # not running under some shell + +# Simple user agent using LWP library. + +=head1 NAME + +lwp-request, GET, POST, HEAD - Simple command line user agent + +=head1 SYNOPSIS + +B<lwp-request> [B<-afPuUsSedvhx>] [B<-m> I<method>] [B<-b> I<base URL>] [B<-t> I<timeout>] + [B<-i> I<if-modified-since>] [B<-c> I<content-type>] + [B<-C> I<credentials>] [B<-p> I<proxy-url>] [B<-o> I<format>] I<url>... + +=head1 DESCRIPTION + +This program can be used to send requests to WWW servers and your +local file system. The request content for POST and PUT +methods is read from stdin. The content of the response is printed on +stdout. Error messages are printed on stderr. The program returns a +status value indicating the number of URLs that failed. + +The options are: + +=over 4 + +=item -m <method> + +Set which method to use for the request. If this option is not used, +then the method is derived from the name of the program. + +=item -f + +Force request through, even if the program believes that the method is +illegal. The server might reject the request eventually. + +=item -b <uri> + +This URI will be used as the base URI for resolving all relative URIs +given as argument. + +=item -t <timeout> + +Set the timeout value for the requests. The timeout is the amount of +time that the program will wait for a response from the remote server +before it fails. The default unit for the timeout value is seconds. +You might append "m" or "h" to the timeout value to make it minutes or +hours, respectively. The default timeout is '3m', i.e. 3 minutes. + +=item -i <time> + +Set the If-Modified-Since header in the request. If I<time> is the +name of a file, use the modification timestamp for this file. If +I<time> is not a file, it is parsed as a literal date. Take a look at +L<HTTP::Date> for recognized formats. + +=item -c <content-type> + +Set the Content-Type for the request. This option is only allowed for +requests that take a content, i.e. POST and PUT. You can +force methods to take content by using the C<-f> option together with +C<-c>. The default Content-Type for POST is +C<application/x-www-form-urlencoded>. The default Content-type for +the others is C<text/plain>. + +=item -p <proxy-url> + +Set the proxy to be used for the requests. The program also loads +proxy settings from the environment. You can disable this with the +C<-P> option. + +=item -P + +Don't load proxy settings from environment. + +=item -H <header> + +Send this HTTP header with each request. You can specify several, e.g.: + + lwp-request \ + -H 'Referer: http://other.url/' \ + -H 'Host: somehost' \ + http://this.url/ + +=item -C <username>:<password> + +Provide credentials for documents that are protected by Basic +Authentication. If the document is protected and you did not specify +the username and password with this option, then you will be prompted +to provide these values. + +=back + +The following options controls what is displayed by the program: + +=over 4 + +=item -u + +Print request method and absolute URL as requests are made. + +=item -U + +Print request headers in addition to request method and absolute URL. + +=item -s + +Print response status code. This option is always on for HEAD requests. + +=item -S + +Print response status chain. This shows redirect and authorization +requests that are handled by the library. + +=item -e + +Print response headers. This option is always on for HEAD requests. + +=item -d + +Do B<not> print the content of the response. + +=item -o <format> + +Process HTML content in various ways before printing it. If the +content type of the response is not HTML, then this option has no +effect. The legal format values are; I<text>, I<ps>, I<links>, +I<html> and I<dump>. + +If you specify the I<text> format then the HTML will be formatted as +plain latin1 text. If you specify the I<ps> format then it will be +formatted as Postscript. + +The I<links> format will output all links found in the HTML document. +Relative links will be expanded to absolute ones. + +The I<html> format will reformat the HTML code and the I<dump> format +will just dump the HTML syntax tree. + +Note that the C<HTML-Tree> distribution needs to be installed for this +option to work. In addition the C<HTML-Format> distribution needs to +be installed for I<-o text> or I<-o ps> to work. + +=item -v + +Print the version number of the program and quit. + +=item -h + +Print usage message and quit. + +=item -a + +Set text(ascii) mode for content input and output. If this option is not +used, content input and output is done in binary mode. + +=back + +Because this program is implemented using the LWP library, it will +only support the protocols that LWP supports. + +=head1 SEE ALSO + +L<lwp-mirror>, L<LWP> + +=head1 COPYRIGHT + +Copyright 1995-1999 Gisle Aas. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 AUTHOR + +Gisle Aas <gisle@aas.no> + +=cut + +$progname = $0; +$progname =~ s,.*[\\/],,; # use basename only +$progname =~ s/\.\w*$//; # strip extension, if any + +$VERSION = "5.827"; + + +require LWP; + +use URI; +use URI::Heuristic qw(uf_uri); + +use HTTP::Status qw(status_message); +use HTTP::Date qw(time2str str2time); + + +# This table lists the methods that are allowed. It should really be +# a superset for all methods supported for every scheme that may be +# supported by the library. Currently it might be a bit too HTTP +# specific. You might use the -f option to force a method through. +# +# "" = No content in request, "C" = Needs content in request +# +%allowed_methods = ( + GET => "", + HEAD => "", + POST => "C", + PUT => "C", + DELETE => "", + TRACE => "", + OPTIONS => "", +); + + +# We make our own specialization of LWP::UserAgent that asks for +# user/password if document is protected. +{ + package RequestAgent; + @ISA = qw(LWP::UserAgent); + + sub new + { + my $self = LWP::UserAgent::new(@_); + $self->agent("lwp-request/$main::VERSION "); + $self; + } + + sub get_basic_credentials + { + my($self, $realm, $uri) = @_; + if ($main::options{'C'}) { + return split(':', $main::options{'C'}, 2); + } + elsif (-t) { + my $netloc = $uri->host_port; + print "Enter username for $realm at $netloc: "; + my $user = <STDIN>; + chomp($user); + return (undef, undef) unless length $user; + print "Password: "; + system("stty -echo"); + my $password = <STDIN>; + system("stty echo"); + print "\n"; # because we disabled echo + chomp($password); + return ($user, $password); + } + else { + return (undef, undef) + } + } +} + +$method = uc(lc($progname) eq "lwp-request" ? "GET" : $progname); + +# Parse command line +use Getopt::Long; + +my @getopt_args = ( + 'a', # content i/o in text(ascii) mode + 'm=s', # set method + 'f', # make request even if method is not in %allowed_methods + 'b=s', # base url + 't=s', # timeout + 'i=s', # if-modified-since + 'c=s', # content type for POST + 'C=s', # credentials for basic authorization + 'H=s@', # extra headers, form "Header: value string" + # + 'u', # display method, URL and headers of request + 'U', # display request headers also + 's', # display status code + 'S', # display whole chain of status codes + 'e', # display response headers (default for HEAD) + 'd', # don't display content + # + 'h', # print usage + 'v', # print version + # + 'p=s', # proxy URL + 'P', # don't load proxy setting from environment + # + 'o=s', # output format +); + +Getopt::Long::config("noignorecase", "bundling"); +unless (GetOptions(\%options, @getopt_args)) { + usage(); +} +if ($options{'v'}) { + require LWP; + my $DISTNAME = 'libwww-perl-' . LWP::Version(); + die <<"EOT"; +This is lwp-request version $VERSION ($DISTNAME) + +Copyright 1995-1999, Gisle Aas. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. +EOT +} + +usage() if $options{'h'} || !@ARGV; + +# Create the user agent object +$ua = RequestAgent->new; + +# Load proxy settings from *_proxy environment variables. +$ua->env_proxy unless $options{'P'}; + +$method = uc($options{'m'}) if defined $options{'m'}; + +if ($options{'f'}) { + if ($options{'c'}) { + $allowed_methods{$method} = "C"; # force content + } + else { + $allowed_methods{$method} = ""; + } +} +elsif (!defined $allowed_methods{$method}) { + die "$progname: $method is not an allowed method\n"; +} + +if ($method eq "HEAD") { + $options{'s'} = 1; + $options{'e'} = 1 unless $options{'d'}; + $options{'d'} = 1; +} + +if (defined $options{'t'}) { + $options{'t'} =~ /^(\d+)([smh])?/; + die "$progname: Illegal timeout value!\n" unless defined $1; + $timeout = $1; + if (defined $2) { + $timeout *= 60 if $2 eq "m"; + $timeout *= 3600 if $2 eq "h"; + } + $ua->timeout($timeout); +} + +if (defined $options{'i'}) { + if (-e $options{'i'}) { + $time = (stat _)[9]; + } + else { + $time = str2time($options{'i'}); + die "$progname: Illegal time syntax for -i option\n" + unless defined $time; + } + $options{'i'} = time2str($time); +} + +$content = undef; +if ($allowed_methods{$method} eq "C") { + # This request needs some content + unless (defined $options{'c'}) { + # set default content type + $options{'c'} = ($method eq "POST") ? + "application/x-www-form-urlencoded" + : "text/plain"; + } + else { + die "$progname: Illegal Content-type format\n" + unless $options{'c'} =~ m,^[\w\-]+/[\w\-.+]+(?:\s*;.*)?$, + } + print "Please enter content ($options{'c'}) to be ${method}ed:\n" + if -t; + binmode STDIN unless -t or $options{'a'}; + $content = join("", <STDIN>); +} +else { + die "$progname: Can't set Content-type for $method requests\n" + if defined $options{'c'}; +} + +# Set up a request. We will use the same request object for all URLs. +$request = HTTP::Request->new($method); +$request->header('If-Modified-Since', $options{'i'}) if defined $options{'i'}; +for my $user_header (@{ $options{'H'} || [] }) { + my ($header_name, $header_value) = split /:\s*/, $user_header, 2; + $request->header($header_name, $header_value); + $ua->agent($header_value) if lc($header_name) eq "user-agent"; # Ugh! +} +#$request->header('Accept', '*/*'); +if ($options{'c'}) { # will always be set for request that wants content + $request->header('Content-Type', $options{'c'}); + $request->header('Content-Length', length $content); # Not really needed + $request->content($content); +} + +$errors = 0; + +# Ok, now we perform the requests, one URL at a time +while ($url = shift) { + # Create the URL object, but protect us against bad URLs + eval { + if ($url =~ /^\w+:/ || $options{'b'}) { # is there any scheme specification + $url = URI->new($url, $options{'b'}); + $url = $url->abs($options{'b'}) if $options{'b'}; + } + else { + $url = uf_uri($url); + } + }; + if ($@) { + $@ =~ s/ at .* line \d+.*//; + print STDERR $@; + $errors++; + next; + } + + $ua->proxy($url->scheme, $options{'p'}) if $options{'p'}; + + # Send the request and get a response back from the server + $request->uri($url); + $response = $ua->request($request); + + if ($options{'S'}) { + for my $r ($response->redirects, $response) { + my $method = $r->request->method; + my $url = $r->request->uri->as_string; + print "$method $url"; + if ($options{'e'}) { + print "\n"; + } + else { + print " --> ", $r->status_line, "\n"; + } + print $r->request->headers_as_string, "\n" if $options{'U'}; + if ($options{'e'}) { + # Display headers + print " ===> ", $r->status_line, "\n"; + print $r->headers_as_string; + print "\n"; # separate headers and content + } + } + } + else { + if ($options{'u'} || $options{'U'}) { + my $url = $response->request->uri->as_string; + print "$method $url\n"; + print $response->request->headers_as_string, "\n" if $options{'U'}; + } + if ($options{'s'}) { + print $response->status_line, "\n"; + } + if ($options{'e'}) { + # Display headers + print $response->headers_as_string; + print "\n"; # separate headers and content + } + } + + unless ($options{'d'}) { + if ($options{'o'} && + $response->content_type eq 'text/html') { + eval { + require HTML::Parse; + }; + if ($@) { + if ($@ =~ m,^Can't locate HTML/Parse.pm in \@INC,) { + die "The HTML-Tree distribution need to be installed for the -o option to be used.\n"; + } + else { + die $@; + } + } + my $html = HTML::Parse::parse_html($response->content); + { + $options{'o'} eq 'ps' && do { + require HTML::FormatPS; + my $f = HTML::FormatPS->new; + print $f->format($html); + last; + }; + $options{'o'} eq 'text' && do { + require HTML::FormatText; + my $f = HTML::FormatText->new; + print $f->format($html); + last; + }; + $options{'o'} eq 'html' && do { + print $html->as_HTML; + last; + }; + $options{'o'} eq 'links' && do { + my $base = $response->base; + $base = $options{'b'} if $options{'b'}; + for ( @{ $html->extract_links } ) { + my($link, $elem) = @$_; + my $tag = uc $elem->tag; + $link = URI->new($link)->abs($base)->as_string; + print "$tag\t$link\n"; + } + last; + }; + $options{'o'} eq 'dump' && do { + $html->dump; + last; + }; + # It is bad to not notice this before now :-( + die "Illegal -o option value ($options{'o'})\n"; + } + } + else { + binmode STDOUT unless $options{'a'}; + print $response->content; + } + } + + $errors++ unless $response->is_success; +} + +exit $errors; + + +sub usage +{ + die <<"EOT"; +Usage: $progname [-options] <url>... + -m <method> use method for the request (default is '$method') + -f make request even if $progname believes method is illegal + -b <base> Use the specified URL as base + -t <timeout> Set timeout value + -i <time> Set the If-Modified-Since header on the request + -c <conttype> use this content-type for POST, PUT, CHECKIN + -a Use text mode for content I/O + -p <proxyurl> use this as a proxy + -P don't load proxy settings from environment + -H <header> send this HTTP header (you can specify several) + -C <username>:<password> + provide credentials for basic authentication + + -u Display method and URL before any response + -U Display request headers (implies -u) + -s Display response status code + -S Display response status chain + -e Display response headers + -d Do not display content + -o <format> Process HTML content in various ways + + -v Show program version + -h Print this message +EOT +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/acut Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,6 @@ +#!/bin/bash +# Use awk to do cut -d whitespace +declare ff=("$@") +join_array() { local IFS=\$; echo "$*"; } +s=$(join_array "${ff[@]}") +awk '{print '\$${s/\$/,\$}\}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/bobi.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,6 @@ +#!/bin/bash +# sed replaces empty Pgm Code fields +ls -lt /c/Users/ht/Downloads/*HST?PGR?applicants*.xls | head -1 +xls2tsv.pl "`ls -t /c/Users/ht/Downloads/*HST?PGR?applicants*.xls | head -1|tr ' ' '?'`" |\ + ~/lib/python/bobi.py +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/boxi.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,6 @@ +#!/bin/bash +# sed replaces empty Pgm Code fields +ls -lt /c/Users/ht/Downloads/PG?Applications?List?for*.xls | head -1 +xls2tsv.pl "`ls -t /c/Users/ht/Downloads/PG?Applications?List?for*.xls | head -1|tr ' ' '?'`" | cut -f 2- | \ + sed 's/students /students /;s/\( S[0-9][0-9][0-9][0-9][0-9][0-9][0-9] \) /\1/'| ~/lib/python/boxi.py +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/cdbmake-12 Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,10 @@ +#!/bin/sh +# WARNING: This file was auto-generated. Do not edit! +awk ' + /^[^#]/ { + print "+" length($1) "," length($2) ":" $1 "->" $2 + } + END { + print "" + } +' | /home/ht/bin/cdbmake "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/cdbmake-sv Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,24 @@ +#!/bin/sh +# WARNING: This file was auto-generated. Do not edit! +awk ' + { + if (split($0,x,"#")) { + f = split(x[1],y) + if (f >= 2) { + if (split(y[2],z,"/") >= 2) { + a = "@" z[1] "/" z[2] + print "+" length(a) "," length(y[1]) ":" a "->" y[1] + for (i = 1;i <= f;i += 1) { + if (i != 2) { + a = y[i] "/" z[2] + print "+" length(a) "," length(z[1]) ":" a "->" z[1] + } + } + } + } + } + } + END { + print "" + } +' | /home/ht/bin/cdbmake "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/char-hist Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,8 @@ +#!/bin/perl +# frequency table of characters +while (<>) { + grep($cc[$_]++,unpack("C*",$_)); +}; +for ($i=0;$i<128;$i++) { + printf("%d %s %d\n",$i,$i>32?sprintf("%c",$i):sprintf("^%c",$i+64),$cc[$i]); +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/cygclean Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,13 @@ +#!/bin/bash +cd ~/u/Downloads/Cygwin\ setup +pat=http*%3a%2f%2f* +me=$$ +find $pat -type f -print0 | xargs -0 ls -t > ssn$me +find -L oldMirrors/$pat -type f -print0 | xargs -0 ls -t > sso$me +wc -l ss?$me +cat ss?$me | while read f; do echo `basename $f`; done > ssb$me +while read f; do echo ${f%%-[0-9]*}; done < ssb$me | sort | uniq -c | egrep -v ' 1 |setup.ini' | tr -s ' ' ' ' | cut -d ' ' -f 3 | sed 's/+/\\\\+/g' > ssp$me +while read p; do egrep -h "/$p-[0-9]" ss?$me|tail -n +2 ; done <ssp$me | xargs -n 100 rm +find $pat -type f -print0 | xargs -0 ls -t > snn$me +find -L oldMirrors/$pat -type f -print0 | xargs -0 ls -t > sno$me +wc -l sn?$me
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/decrypt Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,36 @@ +#!/bin/bash +# usage: decrypt [-p passwd] [-m method] keyFile xmlFile +# If no passwd, will prompt +# method defaults to pkcs12 +method=pkcs12 +while [ "x$1" != "x${1##-}" ] +do + case "$1" in + -p) passwd="$2"; shift; shift ;; + -m) method=$2; shift; shift ;; + *) echo bad switch "$1" -- usage: decrypt [-p passwd] [-m method] keyFile xmlFile; exit 1 ;; + esac +done +if [ $# -gt 0 ] + then + keyfile="$1" + shift + else + echo keyFile required -- usage: decrypt [-p passwd] [-m method] keyFile xmlFile; exit 1 +fi +if [ $# -gt 0 ] + then + xmlfile="$1" + else + xmlfile=/tmp/dec$$ + cat > $xmlfile + cl="t" +fi +pwd=${passwd:-`read -s -p "Password for $keyfile: " pw && echo $pw`} +kf="`cygpath -w \"$keyfile\"`" +xf="`cygpath -w \"$xmlfile\"`" +/c/Program\ Files/xmlsec/xmlsec decrypt --$method "$kf" --pwd "$pwd" "$xf" +if [ "$cl" ] + then + rm -f "$xmlfile" +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ep.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,9 @@ +#!/usr/bin/bash +# Export passport encrypted w/o recipient +#echo "|$WVAL|" +echo ready GPG_TTY=$GPG_TTY +gpg -u ht --batch --pinentry-mode loopback --passphrase "$WVAL" --decrypt ~/info/passwords | sponge | gpg --pinentry-mode loopback --passphrase "$WVAL" --output ~/info/passwords_$(date +%Y-%m-%d).gpg --symmetric +echo done 1 +gpg -u ht --batch --pinentry-mode loopback --passphrase "$WVAL" --decrypt ~/info/password_intro.txt | sponge | gpg --pinentry-mode loopback --passphrase "$WVAL" --output ~/info/password_intro_$(date +%Y-%m-%d).txt.gpg --symmetric +echo done 2 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fetch Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/bash +rsync -b -v --archive --remove-source-files lochinver.inf.ed.ac.uk:/disk/scratch/mail/stash/ "${1:-.}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fetchH Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/bash +rsync -b -v --archive --remove-source-files hst@hst.name:/home/hst/mail/stash/ "${1:-.}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fetchL Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/bash +rsync -b -v --archive --remove-source-files llc@hppllc.org:/home/llc/mail/stash/ "${1:-.}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ff Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,46 @@ +#!/bin/sh +# find any match from here +if [ "$1" = "-d" ] +then + shift + d="$1" + shift +else + d=. +fi +if [ "$1" = "-L" ] +then + shift + ll=-L +else + ll= +fi +if [ "$1" = "-y" ] +then + shift + yy= +else + yy="-not ( -path ./Yesterday -prune )" +fi +if [ "$1" = "-0" ] +then + shift + p=print0 +else + p=print +fi +usage="Usage: ff [-d where] [-L] [-y] [-0] pat ...\nfind pat anywhere in any name and print it\n -L follow links\n -y do look in Yesterday\n -0 use print0\n Anything after pat is included _before_ the final print(0)\n" +if [ "$1" = "-?" ] +then + printf "$usage" + exit 0 +fi +if [ "${1:0:1}" = "-" ] +then + printf "Additional args must be _after_ the pattern\n" + printf "$usage" 1>&2 + exit 1 +fi +ff=$1 +shift +find $ll "$d" $yy \( \( -iname \*$ff\* \) -o \( -iname .\*$ff\* \) \) "$@" -$p
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fixu.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,3 @@ +#!/bin/bash +# Usage: fixu.sh multilineurlwithslashes +echo "$1" | tr -d '\'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fixurl Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,3 @@ +#!/bin/sh +echo "$1" | sed 's/^.*url=//;s/%2F/\//g;s/%3A/:/;s/%2E/./g;s/%3F/?/;s/%3D/=/g;s/%20/ /g' +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fromE Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,25 @@ +#!/bin/bash +# Fetch file(s) from Edinburgh desktop machine +# Paths should be absolute or relative to remote home dir +# Globbing works (but quote it on the way in to avoid local interpretation) +# To rename a single remote file do fromE remote -r local +echo xcp "$DESKTOP:" "$@" +xcp "$DESKTOP:" "$@" +exit $? + +# Older version follows +ff= +dest=. +if [ "x$2" = "x" ] + then + ff=troutbeck.inf.ed.ac.uk:$1 + else + while [ "x$2" != "x" ] + do + ff="$ff troutbeck.inf.ed.ac.uk:$1" + shift + done + dest=$1 +fi +echo scp $ff $dest +scp $ff $dest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fromL Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/sh +ff= +dest=. +if [ "x$2" = "x" ] + then + ff=llc@hppllc.org:$1 + else + while [ "x$2" != "x" ] + do + ff="$ff llc@hppllc.org:$1" + shift + done + dest=$1 +fi +echo scp $ff $dest +scp $ff $dest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fromM Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/sh +ff= +dest=. +if [ "x$2" = "x" ] + then + ff=markup.co.uk:$1 + else + while [ "x$2" != "x" ] + do + ff="$ff markup.co.uk:$1" + shift + done + dest=$1 +fi +echo scp $ff $dest +scp $ff $dest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fromQ Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/sh +ff= +dest=. +if [ "x$2" = "x" ] + then + ff=sesamat@markup.co.uk:$1 + else + while [ "x$2" != "x" ] + do + ff="$ff sesamat@markup.co.uk:$1" + shift + done + dest=$1 +fi +echo scp $ff $dest +scp $ff $dest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/fromS Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/sh +ff= +dest=. +if [ "x$2" = "x" ] + then + ff=snco_snco@ssh.phx.nearlyfreespeech.net:$1 + else + while [ "x$2" != "x" ] + do + ff="$ff snco_snco@ssh.phx.nearlyfreespeech.net:$1" + shift + done + dest=$1 +fi +echo scp $ff $dest +scp $ff $dest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/goE Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh +/bin/ssh lochinver.inf.ed.ac.uk "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/goHome Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,3 @@ +#!/bin/sh +ssh 87.194.154.182 "$@" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/goM Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh +/bin/ssh markup.co.uk "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/hist Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,88 @@ +#!/bin/sh +# Usage: hist file bins [-max n] [-min n] [-ll n] [-t title] [-ntile n] +file=$1 +shift +nb=$1 +shift +date=`date` +while + case "x$1" in + x-max) shift; max=$1 ;; + x-ll) shift; ll=$1 ;; + x-min) shift; min=$1 ;; + x-t) shift; title=$1 ;; + x-ntile) shift; ntile=$1 ;; + x) break ;; + *) echo hunh 1>&2; exit 1 ;; + esac + do + shift +done +if [ \( -z "$max" -o -z "$min" \) ] + then + rfile=/tmp/hist$$ + sort -n $file > $rfile +fi +perl -e " +(\$max,\$min,\$nb,\$ll,\$title,\$ntile)=(${max:-`tail -1 /tmp/hist$$`}, + ${min:-`head -1 /tmp/hist$$`} + ,$nb,${ll:-80},\"${title:-$file}\",${ntile:-0});"' +$#bins=$nb; +$range=$max-$min; +while (<>) { + if ($_<$min) { + $minn+=1; + } + elsif ($_>$max) { + $maxn+=1; + } + else { + $n+=1; + $i=(($_-$min)/$range)*$nb; + if ($i==$nb) {$bins[$i-1]+=1} else {$bins[int($i)]+=1}; + }; +}; +$start=$min+$range/(2*$nb); +$step=$range/$nb; +foreach $i (0..$nb-1) { + $mb=$bins[$i] if ($bins[$i]>$mb); +}; +$bscale=$mb/($ll-16); +$bscale=1 if ($bscale<1); +print "$title ",`date`,"\n"; +print " n min max width maxcnt bscale"; +if ($ntile) { + print " ntiles tilew"; + $tile=$tstep=($n/$ntile); + $ntile--; +} +print "\n"; +printf("%7d%7.3f %7.3f%7.3f%6d %7.3f",$n,$min,$max,$step,$mb,$bscale); +printf("%5d %7.2f",$ntile+1,$tstep) if ($ntile); +print "\n\n"; +if ($minn) {printf("<%7.3f%7d\n",$min,$minn)}; +foreach $i (0..$nb-1) { + $n=$bins[$i]; + if ($ntile) { + $cum+=$n; + if ($cum>=$tile) { + print "-"; $tile+=$tstep; $ntile--; + } + else { + print " "; + }; + } + else { + print " "; + }; + printf("%7.3f%7d ",$start+($i*$step),$bins[$i]); + $nx=$bins[$i]/$bscale; + $nx=1 if (($nx<1) && ($bins[$i]>0)); + print "*" x $nx; print "\n"; +}; +if ($maxn) {printf(">%7.3f%7d\n",$max,$maxn)};' ${rfile:-$file} +if [ "$rfile" ] + then + rm $rfile +fi +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/invite.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,3 @@ +#!/usr/bin/bash +echo $(cat) >> ~/Documents/RSoF/Lucas/invitees.txt +cat ~/Documents/RSoF/Lucas/{hail,zoom,farewell}.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ki Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,5 @@ +#!/bin/bash +cd /tmp +kinit +/usr/local/src/kx509-master/build/kx509 -o openvpn-user-key +rsync -a troutbeck.inf.ed.ac.uk:/etc/httpd/kx509.crt .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/kir Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,5 @@ +#!/bin/bash +cd /tmp +kinit -f -R +/usr/local/src/kx509-master/build/kx509 -o openvpn-user-key +rsync -a lochinver.inf.ed.ac.uk:/etc/httpd/kx509.crt .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/makeAVI.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,9 @@ +#!/bin/bash +f=${1##*/} +/c/Users/ht/AppData/Roaming/myFFmpeg/ffmpeg.exe -i $(cygpath -d "$1") -map 0:0 -map 0:1 -c:a libmp3lame -ac 2 -async 1 -c:v mpeg4 -b:v 1163.52k -maxrate 2327.04k -bufsize 2327.04k -r 25 -s 720x404 -aspect 180:101 -trellis 0 -qsquish 0.5 -me_range 16 -i_qoffset 0 -refs 3 -sws_flags fast_bilinear -sc_threshold 40 -g 200 -qmin 3 -qmax 51 -threads 4 -vtag DIVX -sn -y "C:\Users\ht\Videos/${f%.*}.avi" |\ + while read l + do case l in + frame=*) printf '%s\r' "$l" ;; + *) printf '%s\n' "$l" ;; + esac +done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/myscr.bat Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,1 @@ +c:\cygwin\bin\mintty --icon /bin/hippo.ico /bin/screen
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/newSS Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,36 @@ +#!/bin/sh +if [ "$1" = "-x" ] + then + op=" +<xsl:output method=\"xml\" doctype-public=\"-//W3C//DTD XHTML 1.0 Strict//EN\" + doctype-system=\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"/>" +fi +d=/home/ht/lib/xml/ +p=$(pwd)/ +while : + do + dd=${d#/*} + pp=${p#/*} + x=${dd%%/*} + y=${pp%%/*} + if [ "$x" != "$y" ] + then + path=$(echo $pp | sed 's/[^/][^/]*/../g')$dd + break + fi + if [ "$x" == "" ] + then + path= + break + fi + d=${dd#*/} + p=${pp#*/} +done +cat << EOF +<?xml version='1.0'?> +<!DOCTYPE doc SYSTEM "${path}xsl.dtd" > +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">$op + <xsl:template match="/"> + </xsl:template> +</xsl:stylesheet> +EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/newdoc Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,35 @@ +#!/bin/bash +date=$(date +"%e %b %Y") +d=/home/ht/lib/xml/ +p=$(pwd)/ +while : + do + dd=${d#/*} + pp=${p#/*} + x=${dd%%/*} + y=${pp%%/*} + if [ "$x" != "$y" ] + then + path=$(echo $pp | sed 's/[^/][^/]*/../g')$dd + break + fi + d=${dd#*/} + p=${pp#*/} +done +cat << EOF +<?xml version='1.0'?> +<?xml-stylesheet type="text/xsl" href="${path}doc.xsl" ?> +<!DOCTYPE doc SYSTEM "${path}doc.dtd" > +<doc> + <head> + <title></title> + <author>Henry S. Thompson</author> + <date>$date</date> + </head> + <body> + <div> + <title></title> + </div> + </body> +</doc> +EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/newpipe Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,27 @@ +#!/bin/bash +date=$(date +"%e %b %Y") +d=/home/ht/lib/xml/ +p=$(pwd)/ +while : + do + dd=${d#/*} + pp=${p#/*} + x=${dd%%/*} + y=${pp%%/*} + if [ "$x" != "$y" ] + then + path=$(echo $pp | sed 's/[^/][^/]*/../g')$dd + break + fi + d=${dd#*/} + p=${pp#*/} +done +cat << EOF +<?xml version='1.0'?> +<!DOCTYPE p:pipeline SYSTEM "${path}xproc.dtd" [ +<!ATTLIST p:pipeline xmlns:c CDATA #IMPLIED> +]> +<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"> +<!-- Created: ${date} --> +</p:pipeline> +EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/normXML Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,10 @@ +#!/bin/sh +if [ "$1" = "-w" ] + then + shift + rxp -c ASCII -o 1 "$@" | sed '/0/s/ISO-646/utf-8/;s/	/ /g;s/> * *</>\ +</g;s/ / /g' | tr -s ' ' ' ' | sed '/></s@<\([_.a-zA-Z][^ >]*\)\([^>]*\)></\1>@<\1\2/>@g;s/> *</>\ +</g' + else + rxp -d "$@" +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/nsgmlh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh +nsgmls -c /usr/local/share/lib/sgml/html-catalog "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/ovpn.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,8 @@ +#!/usr/bin/bash +printf "%s\n%s\n" "$1" "$2" > /tmp/.xxx +( cd ~/u/OpenVPN + nohup /c/Program\ Files/OpenVPN/bin/openvpn --config config/Informatics-EdLAN-IF1.ovpn --auth-user-pass 'H:\C64\tmp\.xxx' 2>/dev/null </dev/null & +) +sleep 1 +echo done +rm /tmp/.xxx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/pd Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,6 @@ +#!/bin/sh +cd /home/ht/info +gpg -u ht --decrypt "$1" > /tmp/pwd +gpg -u ht --decrypt passwords | diff -bw /tmp/pwd - +rm /tmp/pwd +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/psav Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh +ci -m "$1" $2.xml $2.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/psp.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,5 @@ +#!/usr/bin/bash +export WVAL=$(cat) +#echo "<$WVAL>" +cd ~/info +~/bin/ep.sh 2>&1 && ~/lib/python/sendpwf.py $(date +%Y-%m-%d) "$@" 2>&1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/pub Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,54 @@ +#!/bin/sh +if [ '-?' = "$1" ] +then + shift +fi +if [ '-a' = "$1" ] +then + shift + ENC=!encoding=US-ASCII +else + ENC= +fi +if [ '-f' = "$1" ] +then + shift + if [ '-l' = "$1" ] + then + shift + LL="$1" + shift + else + LL=. + if [ ! -r "srr2.png" ] + then + cp -a /home/ht/Documents/HTalks/Icons/{srr2,24px-Cc-*}.png . + fi + fi + SS="file:///d:/lib/xml/doc.xsl license=$LL/" + AA= +else + SS= + AA=-a +fi +if [ '-d' = "$1" ] +then + shift + DIR="$1" + shift +fi +if [ '' = "$1" ] +then + echo "Usage: pub [-a] [-f [-l license-icon-dir]] [-p dir] fileroot [destroot]" +else + dest=${2:-$1}.html + saxon92 $AA $1.xml $SS $ENC > $dest + Echo "now psav msg fileroot" +fi +if [ "$DIR" ] +then + echo -n uploading to public_html/$DIR . . . + lxprintf -e '*[@href|@src]' '%s\n' '@href|@src' $dest | egrep '^./|^[^/]*$' | \ + xargs tar -czf - $dest | goE "/home/ht/share/bin/install-stdin $DIR" + echo uploading to public_html/$DIR . . . done +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/rd.bat Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,1 @@ +"%PROGRAMFILES(X86)%\Google\Chrome Remote Desktop\CurrentVersion\remoting_start_host.exe" --code="4/0AY0e-g5e4N48ITpPQJF38X-qj5iahRR3qmiDZxBHu8JQZGaun5e2FJJ2LNdwekuAdkYr6Q" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=%COMPUTERNAME%
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/rq Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,26 @@ +#!/bin/bash +n=100 +while [ "x$1" != "x${1##-}" ] +do + case $1 in + -s) shift; args="$args -S date -D" + sort=1 # FIXME rq.py unsorts otherwise + ;; + -S) shift; args="$args -s \"\"" ;; + -l) shift; less=1 ;; + -n) n=$2 ; shift ; shift ;; + -*) args="$args $1" ; shift ;; + *) echo usage: rq [-s] [-l] [-n n] [-...] query . . . ; exit 1 ;; + esac +done +args="$args -n $n" +/usr/bin/recollq $args -q "$@" > /tmp/rqr$$ +#recoll $args -t -q "$@" > /tmp/rqr$$ +head -2 /tmp/rqr$$ +tail -n +3 /tmp/rqr$$ | if [ "$sort" -o "$less" ] +then + rq.py "$sort" "$less" +else + cat +fi +rm /tmp/rqr$$
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/rq.py Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,198 @@ +#!/usr/bin/python2 +import sys +import re +import locale +from os import stat, unlink, system +from mailbox import mbox +from email.parser import Parser +import datetime +from tempfile import NamedTemporaryFile + +locale.setlocale(locale.LC_ALL, '') + +def cmp1(x,y): + c1=cmp(x[0],y[0]) + if c1: + return c1 + else: + return cmp(x[1],y[1]) + +def cmp2(x,y): + c1=cmp(x[0],y[0]) + if c1: + return c1 + else: + return locale.strcoll(x[1],y[1]) + +def dumpHdrsAndText(msg,outfile): + #print "MSG: %s"%repr(msg) + #print >>sys.stderr,'Content-Type: %s'%msg.get('Content-Type',None) + #print >>sys.stderr,'Content-Transfer-Encoding: %s'%msg.get('Content-Transfer-Encoding',None) + outfile.writelines("%s: %s\n"%(k,v) for (k,v) in msg.items()) + outfile.write("\n") + if msg.is_multipart(): + outfile.write('\nmultipart: %s\n\n'%len(msg.get_payload())) + for m in msg.get_payload(): + #print "PART: %s"%repr(m) + #print "part %s"%m.get('Content-Type','xx') + dumpHdrsAndText(m,outfile) + elif msg.get('Content-Type',None).find('text/')==0: + outfile.write(msg.get_payload(decode=True)) + else: + #print 'OCT: %s'%msg.get('Content-Type','xx') + pass + +pl=re.compile("([^\t]*)\t\\[file://([^\\]]*)\\]\t\[(.*)\]\t") +pif=re.compile("/(pers|group)-([12][0-9][0-9][0-9].[01][0-9])/([0-9]*)") +pof=re.compile("/.evolution/mail/local/([12][0-9][0-9][0-9].[01][0-9])$") +ovf=re.compile("\.overview$") +incoming={} +outgoing={} +other=[] +mboxes={} +tfl=[] +ov=0 +mparser=None + +dosort=sys.argv[1]=="1" +doless=sys.argv[2]=="1" + +locs=[] + +for l in sys.stdin: + res=pl.match(l.rstrip()) + if res: + (type,filename,subj)=res.groups() + #print type, filename, subj + res=pif.search(filename) + if res: + if ovf.search(filename): + ov=ov+1 + else: + incoming[(res.group(2),res.group(3))]=filename + else: + res=pof.search(filename) + if res: + k=(res.group(1),subj) + n=outgoing.get(k,0) + outgoing[k]=n+1 + else: + try: + k=stat(filename).st_mtime + #k=1216786059.1472759 + other+=[(k,filename,subj)] + except: + pass + else: + print >> sys.stderr, "oops:",l +print "%s pers, %s out, %s other, %s .overview"%(len(incoming),len(outgoing),len(other),ov) +ik=incoming.keys() +ok=outgoing.keys() +xk=other +if dosort: + ik.sort(cmp=cmp1,reverse=True) + ok.sort(cmp=cmp2,reverse=True) + xk.sort(cmp=cmp2,reverse=True) +ikl=len(ik) +okl=len(ok) +xkl=len(xk) +i=o=x=0 +iTop=None +oTop=None +xTop=None +# if not sorted will be pretty messed up. . . +while (i<ikl or o<okl or x<xkl): + if (iTop is None): + if (i<ikl): + iTop = ik[i][0] + else: + iTop = "0000-00" + if (oTop is None): + if (o<okl): + oTop = ok[o][0] + else: + oTop = "0000-00" + if (xTop is None): + if (x<xkl): + xTop = datetime.date.fromtimestamp(xk[x][0]).strftime("%Y-%m") + else: + xTop = "0000-00" + if iTop>=oTop: + if iTop>=xTop: + # it's i we want + #print >>sys.stderr,"i",i,iTop,ik[i],incoming[ik[i]] + iloc=incoming[ik[i]] + if doless: + # check for encoded text + ccmd="grep -Pzq 'Content-Transfer-Encoding: base64' \"%s\""%iloc + #print >>sys.stderr,ccmd + #sys.stderr.flush() + if not system(ccmd): + if mparser is None: + mparser=Parser() + tf=NamedTemporaryFile(delete=False) + print >>tf,iloc + dumpHdrsAndText(mparser.parse(open(iloc)),tf) + tfl.append(tf.name) + tf.close() + iloc=tf.name + locs.append(iloc) + i=i+1 + iTop=None + continue + else: + # it's x we want + pass + elif oTop>=xTop: + # it's o we want + #print "o",o,oTop,ok[o],outgoing[ok[o]] + k=ok[o] + res=int(outgoing[k]) + # Need to write a temporary file drawn from k[0] for successive + # subjects == k[1] + if doless: + try: + mb=mboxes[oTop] + except KeyError: + mboxes[oTop]=mb=mbox("/disk/scratch/mail/cpy/general/"+oTop).values() + for m in mb: + if m['subject']==k[1]: + tf=NamedTemporaryFile(delete=False) + locs.append(tf.name) + tfl.append(tf.name) + tf.write(m.as_string()) + tf.close() + else: + locs.append("%s/%s"%(oTop,k[1])) + o=o+1 + oTop=None + continue + else: + # it's x we want + pass + #print >>sys.stderr,"x",x,xTop,xk[x] + #sys.stderr.flush() + xloc=xk[x][1] + if doless: + # check for encoded text + ccmd="grep -Pzq 'Content-Transfer-Encoding: base64' \"%s\""%xloc + #print >>sys.stderr,ccmd + #sys.stderr.flush() + if not system(ccmd): + if mparser is None: + mparser=Parser() + tf=NamedTemporaryFile(delete=False) + print >>tf,xloc + dumpHdrsAndText(mparser.parse(open(xloc)),tf) + tfl.append(tf.name) + tf.close() + xloc=tf.name + locs.append(xloc) + x=x+1 + xTop=None +if doless: + system('less '+' '.join(locs)) +else: + print '\n'.join(locs) +for f in tfl: + unlink(f)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/runTest Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,8 @@ +#!/bin/sh +date +for f in "$@" + do + ( ~/src/python/testURIs.py < $f > r$f ) & + done +wait +date
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/screen_with_agent.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,5 @@ +#!/usr/bin/bash +#echo $(/usr/bin/date) "|$(type id)|" "|$(/usr/bin/id -un 2>&1)|" >> /tmp/swa +eval $(/usr/local/src/keychain.hst/keychain --quick --eval 2> >(/usr/bin/tee -a /tmp/kc_errs.txt >&2)) +#echo $(/usr/bin/date) "|$(/usr/bin/printenv | /usr/bin/grep -F SSH_)|" >> /tmp/swa +DISPLAY=:0 /usr/bin/screen -m -S MULTI -q 2> >(/usr/bin/tee -a /tmp/sc_errs.txt >&2)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/showMPA.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,4 @@ +#!/bin/bash +echo piping +export MHSTORE=/home/ht/.mh_profile_pipe +tee /tmp/msg | /usr/bin/mhstore -file - -type text/html 2>/dev/null | lynx -dump -force-html -stdin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/sshv Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/bin/bash +ssh -v "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/sync-me Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,11 @@ +#!/bin/sh +list=${PWD##*/} +year=2009 +if [ "$1" = "-y" ] +then + year=$2 + shift ; shift +fi +dir=/home/lists/$list/Archive/$year$1 +echo Syncing $dir . . . +rsync -avz localhost:$dir .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/toE Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,33 @@ +#!/bin/bash +# If one arg't, send to home dir of Edinburgh desktop machine +# If more than one, send all but last to last, which must be a directory (or . for $HOME) +# To rename remote file do toE local -r remote [dir] +if [ "x$2" = "x" ]; then + : +else + dir=${!#} + set -- "${@: 1: $#-1}" + if [ "$dir" = "." ]; then + unset dir + fi +fi +echo xcp "$@" "$DESKTOP:$dir" +xcp "$@" "$DESKTOP:$dir" +exit 0 + +# Older version follows +ff= +if [ "x$2" = "x" ] + then + dest="$DESKTOP:" + ff="'$1'" + else + while [ "x$2" != "x" ] + do + ff="$ff '$1'" + shift + done + dest="'$DESKTOP:$1'" +fi +echo scp $ff $dest +sh -c "scp $ff $dest"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/toH Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,13 @@ +#!/bin/bash +# Usage: cat filenames | toH [subdir] +while read f; do +echo -n "$f ..." +ftp humax -n -v<<EOT +user admin 2hum +prompt +cd Download/"$1" +put "$f" +quit +EOT +echo done +done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/toM Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/bash +ff= +if [ "x$2" = "x" ] + then + dest=markup.co.uk: + ff="'$1'" + else + while [ $# != 1 ] + do + ff="$ff '$1'" + shift + done + dest="'markup.co.uk:$1'" +fi +echo scp $ff $dest +sh -c "scp $ff $dest"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/toS Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,16 @@ +#!/bin/bash +ff= +if [ "x$2" = "x" ] + then + dest=snco_snco@ssh.phx.nearlyfreespeech.net: + ff="'$1'" + else + while [ $# != 1 ] + do + ff="$ff '$1'" + shift + done + dest="'snco_snco@ssh.phx.nearlyfreespeech.net:$1'" +fi +echo scp $ff $dest +sh -c "scp $ff $dest"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/txp.bat Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,1 @@ +type d:\work\PyLTXML\example\small.xml | c:\Python26\python d:\work\PyLTXML\example\simple.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/unpack.pl Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,59 @@ +#!/usr/bin/perl -W + +use strict; +use bytes; +use File::Path; + +die "did not specify boot img file\n" unless $ARGV[0]; + +my $bootimgfile = $ARGV[0]; + +my $slurpvar = $/; +undef $/; +open (BOOTIMGFILE, "$bootimgfile") or die "could not open boot img file: $bootimgfile\n"; +my $bootimg = <BOOTIMGFILE>; +close BOOTIMGFILE; +$/ = $slurpvar; + +# chop off the header +$bootimg = substr($bootimg,2048); + +# we'll check how many ramdisks are embedded in this image +my $numfiles = 0; + +# we look for the hex 00 00 00 00 1F 8B because we expect some trailing padding zeroes from the kernel or previous ramdisk, followed by 1F 8B (the gzip magic number) +while ($bootimg =~ m/\x00\x00\x00\x00\x1F\x8B/g) { + $numfiles++; +} + +if ($numfiles == 0) { + die "Could not find any embedded ramdisk images. Are you sure this is a full boot image?\n"; +} elsif ($numfiles > 1) { + die "Found a secondary file after the ramdisk image. According to the spec (mkbootimg.h) this file can exist, but this script is not designed to deal with this scenario.\n"; +} + +$bootimg =~ /(.*\x00\x00\x00\x00)(\x1F\x8B.*)/s; + +my $kernel = $1; +my $ramdisk = $2; + + +open (KERNELFILE, ">$ARGV[0]-kernel.gz"); +print KERNELFILE $kernel or die; +close KERNELFILE; + +open (RAMDISKFILE, ">$ARGV[0]-ramdisk.cpio.gz"); +print RAMDISKFILE $ramdisk or die; +close RAMDISKFILE; + +print "\nkernel written to $ARGV[0]-kernel.gz\nramdisk written to $ARGV[0]-ramdisk.cpio.gz\n"; +if (-e "$ARGV[0]-ramdisk") { + rmtree "$ARGV[0]-ramdisk"; + print "\nremoved old directory $ARGV[0]-ramdisk\n"; +} + +mkdir "$ARGV[0]-ramdisk" or die; +chdir "$ARGV[0]-ramdisk" or die; +system ("gunzip -c ../$ARGV[0]-ramdisk.cpio.gz | cpio -i"); + +print "\nextracted ramdisk contents to directory $ARGV[0]-ramdisk/\n";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/v.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,18 @@ +#!/usr/bin/bash +# Search for a Tab, open or closed, in static record of tabs in ~/u: +# Old_Tabs for the as-yet not-in-a-OneTab-group OneTab +# New_Tabs for the result of running save tab javascript from +# e433d14e8253a1c3e061f52a58550630.js in Firefox Browser Console (Ctrl+Shift+J) +# and then converting to XML with ??? +# Usage: v.sh [-i] string +if [ "$1" = "-i" ] +then + echo "Apologies, -i not implemented yet" 1>&2 + shift +fi +d=/home/ht/u +p="'"$1"'" +for f in ${d}/New_Tabs.xml ${d}/Old_Tabs.xml +do + lxprintf -e "div[p/a[contains(@href,$p) or contains(.,$p)]]" "%s: %s\n" "./p/a[contains(@href,$p) or contains(.,$p)]" './title' $f +done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/watched.sh Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,2 @@ +#!/usr/bin/bash +find /e/Videos -iname '*watched*' | rev | cut -f 1 -d '/' | rev | tr -s ' \t' _ | tr '\n' '\000' | xargs -0 -I ^ -n 1 echo "^" "^" | while read g f; do printf "%s\t%s\n" "$(echo "$g" | grep -Eo 'watched-.{10,10}')" "$f"; done | sort -k1,1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/wchar-hist Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,8 @@ +#!/bin/perl +# frequency table of characters +while (<>) { + grep($cc[$_]++,unpack("C*",$_)); +}; +for ($i=0;$i<256;$i++) { + printf("%d %s %d\n",$i,$i>32?sprintf("%c",$i):sprintf("^%c",$i+64),$cc[$i]); +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/wxsv Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,4 @@ +#!/bin/sh +PYTHONPATH="d:\\work\\xsv" +export PYTHONPATH +/c/Python26/python d:\\work\\xsv\\XSV\\commandLine.pyc $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xcp Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,73 @@ +#!/usr/bin/bash +usage=$'xcp host:[dir] files... [-r newName] # down + or +xcp files... [-r newName] host:[dir] # up +-r will rename the file after transfer, must be only one file! + dir is either absolute or will start from home' +case $1 in + -*|'') echo "$usage" 1>&2; exit 1;; +esac +case "$1" in + *:*) + remote="$1"; shift + download=1 + ;; +esac +if [ "$remote" ] ; then + bb=$(($# - 1)) + if [ "${!bb}" = "-r" ]; then + newname=${!#} + set -- "${@: 1: $#-2}" + if [ $# -ne 1 ]; then + echo "one file only allowed with rename!" "$@" 1>&2 + exit 3 + fi + fi +else + case "${!#}" in + *:*) remote="${!#}" + set -- "${@: 1: $#-1}" + bb=$(($# - 1)) + if [ "${!bb}" = "-r" ]; then + newname=${!#} + set -- "${@: 1: $#-2}" + if [ $# -ne 1 ]; then + echo "one file only allowed with rename!" "$@" 1>&2 + exit 3 + fi + fi + ;; + *) echo "no remote spec.???" 1>&2; echo $usage 1>&2; exit 2;; + esac +fi +IFS=: read host dir < <(echo "$remote") +cd="set cmd:fail-exit true; " +if [ "$dir" ] ; then + cd="${cd}cd \"$dir\"; " +fi +if [ "$download" ] ; then + # get files from host + if [ "$newname" ] ; then + doit="${cd}get $(printf \ \'%s\' "$@") -o '$newname'; quit" + else + doit="${cd}mget $(printf \ \'%s\' "$@"); quit" + fi +else + # put files to host + if [ "$newname" ] ; then + doit="${cd}put $(printf \ \'%s\' "$@") -o '$newname'; quit" + else + doit="${cd}mput $(printf \ \'%s\' "$@"); quit" + fi +fi + +echo lftp -e "$doit" sftp://${host}: 1>&2 +lftp -e "$doit" sftp://${host}: +res="$?" +if [ "$res" = 0 ] +then + echo success +else + echo failed: $res +fi +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xed Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,4 @@ +#!/bin/sh +export PYTHONPATH=d:\\work\\xed +export XML_CATALOG_FILES=file:///h:/C64/usr/local/share/lib/xml/catalog.xml +cmd /c "c:\Python27\python" d:\\work\\xed\\XED\\cmd.py $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xed.bat Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,3 @@ +set PYTHONPATH=d:\\work\\xed +set XML_CATALOG_FILES=file:///h:/C64/usr/local/share/lib/xml/catalog.xml +c:\Python27\python d:\\work\\xed\\XED\\cmd.py $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xls2tsv.pl Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +#~ Converter Script for XLS to TSV. Handles Multiple Tabs into separate files. +#~ (c)2004 Anima Legato <l3gatosan@gmail.com> +#~ +#~ This code is redistributable and modifiable under the same terms as Perl +#~ itself. + +use strict; +use warnings; + +use Spreadsheet::ParseExcel::Simple; + +for (@ARGV) { + for (glob $_) { + next unless m/\.xls$/i; + next unless -r $_; + dump_books($_); + } +} + +sub dump_books { + my $file = shift; + my $eBook = Spreadsheet::ParseExcel::Simple->read($file); + unless (defined $eBook) { + warn "Can't open Spreadsheet in file $file (@".$file."\n"; + return undef; + } + my @sheet = $eBook->sheets; + for (0..0) { + next unless $sheet[$_]->has_data(); + #my $sfn = $file; + #$sfn =~ s?\.xls$??i; + #$sfn.= ((@sheet > 1) ? sprintf(".%02i",$_) : "").'.tsv'; + #open TAB, '>', $sfn or do { + # warn "Unable to write to $sfn"; + # next; + #}; + + while ($sheet[$_]->has_data) { + my @row = $sheet[$_]->next_row; + print join("\t",@row)."\n"; # print TAB ... + } + } +} ##--dump_books--##
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xmlDiff Sat Jun 06 10:19:04 2026 +0100 @@ -0,0 +1,17 @@ +#!/bin/sh +# trivial normalise-and-compare +sw= +while : + do + case "$1" in + -p) + f=-w ; shift ;; + -?*) + sw=$1 ; shift ;; + *) + break ;; + esac +done +normXML $f "$1" > /tmp/xd$$ +normXML $f "$2" | diff $sw /tmp/xd$$ - +rm /tmp/xd$$
