Re: Permanently deleting topics and posts
You could easily turn this into a more standardized script by starting the code with require('./bb-load.php'); to load the bbPress code and check user authorization, and then if (!bb_current_user_can(administrate)) {exit;}
The mysql_query( would become $bbdb->query( and you’d have to do a global $bbdb; once at the top too. Just for completeness you might want to look at some of the functions in bb-do-counts.php in bb-admin.
Actually it would be fairly easy to turn it into a full blown plugin for the admin menu.