jamesoff.net




10
Sep
2008
0

Risk Disk and Squid

We use RiskDisk at work to see if a company we’re going to do business with is trustworthy, but recently it was complaining HTTP Error 417: Expectation Failed when it tried to do any online lookups.

I tracked this down to it sending Expect: 100-continue in the headers of the request it sent to its server. However, it was going via our web proxy at work, which is Squid. Recently I upgraded Squid to 2.7, and this seems to be the cause of the problems. Squid 2.7 is less forgiving about that particular header (which is apparently an RFC violation on the part of the client).

It’s easily fixed by adding ignore_expect_100 on to your Squid configuration.


Permalink | Posted in FreeBSD Sysadmin Work and tagged  



9
Jul
2008
0

grepping the output of ccze

If you ever want to grep the output of ccze and found it didn’t work right, here’s the magic incantation to do it:

tail somefile | ccze -A -o noscroll | grep ...

-A makes ccze output ASCII sequences, and -o noscroll turns off the scroll option - whatever that is exactly. The man page says it’s a good idea to turn it off if you’re redirecting the output. Omitting it seems to make the output appear in lumps :)

For example, keep an eye on squid logs omitting all MSN crap:

tail -F access.log | ccze -A -C -o noscroll | grep -v gateway.dll

Permalink | Posted in FreeBSD Sysadmin and tagged  



11
Apr
2008
0

Delphi documentation

While writing some Delphi code at work, I spotted this in the documentation. Not sure if I want to call that function or not now…


Permalink | Posted in Coding Work and tagged  



10
Apr
2008
0

Irssi typing speed script

I have written an irssi script which measures how fast you type on IRC and reports both words per minute and characters per minute.

More details and download: WPM script.


Permalink | Posted in Coding my stuff and tagged  



1
Apr
2008
0

BBC News Stylish script

The new BBC News layout seems to be causing some people to stress out a bit - but then all new redesigns do until they get used to them. I quite like it, but for a friend I knocked this up quickly to get rid of the two banners across the top of the page.

You’ll need Stylish and then stick this in a userscript for it. You may need to adjust the domain (2nd line) if you don’t use news.bbc.co.uk to access the site.

(more…)


Permalink | Posted in Coding internets and tagged  



6
Mar
2008
0

vim as a man-page reader

Sure, why not :)

This goes in your zshrc:

  vman() {
    if [ $# -eq 0 ]; then
      /usr/bin/man
    else
      if man -w $* >/dev/null 2>/dev/null
      then
        /usr/bin/man $* | col -b | vim -c 'set ft=man nomod' -
      else
        echo No man page for $*
      fi
    fi
  }
  alias man='vman'

And this goes in your vimrc (in a suitable augroup):

  autocmd FileType man setlocal ro nonumber nolist fdm=indent fdn=2 sw=4 foldlevel=2 | nmap q :quit<CR>

Now you’ll get nicely highlighted man pages with folded sections, and you can hit q to quit just like less.

Vim as a manpage viewer


Permalink | Posted in FreeBSD Linux Sysadmin and tagged  



21
Feb
2008
4

irssi and ZNC

ZNC is an IRC bouncer with some pretty nice features. For a number of reasons I wanted to move my ircing from home to a shell, so I decided to give ZNC a try. ZNC isn’t in ports, but compiles fine using gmake.

The only problem I encountered was getting it set up to work with multiple networks in irssi. Configuring ZNC itself to put me on many networks was easy enough, and when I connected irssi to it for each network using /connect it worked fine. Using /server add to set up irssi’s server list didn’t work out so well.

Every time I tried to add another server (for connecting to another network), irssi would remove the first one. This is because irssi only considers a server’s hostname and port when trying to work out if it’s unique. When I added another server which differed from the first only by password and associated network, irssi assumed I was updating the existing one and changed it. Putting the required entries in irssi’s config by hand also didn’t work.

The solution was easy enough; one ZNC instance can listen on multiple ports, so I got it to listen on a selection of ports using multiple Listen directives in its config file, and then added each network’s server to irssi using a different port number.

Now I can take advantage of cool things like buffer replay and detaching from channels. Sorry, irssi-proxy - you don’t quite cut it now :)


Permalink | Posted in FreeBSD internets and tagged  



19
Feb
2008
0

bMotion wins again

Sometimes, NoTopic gets it just right :)

[@         Time] nt, do you have a job?
[@      NoTopic] but of "course"
[@         Time] nt, what is your job?
[@      NoTopic] I can't tell you that!
*      JamesOff . o O ( mi5 )
[@         Time] i was thinking six :(
[@         Time] nt, do you work for a secret government organisation?
[@      NoTopic] i do
[@      NoTopic] despite having no mouth
[@         Time] :--o
[@         Time] nt, mi5 or mi6?
[@     JamesOff] it's so secret they took away his mouth
*       NoTopic thinks
[@      NoTopic] Time: mi6.
[@         Time] rut roh
[@         Time] nt, are any of us under suspicion?
[@      NoTopic] i am not at liberty to discuss that
[@         Time] :-x
[@         Time] he's too clever for me

Permalink | Posted in Fun and tagged  



17
Feb
2008
0

GuardChan now bans

After a user request on IRC, my guardchan script can now actually ban as well as kicking when it detects an unauthorised user joining the channel.

(The page for the script incorrectly said that it kickbanned already, but that was an error due to me writing the script about a thousand years ago.)

Hope it’s of some use :)


Permalink | Posted in Coding and tagged  



8
Feb
2008
0

Wrong number again

O2 apparently recycled my phone number too quickly after its previous owner relinquished it, so ever since I’ve had it (a bit under a year now) I’ve been receiving phone calls and SMSes for “Debbie.” Generally I just explain that it’s not her phone any more and would they please go away. I felt sorry for the guy who had put a lot of effort into preparing a happy birthday MMS for her complete with attached birthday cake clip-art.

Last night as a birthday present for me, I got this message from a random number: (reproduced here exactly as it was received)

Sos 4 delay, yes we’d luv 2 come 4 sun lunch. Wot time? Hopn ur al wel,hav bin recoverin from an arse op!Very painful!Wil fil u in wen i c u.X

So I exercised enormous restraint and ignoring the bait replied “Think you’ve got the wrong number :)” to which I recevied:

Is that not u debbie?Txt was from nicola x

Nope, sorry. Hope the arse gets better though.


Permalink | Posted in Fun random and tagged