(core) added support for postinit hooks

This commit adds a new command-line option (-H)
that can be used to inject a hook-script directly
after the application has been initialized.

The purpose of this feature is to enable reasonably
generic function hooks for testing/benchmarking purposes.

The patch also includes modifications to the nonblock
function to add primitive write support, and two example
hookscripts that can be used for recording keyboard, buttons
and mouse inputs for later playback.