<commit_before>import json,datetime,urllib2,random
from PyRSS2Gen import RSS2, RSSItem

timezones = json.load(file('tz.json'))

def getUTC():
    return int((datetime.datetime.utcnow()-datetime.datetime(1970, 1, 1)).total_seconds())%(24*3600)

def get420offset():
    offset = 16*3600+20*60-getUTC()
    if offset<0:
        offset += 24*3600
    return offset

def next420():
    offs = get420offset()
    for tz in timezones:
        if tz[0]<=offs:
            return {'minutes':int((offs-tz[0])/60),'places':tz[1]}
    return {'minutes':666,'places':["Snafu (Yes. It's a bug)"]}



def main():
    fourtwenty = next420()
    place = random.choice(fourtwenty['places'])
    if len(fourtwenty['places'])>1:
        title = "Get ready for #fourtwenty at {0} and other fine places.".format(place)
    else:
        title = "Get ready for #fourtwenty at {0}.".format(place)
        
    file('420.rss','w').write(RSS2(
       title='Global 4:20 clock',
       link='http://is.gd/fourtwenty',
       description='Keep up with where #FourTwenty happens next',
       language='en',
       items=[RSSItem(
           title=title,
           link='http://is.gd/fourtwenty#{0}'.format(urllib2.quote(place)))]).to_xml('utf-8'))

if __name__=='__main__':
    main()<commit_msg>Switch RSS links to SSL (resetthenet.org)<commit_after>import json,datetime,urllib2,random
from PyRSS2Gen import RSS2, RSSItem

timezones = json.load(file('tz.json'))

def getUTC():
    return int((datetime.datetime.utcnow()-datetime.datetime(1970, 1, 1)).total_seconds())%(24*3600)

def get420offset():
    offset = 16*3600+20*60-getUTC()
    if offset<0:
        offset += 24*3600
    return offset

def next420():
    offs = get420offset()
    for tz in timezones:
        if tz[0]<=offs:
            return {'minutes':int((offs-tz[0])/60),'places':tz[1]}
    return {'minutes':666,'places':["Snafu (Yes. It's a bug)"]}



def main():
    fourtwenty = next420()
    place = random.choice(fourtwenty['places'])
    if len(fourtwenty['places'])>1:
        title = "Get ready for #fourtwenty at {0} and other fine places.".format(place)
    else:
        title = "Get ready for #fourtwenty at {0}.".format(place)
        
    file('420.rss','w').write(RSS2(
       title='Global 4:20 clock',
       link='https://zzzen.com/420',
       description='Keep up with where #FourTwenty happens next',
       language='en',
       items=[RSSItem(
           title=title,
           link='http://https://zzzen.com/420#{0}'.format(urllib2.quote(place)))]).to_xml('utf-8'))

if __name__=='__main__':
    main()
{'fraction_non_alphanumeric': 0.17282989490073958, 'fraction_numerical': 0.05293888672635266, 'mean_word_length': 3.2762063227953413, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4681789', 'n_tokens_mistral': 988, 'n_tokens_neox': 888, 'n_words': 182}