Thursday, November 2, 2006 6:23:49 PM
privoxy, privacy, security, regexp
...
FILTER: wwwGentooOrg
s/<td width="1%" bgcolor="\#dddaec" valign="top"><table.*vr\.org.*<\/table><\/td>//Ugs
FILTER: heiseEnhancements
s/.*//Ugs
s/<sponsor>.*<\/sponsor>//Ugs
s/<bcadv>.*<\/bcadv>//Ugs
s/<skyscraper>.*<\/skyscraper>//Ugs
s/<leaderboard>.*<\/leaderboard>//Ugs
s/<heiseadvert>.*<\/heiseadvert>//Ugs
s/Beitrag[html:a /Beitrag%5Bn%5D<a accesskey="n" /Ug
s/Thread<a /Thread%5Bj%5D<a accesskey="j" /Ug
FILTER: radsportNewsErtraeglichMacher
s/<style] BODY {.*<\/style>//Ugs
s/<body background="grafiken\/backmain842.jpg" style="margin: 0px" bgcolor="\#003399"/<body style="background-color: \#e5e5e5; margin:auto;" /Ugs
s/[html:td bgcolor="\#003399"/<td /Ugs
s/background="grafiken\/rightcolwhite2.gif"//Ugs
s/<form action="http:\/\/www.dom.*<\/form]//Ugs
s/.*/<hr \/>/Ugs
s/.*/<h1>Mein Radsportnews.net<\/h1><table align="center" style="background-color: \#fff; width:500px;border: 1px solid black" ><tr><td>/Ugs
s/<td background="grafiken\/rightcol2grey.gif".*/<td>/Ugs
s/.*//Ugs
s/<body bgcolor="\#003399" text="\#000000" LINK="\#0000FF" VLINK="\#0000FF" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">.*/<body bgcolor="\#ffffff">/Ugs
s/.*.*<\/Body>/<\/body>/Ugs
FILTER: symfonyprojectcom
s/<object classid.*>.*<\/object>//Ugs
#FILTER: kalenderblatt
#s/focus\(\);//Ugs
FILTER: phpdoctrine
s|<table\swidth="100%"\scellspacing=0\scellpadding=0>\n\s+<tr>\n\s+<td\swidth=2000\sbackground="kuvat/docflashbg.jpg">\n\s+<img\ssrc="kuvat/docflash.jpg">\n\s+</td>\n\s+</tr>\n</table>||usx
#s|<table.*docflash.*</table>||usx
#s|background="kuvat/docflashbg.jpg"||
FILTER: steffnybg
s/background="../backgrd.jpg"//
FILTER: PGOfocus
s/ onload="document\.getElementById\('sstring'\)\.focus\(\);//Ugm
FILTER: GoogleAdsPhpbb
s|<tr>(\n\s*<td.*Google.*</td>\n.*<table.*)|<tr id="googlead" style="display: none;">$1|Ugm
s|<img src="http://www.kaffee-netz.com/images/logo.gif" width="524" height="64" alt="" border="0">||U
s|||usx
s|<style\stype="text/css.*</style>||usx
s|<span\sclass="gensmall"><b></b><br\s/>\n\s* \s</span>||
s@<img\ssrc="templates/subSilver/images/icon_mini_(faq|search|members|groups|register|profile|message|login).gif".*/>@@Ug
s@<img\ssrc="templates/subSilver/images/(folder.*|whosonline).gif".*/>@@Ug
s|<br>.*<br>\n<div.*\n\n</div>\n<br>.*<br>||Ugm
s|<br>||Ug
s|<img\ssrc="http://www.blixs.de/pimages/17/18111.jpg"\sborder="0"\s/>||Ug
s|<a\shref="http://www.elektrasrl.com/"\starget="_blank"\sclass="postlink"><img\ssrc="http://www.elektra-deutschland.de/logo-piccolo.gif"\sborder="0"\s/></a>||Ug
s@<a href=(.*)<img\ssrc="templates/subSilver/images/(lang_english|lang_german)/(reply|post|icon_quote|icon_pm|icon_profile|icon_edit|icon_www|icon_email|icon_yim|icon_aim|icon_icq_add|icon_msnm).gif".*/></a>@<span class="myButtonReplace">[ <a href=$1$3</a> ]</span>@Ug
s@<a href=(.*)<img\ssrc="templates/subSilver/images/(xxx|icon_delete).gif".*/></a>@<span class="myButtonReplace">[ <a href=$1$2</a> ]</span>@Ug
Wednesday, September 13, 2006 6:07:25 PM
regexp, regex, bash, cli
...
egrep "image.*s.*(Los|sport)" /var/log/apache2/access_log | awk '{print $1}' | sort -n | uniq -c | sort -rn
Wednesday, June 14, 2006 6:16:45 PM
privoxy, regex, regexp
default.filter
FILTER: PGOfocus
s/ onload="document\.getElementById\('sstring'\)\.focus\(\);//Ugm
user.action
{+filter{PGOfocus}}
packages.gentoo.org
default.action
{ +prevent-compression }
.gentoo.org
Sunday, April 9, 2006 9:51:08 PM
regex, php, regexp, scripts
<?php
$lines = file('http://www.symfony-project.com/trac/timeline?'.
'from=04%2F09%2F06&daysback=365&changeset=on&update=Update');
foreach ($lines as $k => $line){
if(strpos($line, 'h2') === false) unset($lines[$k]);
}//end forezch lines
$data = array();
foreach ($lines as $line){
$tmp=''; $date = ''; $time = ''; $changeset = ''; $_changeset = false; $author = ''; $_author = false;
$dom = new domDocument;
$dom->loadHTML($line);
$h2 = $dom->getElementsByTagName('h2');
$date = substr($h2->item(0)->nodeValue,0,8);
$dts = $dom->getElementsByTagName('dt');
if($dts){
preg_match_all('#\[(.*)\]#', $dts->item(0)->nodeValue,$_changeset);
if($_changeset) $changeset = $_changeset[1];
preg_match_all('#by (.+)$#', $dts->item(0)->nodeValue, $_author);
if($_author) $author = $_author[1];
foreach ($dts as $dt){
$spans = $dt->getElementsByTagName('span');
$time = $spans->item(0)->nodeValue;
//collect the data in an array
$data[] = array('changeset' => $changeset[0], 'author' => $author[0], 'unixtime' => strtotime("$date $time"));
}//end foreach
}//end if
}//end foreach
die(var_dump($data));
?>
Wednesday, February 8, 2006 5:35:09 PM
opera, css, regex, privoxy
...
If I happen to frequent a forum, based on phpBB, I am a guest and visitor, and I behave accordingly. And I am in the realm of some other webmaster.
That does by no means imply that I have to go d'accord with his decision about how that board should look like.In this case, it is a phpBB installation at
http://www.kaffee-netz.com/board . I *really* dislike the gay color scheme and I think the intention (to match a coffee-related color) was not exactly put into code to deserve the word "succesful".
And I use Opera...A simple addition to an otherwise virgin opera6.ini as following gives me two more user-mode stylesheets:
Name 12=SubSilver
File 12=C:\Documents and Settings\cpr\Application Data\Opera\Opera\profile\styles_cpr\subSilver.css
Name 13=Sub Silver Mod cpr 4 kaffeboard
File 13=C:\Documents and Settings\cpr\Application Data\Opera\Opera\profile\styles_cpr\cprSubSilver.css
Active 12=0
As the filenames say, the first addition is the standard SubSilver color scheme that I got by downloading a fresh version of the phpBB sourcecode and the second my modification as posted below.
Together with teh hackish power of
privoxy, a "filtering proxy server" I get just about the amount of control I like to excercise over that phpBB. Some regular expressions nuke the ugly standard buttons and replace them with a text link, the Google "user" ad-spam is send to a virtual
/dev/null and the *embedded* (sic!) css definitions are prevented to be transferred with each request from my browser, too:
s|<tr>(\n\s*<td.*Google.*</td>\n.*<table.*)|<tr id="googlead" style="display: none;">$1|Ugm
s|<img src="http://www.kaffee-netz.com/images/logo.gif" width="524"
height="64" alt="" border="0">||U
s|<!--\sNeuer\sKopf.*Kopf\sEnde -->||usx
s|<style\stype="text/css.*</style>||usx
s|<span\sclass="gensmall"><b></b><br\s/>\n\s*&nbsp;\s</span>||
s@<img\ssrc="templates/subSilver/images/icon_mini_(faq|search|members|groups|register|profile|message|login).gif".*/>@@Ug
s@<img\ssrc="templates/subSilver/images/(folder.*|whosonline).gif".*/>@@Ug
s@<a\shref=(.*)<img\ssrc="templates/subSilver/images/lang_german/(reply|post|icon_quote|icon_pm|icon_profile).gif".*/></a>@<span
class="myButtonReplace">[ <a href=$1$2</a> ]</span>@Ug
Some of my own class attributes are set for HTML elements that did not have any trigger, and I style the page to mu liking with this:
cprSubSilver.cssNow all I need is to press <Shift><g> and I get a much nicer appearance! *g*

To watch a screencast of all mentioned funcionalites download
this .avi file.