Recipe: All Linode StackScripts

Lately I’ve been playing around with Linode. One of the neat (but incomplete, hard to use, and not as good as it could be) features are Linode Stack Scripts. I wanted a full set of them to work with in constructing my own. Browsing through them graphically is a hassle, making it hard to grep them, copy from them (since they have line numbers, and the way to remove the line numbers is javascript), etc. This Python script downloads all of them to the cwd.

Season to taste, public domain license!

import re
import urllib
import htmlentitydefs

exp = re.compile(
   '''\[CDATA\[\n\n'''  + \
   '(.*?)' + \
   re.DOTALL | re.VERBOSE)

myrx = re.compile('&(' + '|'.join(htmlentitydefs.entitydefs.keys()) + ');')
def dehtml(s):
    return re.sub(
    lambda m: htmlentitydefs.entitydefs[],

last_seen = 0
ii = 0
while 1:
    ii += 1
    if ii - last_seen > 100:  
        print ("stopping at %i" % ii)
        break # we've probably seen them all
        text = urllib.urlopen("" % ii).read()
        ans =[0][1:]
    ans = dehtml(ans)
    last_seen = ii
    print ("creating" % ii)
    ofh = file("" % ii,'w')

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s