9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] couple of scripts - specific tasks
@ 2009-01-02 10:20 Akshat Kumar
  2009-01-02 13:11 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Akshat Kumar @ 2009-01-02 10:20 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]


Largely useless scripts that'll perhaps save someone a few minutes or
at least a few keystrokes -- they've been done with simplicity, not
conciseness or efficiency, in mind.  No usage info (fn) is provided.

convo/fmt is to be used with "generic" IRC logs like the one produced
by andrey's irc7 (which does not include timestamps), in order to get
some of the last lines of dialog, output in tabbed format for
legibility.
	convo/fmt me nick /tmp/log 10
gets 10 latest lines of convo between 'me' and 'nick'
	convo/fmt '#channel' '' /tmp/log 10
gets 10 latest lines of convo in #channel

chkill is a kill(1) equivalent for processes being run by, i.e., none
-- to be used by hostowner
it made restarting httpd happen in less keystrokes, and the excessive,
imitative, output is enthralling.


reminder for somethings,
and a cry for help regarding others,
ak

[-- Attachment #2: fmt --]
[-- Type: text/plain, Size: 518 bytes --]

#!/bin/rc

j=''
chan=''

fn format{
	if(~ $1 '#'*){
		if(! ~ $1 $chan)
			echo $1
		chan=$1
		shift
		output $j $* |
			awk '{print "  " $0}' |
			fmt
	}
	if not
		output $j $* | fmt
	j=$1
}

fn output{
	if(~ $1 $2){
		shift 2
		echo '  ' $*
	}
	if not{
		shift
		echo
		echo $*
	}
}

grep -e $2^'.*PRIVMSG '^$1^'.*|^PRIVMSG '^$2^' :' $3 |
tail $4 |
sed '
	s/^PRIVMSG ((#.*)?).* :/\1 ⇒ /g
	s/:(.*)!.* PRIVMSG ((#.*)?).* :/\2 \1→ /g
	s/
//g' |
while(line=`{read}) format $line

[-- Attachment #3: chkill --]
[-- Type: text/plain, Size: 167 bytes --]

#!/bin/rc

for(i){
	ps | grep $i |
		while(line=`{read}){
echo 'chmod 777 /proc/'^$line(2)^'/note &&		#'^$line(7)^'
	echo kill > /proc/'^$line(2)^'/note'
		}
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-02 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-02 10:20 [9fans] couple of scripts - specific tasks Akshat Kumar
2009-01-02 13:11 ` Russ Cox
2009-01-02 18:17   ` Akshat Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).