My pasteblog

This is not my Zettelkasten but a durable .bash_history

Subscribe to RSS feed

Posts tagged with "regexp"

privoxy filter

, , , ...

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

egrep

, , , ...

egrep "image.*s.*(Los|sport)" /var/log/apache2/access_log | awk '{print $1}' | sort -n | uniq -c | sort -rn

No focus!

, ,

default.filter
FILTER: PGOfocus
s/ onload="document\.getElementById\('sstring'\)\.focus\(\);//Ugm


user.action
{+filter{PGOfocus}}
packages.gentoo.org


default.action
{ +prevent-compression }
.gentoo.org

ExTracTing

, , ,

<?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));

?>

Extending control over phpBB

, , , ...

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|&lt;tr&gt;(\n\s*&lt;td.*Google.*&lt;/td&gt;\n.*&lt;table.*)|&lt;tr id=&quot;googlead&quot; style=&quot;display: none;&quot;&gt;$1|Ugm
s|&lt;img src=&quot;http://www.kaffee-netz.com/images/logo.gif&quot; width=&quot;524&quot; 
height=&quot;64&quot; alt=&quot;&quot; border=&quot;0&quot;&gt;||U
s|&lt;!--\sNeuer\sKopf.*Kopf\sEnde --&gt;||usx
s|&lt;style\stype=&quot;text/css.*&lt;/style&gt;||usx
s|&lt;span\sclass=&quot;gensmall&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;br\s/&gt;\n\s*&amp;nbsp;\s&lt;/span&gt;||
s@&lt;img\ssrc=&quot;templates/subSilver/images/icon_mini_(faq|search|members|groups|register|profile|message|login).gif&quot;.*/&gt;@@Ug
s@&lt;img\ssrc=&quot;templates/subSilver/images/(folder.*|whosonline).gif&quot;.*/&gt;@@Ug
s@&lt;a\shref=(.*)&lt;img\ssrc=&quot;templates/subSilver/images/lang_german/(reply|post|icon_quote|icon_pm|icon_profile).gif&quot;.*/&gt;&lt;/a&gt;@&lt;span 
class=&quot;myButtonReplace&quot;&gt;[ &lt;a href=$1$2&lt;/a&gt; ]&lt;/span&gt;@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.css

Now 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.
February 2012
S M T W T F S
January 2012March 2012
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29