Usage would typically work like this:

    Save this to a file, say 'reset.sql'
    Run the file and save its output in a way that doesn't include the usual headers, then run that output. 

There are a few limitations to this snippet of code you need to be aware of:
    1. It might not work well with multiple schemas
    2. It only works on sequences that are owned by a table.