<commit_before>if not http
    print "get requires the http API"
    print "Set enableAPI_http to 1 in mod_ComputerCraft.cfg"

requested = arg[1]

os.loadAPI 'gist_map'

downloaded = {}

for file, url in pairs(gist_map.url_table!)
    if requested == 'all' or file == requested
        print "Retrieving #{file} from #{url}/raw"
        lua_code = http.get "#{url}/raw"
        unless lua_code
            print "!! Unable to retrieve contents of #{file} !!"
            return
        fh = fs.open file, "w"
        fh.write lua_code.readAll()
        fh.close!
        lua_code.close!
        table.insert downloaded, file
        print "Remote file \"#{file}\" downloaded successfully!"

print "Successfully downloaded #{#downloaded} files."
<commit_msg>get script can download json<commit_after>file_exists = (file) ->
    fh = io.open file, 'r'
    existence = false
    existence = true if fh
    fh\close!
    existence

download_json = ->
    unless file_exists("json")
        json_url = "http://pastebin.com/raw/4nRg9CHU"
        json_code = http.get json_url
        unless json_code
            print "!! Unable to retrieve contents of #{json_url}"
            os.exit 1
        fh = fs.open "json", 'w'
        fh\write json_code.readAll!
        fh\close!
        json_code.close!

if not http
    print "get requires the http API"
    print "Set enableAPI_http to 1 in mod_ComputerCraft.cfg"

requested = arg[1]

os.loadAPI 'gist_map'

downloaded = {}

for file, url in pairs(gist_map.url_table!)
    if requested == 'all' or file == requested
        print "Retrieving #{file} from #{url}/raw"
        lua_code = http.get "#{url}/raw"
        unless lua_code
            print "!! Unable to retrieve contents of #{file} !!"
            os.exit 1
        fh = fs.open file, "w"
        fh\write lua_code.readAll!
        fh\close!
        lua_code.close!
        table.insert downloaded, file
        print "Remote file \"#{file}\" downloaded successfully!"

print "Successfully downloaded #{#downloaded} files."

{'fraction_non_alphanumeric': 0.11143984220907298, 'fraction_numerical': 0.0039447731755424065, 'mean_word_length': 2.387312186978297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5853574', 'n_tokens_mistral': 661, 'n_tokens_neox': 627, 'n_words': 190}