Running Drupal API Scripts offline
It is not necessary to write an entire Drush command just to run some php code.  Use:

drush php-eval '$a = callSomeFunction(); print $a;'

or:

drush php-script /path/to/script.php

Drush will bootstrap your site and run your code.