photo
Jordan Sissel
geek

Sun, 11 Jul 2004

boredom + apache

Here's a silly oneliner that'll attempt to calculate per-file usage from an apache log.

awk '{print $7}' - | perl -e 'while (<>) { chomp; s!^/([^/]+)!/.html_pages!; 
$u = $1; next if ($u !~ s/^~//); @a = getpwuid(getpwnam($u)); $_ = $a[7] . $_;
$f{$_} += (stat($_))[7] }; map { print $f{$_} . " $_\n" if ($f{$_}) } keys(%f)'

Reads the log data from stdin. Output is unsorted. I'd make it smaller but I'm lazy and tired.

Comments: 0 (view comments)
Tags: ,
Permalink: /oneliners/122
posted at: 08:24

Sat, 03 Jul 2004

HTTP::Handle 0.2

After using HTTP::Handle heavily in my new link spider for work, I found a bunch of bugs and pitfalls that would snag it and make it eat iself. The lacking-features and bugs I found were added and fixed, respectively.

* $http->connect() now returns -1 on failure.
   Connections will fail on 3 occaisions: socket() fails, connect() fails, or the dns lookup on the hostname fails.
* After the socket is connected, $http->connect() can fail if no data is recevied in a given timeout period, which can be set. See perldoc HTTP::Handle.

It should be up on CPAN sometime later this morning, I just uploaded it.

Comments: 0 (view comments)
Tags:
Permalink: /geekery/121
posted at: 05:10

Search this site

Navigation

Metadata

Home About Resume My Code (SVN)

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)

Tag Cloud

Calendar

< July 2004 >
SuMoTuWeThFrSa
     1 2 3
4 5 6 7 8 910
11121314151617
18192021222324
25262728293031

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati