Category: Web

Favicon to PNG project moved

Posted by – 2012/02/10

I just made a small bugfix to my .favicon to PNG script, but thought it would be a better idea to put this somewhere better than a static web page.

So I’ve moved it over to GitHub where anyone can play with it, hopefully it will be more useful there.

Enjoy!

Automatic favicon to PNG script

Posted by – 2010/05/16

Ever want to add a link to a site with the favourites icon in the page along with the link? I did, so I made this cool little toy:

http://favicon.bitplane.net/

read more…

PHP file list using mod_rewrite

Posted by – 2009/09/14

I’ve noticed that most of the traffic to this site is actually people visiting my permanent and temporary file dumps, which until today were literally a bunch of files dumped in a folder. DreamHost don’t keep my logs for over 30 days and I’d like to incorporate my file dumps into my Piwik stats, so I made a nice fancy file list in PHP. It has nice looking icons courtesy of famfamfam, though may move to stdicon in the future.

Some caveats:

  • The file list currently tracks directory views (via the template) but not yet file downloads, as that requires a Piwik plugin that isn’t final so I haven’t installed it, adding it should be trivial though.
  • As requests are passed through PHP using mod_rewrite it will result in long running scripts on your server, which may upset your shared web hosting provider.
  • Scripts are not yet excluded by rewrite rules! You won’t want to keep other scripts containing sensitive information in dirs under the path.
  • Access to files and folders beginning with “.” will be blocked.
  • It only works on Unices, not Windows servers as they don’t have the “file” command to get the MIME type.
  • You’ll obviously need an Apache installation with mod_rewrite.

To install it, just copy index.php, .htaccess and .filelist/ to the directory where you store your files. You can get the script (without icons) from SVN.

This [e107] page has moved permanently [to gallery2]

Posted by – 2009/09/06

If you do a Google search for some of my really old code, like my Python T9 Dictionary or XBMC IRC MP3 downloader, you’ll notice that my pagerank has been carried over to SVN and the gallery. This is because Google and other search engines take note of HTTP 301 response codes and update their links accordingly.

When I migrated from e107 to WordPress and Gallery2, I replaced download.php with a redirect script which redirects to the gallery, svn or file dumps. The script looks like this:

<?php
// lots excluded
$table['4']='http://svn.bitplane.net/misc/trunk/py/py9/readme.txt';
$address = 'http://bitplane.net/';
 
foreach ($_GET as $i => $value)
{
  $index = explode('_', $i);
  if ( isset($index[1]) && isset( $table[ $index[1] ]) )
  {
    $address = $table[ $index[1] ];
  }
}
 
// send 301 (permanent redirect)
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $address );
?>
<html><head></head><body>
This file has permanently moved <a href="<? echo $address; ?>">here</a>
</body></html>

So when you try to view PY9, you’re redirected to the new location. There’s no excuse for 404 errors when you move your site around, if you care about keeping the web up-to-date then please use a redirect script!