├── .gitignore ├── LICENSE ├── TODO.md ├── readme.md ├── requirements.txt └── scripts ├── 01_remove_all_pyc.md ├── 02_find_all_links.py ├── 03_simple_twitter_manager.py ├── 04_rename_with_slice.py ├── 05_load_json_without_dupes.py ├── 06_execution_time.py ├── 07_benchmark_permissions_loading_django.py ├── 08_basic_email_web_crawler.py ├── 09_basic_link_web_crawler.py ├── 10_find_files_recursively.py ├── 11_optimize_images_with_wand.py ├── 12_csv_split.py ├── 12_sample_csv.csv ├── 13_random_name_generator.py ├── 14_html_to_markdown.sh ├── 15_check_my_environment.py ├── 16_jinja_quick_load.py ├── 17_rewrite_git_history.md ├── 18_zipper.py ├── 19_tsv-to-csv.py ├── 20_restore_file_from_git.py ├── 21_twitter_bot.py ├── 22_git_tag.py ├── 23_flask_session_test.py ├── 24_sql2csv.py ├── 25_ip2geolocation.py ├── 25_sample_csv.csv ├── 26_stock_scraper.py ├── 27_send_sms.py ├── 28_income_tax_calculator.py ├── 29_json_test.json ├── 29_json_to_yaml.py ├── 30_fullcontact.py ├── 31_youtube_sentiment.py ├── 32_stock_scraper.py ├── 33_country_code.py ├── 33_country_codes.json ├── 33_sample_csv.csv ├── 34_git_all_repos.py └── data.csv /.gitignore: -------------------------------------------------------------------------------- 1 | .pyc 2 | .DS_Store 3 | _tmp 4 | env 5 | venv 6 | __pycache__ 7 | .env 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Real Python 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | 1. Write unit and integration tests for *all* scripts 2 | 1. Add Travis 3 | 1. Add support for Python 2.7, 3.5, and 3.6 4 | 1. Organize docs and folder structure better 5 | 1. Add all scripts to single CLI for easy running, testing, and searching 6 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Just another repo of Python scripts 2 | 3 | 1. **01_remove_all_pyc.md**: remove all *.pyc* files from a git repo 4 | 1. **02_find_all_links.py**: get all links from a webpage 5 | 1. **03_simple_twitter_manager.py**: accessing the Twitter API, example functions 6 | 1. **04_rename_with_slice.py**: rename group of files, within a single directory, using slice 7 | 1. **05_load_json_without_dupes.py**: load JSON, convert to dict, raise error if there is a duplicate key 8 | 1. **06_execution_time.py**: class used for timing execution of code 9 | 1. **07_benchmark_permissions_loading_django.py**: benchmark loading of permissions in Django 10 | 1. **08_basic_email_web_crawler.py**: web crawler for grabbing emails from a website 11 | 1. **09_basic_link_web_crawler.py**: web crawler for grabbing links from a website 12 | 1. **10_find_files_recursively.py**: recursively grab files from a directory 13 | 1. **11_optimize_images_with_wand.py**: recursively grab images from a directory, then optimize them for the web 14 | 1. **12_csv_split.py**: Splits a CSV file into multiple files based on command line arguments. 15 | 1. **13_random_name_generator.py**: random name generator 16 | 1. **14_html_to_markdown.sh**: Convert all html files in a single directory to markdown 17 | 1. **15_check_my_environment.py**: Pass in a config file based on your environment. 18 | 1. **16_jinja_quick_load.py**: Render a quick Jinja2 template 19 | 1. **17_rewrite_git_history.md**: Backdating/Rewriting Git history (use at your own risk) 20 | 1. **18_zipper.py**: Zip contents of a directory, adding a timestamp to the filename 21 | 1. **19_tsv-to-csv.py**: Convert TSV to CSV 22 | 1. **20_restore_file_from_git.py**: Restore file from Git History 23 | 1. **21_twitter_bot.py**: Twitter Bot 24 | 1. **22_git_tag.py**: Create Git Tag based on a commit 25 | 1. **23_flask_session_test.py**: Just a simple app to see if the sessions are working 26 | 1. **24_sql2csv.py**: SQL to CSV. 27 | 1. **25_ip2geolocation.py**: Given a CSV file with an ip address (see sample - *25_sample_csv.csv*), return the geolocation based on the ip. 28 | 1. **26_stock_scraper.py**: Scrape the S&P 500 Companies list from Wikipedia, then output the data. 29 | 1. **27_send_sms.py**: Send SMS message via [TextBelt](http://textbelt.com/) 30 | 1. **28_income_tax_calculator.py**: Income tax calculator via [Taxee](http://taxee.io/) 31 | 1. **29_json_to_yaml.py**: Convert JSON to YAML 32 | 1. **30_fullcontact.py**: Call the [FullcContact](https://www.fullcontact.com/developer/) API 33 | 1. **31_youtube_sentiment.py**: Calculate sentiment score from the comments of a Youtube video 34 | 1. **32_stock_scraper.py**: Get stock prices 35 | 1. **33_country_code.py**: Convert country code to country name 36 | 1. **34_git_all_repos.py**: Clone all repositories from a public user or organization on Github. Usage: `python git_all_repos.py users USER_NAME` or `python git_all_repos.py orgs ORG_NAME` 37 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.4.1 2 | PyYAML==3.11 3 | requests==2.12.4 4 | wheel==0.24.0 5 | lxml==3.8.0 6 | -------------------------------------------------------------------------------- /scripts/01_remove_all_pyc.md: -------------------------------------------------------------------------------- 1 | I always forget this ... 2 | 3 | To recursively remove all those pesky *.pyc* files from a git repo, run this command: 4 | 5 | ```bash 6 | $ find . -name "*.pyc" -exec git rm -f {} \; 7 | ``` 8 | 9 | Then make sure to add a *.gitignore* in the root of the repo and add the line: `*.pyc` -------------------------------------------------------------------------------- /scripts/02_find_all_links.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | 4 | # get url 5 | url = input('Enter a URL (include `http://`): ') 6 | 7 | # connect to the url 8 | website = requests.get(url) 9 | 10 | # read html 11 | html = website.text 12 | 13 | # use re.findall to grab all the links 14 | links = re.findall('"((http|ftp)s?://.*?)"', html) 15 | 16 | # output links 17 | for link in links: 18 | print(link[0]) 19 | -------------------------------------------------------------------------------- /scripts/03_simple_twitter_manager.py: -------------------------------------------------------------------------------- 1 | import twitter 2 | 3 | 4 | TWITTER_CONSUMER_KEY = 'XXX' 5 | TWITTER_CONSUMER_SECRET = 'XXX' 6 | TWITTER_ACCESS_TOKEN_KEY = 'XXX' 7 | TWITTER_ACCESS_TOKEN_SECRET = 'XXX' 8 | 9 | twitter_api = twitter.Api( 10 | consumer_key=TWITTER_CONSUMER_KEY, 11 | consumer_secret=TWITTER_CONSUMER_SECRET, 12 | access_token_key=TWITTER_ACCESS_TOKEN_KEY, 13 | access_token_secret=TWITTER_ACCESS_TOKEN_SECRET 14 | ) 15 | 16 | if __name__ == '__main__': 17 | follower_ids = twitter_api.GetFollowerIDs() 18 | following_ids = twitter_api.GetFriendIDs() 19 | zombie_follows = [following_id for following_id in 20 | following_ids if following_id not in follower_ids] 21 | 22 | confirm = raw_input( 23 | "Are you sure you want to unfollow {0} tweeps [y|n]? ".format( 24 | (len(zombie_follows)))) 25 | if confirm.lower() == 'y': 26 | for id in zombie_follows: 27 | user = twitter_api.DestroyFriendship(user_id=id) 28 | print("Unfollowed {0}".format(user.screen_name)) 29 | -------------------------------------------------------------------------------- /scripts/04_rename_with_slice.py: -------------------------------------------------------------------------------- 1 | import os 2 | import glob 3 | 4 | os.chdir("/Users/mikeherman/repos/bugs/se-platform/se/core/permissions") 5 | for file in glob.glob("*.json"): 6 | file_name = os.path.splitext(file)[0] 7 | extension = os.path.splitext(file)[1] 8 | new_file_name = file_name[:-6] + extension 9 | try: 10 | os.rename(file, new_file_name) 11 | except OSError as e: 12 | print(e) 13 | else: 14 | print("Renamed {} to {}".format(file, new_file_name)) 15 | -------------------------------------------------------------------------------- /scripts/05_load_json_without_dupes.py: -------------------------------------------------------------------------------- 1 | def dict_raise_on_duplicates(ordered_pairs): 2 | """reject duplicate keys""" 3 | my_dict = dict() 4 | for key, values in ordered_pairs: 5 | if key in my_dict: 6 | raise ValueError("Duplicate key: {}".format(key,)) 7 | else: 8 | my_dict[key] = values 9 | return my_dict 10 | -------------------------------------------------------------------------------- /scripts/06_execution_time.py: -------------------------------------------------------------------------------- 1 | """ 2 | ExecutionTime 3 | 4 | This class is used for timing execution of code. 5 | 6 | For example: 7 | 8 | timer = ExecutionTime() 9 | print 'Hello world!' 10 | print 'Finished in {} seconds.'.format(timer.duration()) 11 | 12 | """ 13 | 14 | 15 | import time 16 | import random 17 | 18 | 19 | class ExecutionTime: 20 | def __init__(self): 21 | self.start_time = time.time() 22 | 23 | def duration(self): 24 | return time.time() - self.start_time 25 | 26 | 27 | # ---- run code ---- # 28 | 29 | 30 | timer = ExecutionTime() 31 | sample_list = list() 32 | my_list = [random.randint(1, 888898) for num in 33 | range(1, 1000000) if num % 2 == 0] 34 | print('Finished in {} seconds.'.format(timer.duration())) 35 | -------------------------------------------------------------------------------- /scripts/07_benchmark_permissions_loading_django.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import numpy 4 | 5 | # temp file for benchmarking 6 | 7 | 8 | def timeit(method): 9 | 10 | def timed(*args, **kw): 11 | ts = time.time() 12 | 13 | result = method(*args, **kw) 14 | te = time.time() 15 | all_times.append(te - ts) 16 | 17 | print(all_times) 18 | print(numpy.mean(all_times)) 19 | return result 20 | 21 | return timed 22 | 23 | 24 | def create_new_db(): 25 | os.system("mysqladmin -u root drop DATABASE_NAME -f") 26 | os.system("mysqladmin -u root create DATABASE_NAME -f") 27 | os.system("./manage.py syncdb") 28 | os.system("./manage.py migrate") 29 | 30 | 31 | @timeit 32 | def load_new_perms(): 33 | os.system("./manage.py LOAD_PERMS_COMMAND") 34 | 35 | 36 | if __name__ == "__main__": 37 | n = 0 38 | all_times = list() 39 | while n < 10: 40 | create_new_db() 41 | load_new_perms() 42 | n += 1 43 | -------------------------------------------------------------------------------- /scripts/08_basic_email_web_crawler.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | 4 | # get url 5 | url = input('Enter a URL (include `http://`): ') 6 | 7 | # connect to the url 8 | website = requests.get(url) 9 | 10 | # read html 11 | html = website.text 12 | 13 | # use re.findall to grab all the links 14 | links = re.findall('"((http|ftp)s?://.*?)"', html) 15 | emails = re.findall('([\w\.,]+@[\w\.,]+\.\w+)', html) 16 | 17 | 18 | # print the number of links in the list 19 | print("\nFound {} links".format(len(links))) 20 | for email in emails: 21 | print(email) 22 | -------------------------------------------------------------------------------- /scripts/09_basic_link_web_crawler.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | try: 4 | from urllib.parse import urljoin 5 | except ImportError: 6 | from urlparse import urljoin 7 | 8 | # regex 9 | link_re = re.compile(r'href="(.*?)"') 10 | 11 | 12 | def crawl(url): 13 | 14 | req = requests.get(url) 15 | 16 | # Check if successful 17 | if(req.status_code != 200): 18 | return [] 19 | 20 | # Find links 21 | links = link_re.findall(req.text) 22 | 23 | print("\nFound {} links".format(len(links))) 24 | 25 | # Search links for emails 26 | for link in links: 27 | 28 | # Get an absolute URL for a link 29 | link = urljoin(url, link) 30 | 31 | print(link) 32 | 33 | if __name__ == '__main__': 34 | crawl('http://www.realpython.com') 35 | -------------------------------------------------------------------------------- /scripts/10_find_files_recursively.py: -------------------------------------------------------------------------------- 1 | import fnmatch 2 | import os 3 | 4 | # constants 5 | PATH = './' 6 | PATTERN = '*.md' 7 | 8 | 9 | def get_file_names(filepath, pattern): 10 | matches = [] 11 | if os.path.exists(filepath): 12 | for root, dirnames, filenames in os.walk(filepath): 13 | for filename in fnmatch.filter(filenames, pattern): 14 | # matches.append(os.path.join(root, filename)) # full path 15 | matches.append(os.path.join(filename)) # just file name 16 | if matches: 17 | print("Found {} files:".format(len(matches))) 18 | output_files(matches) 19 | else: 20 | print("No files found.") 21 | else: 22 | print("Sorry that path does not exist. Try again.") 23 | 24 | 25 | def output_files(list_of_files): 26 | for filename in list_of_files: 27 | print(filename) 28 | 29 | 30 | if __name__ == '__main__': 31 | get_file_names(PATH, PATTERN) 32 | -------------------------------------------------------------------------------- /scripts/11_optimize_images_with_wand.py: -------------------------------------------------------------------------------- 1 | import fnmatch 2 | import os 3 | 4 | # pip install Wand 5 | from wand.image import Image 6 | # pip install http://pypi.python.org/packages/source/h/hurry.filesize/hurry.filesize-0.9.tar.gz 7 | from hurry.filesize import size 8 | 9 | 10 | # constants 11 | PATH = '/../../../..' 12 | PATTERN = '*.jpg' 13 | 14 | 15 | def get_image_file_names(filepath, pattern): 16 | matches = [] 17 | if os.path.exists(filepath): 18 | for root, dirnames, filenames in os.walk(filepath): 19 | for filename in fnmatch.filter(filenames, pattern): 20 | matches.append(os.path.join(root, filename)) # full path 21 | if matches: 22 | print("Found {} files, with a total file size of {}.".format( 23 | len(matches), get_total_size(matches))) 24 | return matches 25 | else: 26 | print("No files found.") 27 | else: 28 | print("Sorry that path does not exist. Try again.") 29 | 30 | 31 | def get_total_size(list_of_image_names): 32 | total_size = 0 33 | for image_name in list_of_image_names: 34 | total_size += os.path.getsize(image_name) 35 | return size(total_size) 36 | 37 | 38 | def resize_images(list_of_image_names): 39 | print("Optimizing ... ") 40 | for index, image_name in enumerate(list_of_image_names): 41 | with open(image_name) as f: 42 | image_binary = f.read() 43 | with Image(blob=image_binary) as img: 44 | if img.height >= 600: 45 | img.transform(resize='x600') 46 | img.save(filename=image_name) 47 | print("Optimization complete.") 48 | 49 | 50 | if __name__ == '__main__': 51 | all_images = get_image_file_names(PATH, PATTERN) 52 | resize_images(all_images) 53 | get_image_file_names(PATH, PATTERN) 54 | -------------------------------------------------------------------------------- /scripts/12_csv_split.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import csv 4 | import argparse 5 | 6 | """ 7 | 8 | Splits a CSV file into multiple files based on command line arguments. 9 | 10 | Arguments: 11 | 12 | `-h`: help file of usage of the script 13 | `-i`: input file name 14 | `-o`: output file name 15 | `-r`: row limit to split 16 | 17 | Default settings: 18 | 19 | `output_path` is the current directory 20 | headers are displayed on each split file 21 | the default delimeter is a comma 22 | 23 | Example usage: 24 | 25 | ``` 26 | # split csv by every 100 rows 27 | >> python csv_split.py -i input.csv -o output -r 100 28 | ``` 29 | 30 | """ 31 | 32 | 33 | def get_arguments(): 34 | """Grab user supplied arguments using the argparse library.""" 35 | 36 | # Use arparse to get command line arguments 37 | parser = argparse.ArgumentParser() 38 | parser.add_argument("-i", "--input_file", required=True, 39 | help="csv input file (with extension)", type=str) 40 | parser.add_argument("-o", "--output_file", required=True, 41 | help="csv output file (without extension)", type=str) 42 | parser.add_argument("-r", "--row_limit", required=True, 43 | help="row limit to split csv at", type=int) 44 | args = parser.parse_args() 45 | 46 | # Check if the input_file exits 47 | is_valid_file(parser, args.input_file) 48 | 49 | # Check if the input_file is valid 50 | is_valid_csv(parser, args.input_file, args.row_limit) 51 | 52 | return args.input_file, args.output_file, args.row_limit 53 | 54 | 55 | def is_valid_file(parser, file_name): 56 | """Ensure that the input_file exists.""" 57 | if not os.path.exists(file_name): 58 | parser.error("The file '{}' does not exist!".format(file_name)) 59 | sys.exit(1) 60 | 61 | 62 | def is_valid_csv(parser, file_name, row_limit): 63 | """ 64 | Ensure that the # of rows in the input_file 65 | is greater than the row_limit. 66 | """ 67 | row_count = 0 68 | for row in csv.reader(open(file_name)): 69 | row_count += 1 70 | # Note: You could also use a generator expression 71 | # and the sum() function to count the rows: 72 | # row_count = sum(1 for row in csv.reader(open(file_name))) 73 | if row_limit > row_count: 74 | parser.error( 75 | "The 'row_count' of '{}' is > the number of rows in '{}'!" 76 | .format(row_limit, file_name) 77 | ) 78 | sys.exit(1) 79 | 80 | 81 | def parse_file(arguments): 82 | """ 83 | Splits the CSV into multiple files or chunks based on the row_limit. 84 | Then create new CSV files. 85 | """ 86 | input_file = arguments[0] 87 | output_file = arguments[1] 88 | row_limit = arguments[2] 89 | output_path = '.' # Current directory 90 | 91 | # Read CSV, split into list of lists 92 | with open(input_file, 'r') as input_csv: 93 | datareader = csv.reader(input_csv) 94 | all_rows = [] 95 | for row in datareader: 96 | all_rows.append(row) 97 | 98 | # Remove header 99 | header = all_rows.pop(0) 100 | 101 | # Split list of list into chunks 102 | current_chunk = 1 103 | for i in range(0, len(all_rows), row_limit): # Loop through list 104 | chunk = all_rows[i:i + row_limit] # Create single chunk 105 | 106 | current_output = os.path.join( # Create new output file 107 | output_path, 108 | "{}-{}.csv".format(output_file, current_chunk) 109 | ) 110 | 111 | # Add header 112 | chunk.insert(0, header) 113 | 114 | # Write chunk to output file 115 | with open(current_output, 'w') as output_csv: 116 | writer = csv.writer(output_csv) 117 | writer = writer.writerows(chunk) 118 | 119 | # Output info 120 | print("") 121 | print("Chunk # {}:".format(current_chunk)) 122 | print("Filepath: {}".format(current_output)) 123 | print("# of rows: {}".format(len(chunk))) 124 | 125 | # Create new chunk 126 | current_chunk += 1 127 | 128 | 129 | if __name__ == "__main__": 130 | arguments = get_arguments() 131 | parse_file(arguments) 132 | -------------------------------------------------------------------------------- /scripts/12_sample_csv.csv: -------------------------------------------------------------------------------- 1 | First Name,Last Name,Email Address,Phone Number,Company,Date Hired 2 | Abigail,Branch,volutpat.ornare.facilisis@Phasellusvitaemauris.co.uk,(412) 540-6276,Sem Eget PC,07/02/2013 3 | Roanna,Lambert,tristique.pharetra@arcuvelquam.ca,(747) 536-6748,Eget Laoreet Foundation,11/23/2013 4 | Amanda,England,semper.rutrum@blandit.com,(669) 164-6411,Magna Nec Quam Limited,08/11/2012 5 | Hilel,Chapman,ultrices@tempor.ca,(683) 531-0279,Sed Molestie PC,06/25/2012 6 | Basia,Bowers,Quisque.ornare@tinciduntnibh.com,(135) 986-6437,Tincidunt Nunc Ac Associates,05/11/2013 7 | Dylan,Dunlap,est.Mauris@etnetuset.org,(877) 604-4603,Eu Ultrices Institute,07/02/2012 8 | Regan,Cardenas,vitae.semper@ultriciesornareelit.org,(693) 378-7235,Neque Morbi Corporation,10/30/2012 9 | Sade,Green,tortor@sagittis.co.uk,(816) 255-5508,Eleifend Ltd,09/03/2012 10 | Marshall,Richardson,sed.facilisis@eu.com,(460) 132-4621,Purus Maecenas Libero LLC,12/21/2012 11 | Regina,Brown,semper.auctor@sem.co.uk,(185) 963-9365,Vulputate Consulting,06/16/2013 12 | Irma,Rivers,vitae@luctusvulputate.net,(701) 393-3679,Nec Leo Morbi Incorporated,05/07/2013 13 | Rudyard,Cline,fringilla@risusatfringilla.org,(971) 228-3147,Risus Quis Consulting,04/25/2013 14 | Justina,Richmond,sapien.Nunc.pulvinar@vitaeerat.co.uk,(755) 103-3125,Ullamcorper Associates,02/12/2013 15 | Reece,Blackburn,felis@Aliquamauctor.com,(239) 528-2742,Suspendisse Associates,04/03/2014 16 | Lillith,Holden,ut.dolor.dapibus@porttitor.net,(305) 797-1579,Dapibus Id Blandit LLP,09/11/2013 17 | Taylor,Vinson,ac@vellectusCum.net,(355) 993-1099,Egestas Institute,05/16/2012 18 | Colton,Barker,volutpat@necluctus.ca,(705) 978-5992,Ornare Consulting,04/24/2013 19 | Vladimir,Walls,mollis.lectus@imperdietullamcorperDuis.edu,(311) 406-4856,Faucibus Ut Nulla LLP,08/12/2012 20 | Freya,Rowland,sagittis@elementumduiquis.co.uk,(284) 850-7506,Turpis PC,05/31/2013 21 | Cullen,Phelps,Nam.ligula@orciluctus.ca,(425) 280-1763,Rhoncus Id Mollis Consulting,09/10/2013 22 | Boris,Lopez,posuere@adipiscingligula.edu,(769) 701-0055,Nunc Sed Orci Industries,07/26/2013 23 | Alvin,Meyer,Etiam@felis.ca,(783) 312-0821,Dignissim Pharetra Ltd,03/02/2013 24 | Nicole,Boyle,tortor.Integer@imperdiet.edu,(675) 678-1160,Dictum Eleifend Nunc LLC,05/05/2012 25 | Flynn,Petersen,dui@lectusrutrum.com,(787) 543-7411,Penatibus Et Associates,03/11/2013 26 | Troy,Herman,a.felis.ullamcorper@sem.ca,(932) 900-7922,Dolor Donec Associates,11/16/2012 27 | Constance,Shields,nec.leo.Morbi@eunulla.com,(221) 761-2368,Vel Quam Company,02/14/2014 28 | Ocean,Green,vulputate.dui@bibendumDonecfelis.net,(481) 832-0298,Nunc Associates,03/03/2013 29 | Steven,Lopez,Suspendisse.ac@sedpedeCum.net,(294) 415-0435,Ipsum Company,07/25/2013 30 | Adara,Lee,magna.Duis@erat.org,(760) 291-7826,Eu Ultrices PC,10/05/2013 31 | Noble,Hancock,Donec.tincidunt.Donec@dictumcursusNunc.edu,(333) 272-8234,Vitae Risus Duis LLC,09/13/2012 32 | Kendall,Wilcox,quis.pede@Pellentesqueut.ca,(173) 982-4381,Ultrices Industries,01/26/2013 33 | Sebastian,Barton,orci.Ut@ametfaucibus.ca,(951) 817-9217,In Mi Pede Corporation,05/11/2014 34 | Gavin,Clark,metus.facilisis.lorem@Sedetlibero.ca,(671) 714-8378,Vestibulum Neque Limited,06/06/2012 35 | Charles,Woods,Maecenas.mi.felis@lacusvarius.org,(559) 935-9739,Amet Ante Company,09/02/2013 36 | Elvis,Roberts,tempor.diam@risus.co.uk,(184) 182-5324,Facilisis Vitae Inc.,01/07/2014 37 | Caldwell,Carey,Suspendisse@Proin.edu,(125) 243-9354,Egestas Lacinia Sed Inc.,10/24/2012 38 | Jesse,Leblanc,sit@tellussemmollis.com,(726) 216-8000,Lectus Ltd,11/22/2013 39 | Hu,Adkins,purus.in.molestie@acmattisvelit.co.uk,(370) 317-7556,Aliquam Vulputate Company,10/19/2013 40 | Hamilton,Tyler,taciti.sociosqu.ad@Sedmalesuadaaugue.com,(234) 744-3868,Nunc Sed LLC,10/19/2012 41 | Cade,Osborn,at.iaculis.quis@doloregestas.org,(501) 753-9793,Consectetuer Industries,08/14/2013 42 | Ashely,Kent,Cum.sociis.natoque@odioPhasellusat.edu,(789) 869-6558,Imperdiet Ornare Corporation,02/04/2013 43 | Veda,Cameron,tristique.pharetra@necenimNunc.co.uk,(522) 127-0654,Egestas Incorporated,12/29/2012 44 | Burke,Ferrell,orci.sem@semPellentesque.co.uk,(975) 891-3694,Purus Accumsan Institute,07/26/2013 45 | Fuller,Lamb,orci.Donec@vulputatedui.edu,(523) 614-5785,Pede Cum Sociis Limited,12/02/2013 46 | Natalie,Taylor,In@lorem.ca,(117) 594-2685,A Facilisis Non LLP,12/06/2013 47 | Astra,Morton,nec@scelerisquenequeNullam.com,(390) 867-2558,Non Ante Bibendum Foundation,05/07/2012 48 | David,Espinoza,gravida@a.co.uk,(287) 945-5239,Lobortis Nisi Nibh Industries,05/11/2014 49 | Sybil,Todd,risus@sitametrisus.edu,(611) 848-4765,Massa Mauris Vestibulum Incorporated,01/19/2013 50 | Lee,Barron,cursus.non@Praesentinterdumligula.ca,(765) 654-9167,In Ornare Inc.,01/01/2013 51 | Zachery,Reed,nulla.Integer.urna@amet.edu,(667) 465-1222,Ac Corp.,10/07/2012 52 | Marshall,Brady,lobortis.nisi.nibh@molestiearcu.edu,(391) 336-5310,Ac Sem Ut Incorporated,07/12/2012 53 | Selma,Floyd,eros.turpis.non@lectusconvallis.net,(398) 920-1076,Non Foundation,07/21/2012 54 | Ivy,Garrison,posuere@euodio.net,(428) 321-5542,Semper Erat Foundation,12/19/2013 55 | Wyatt,Gibbs,Sed@nequeNullamut.ca,(973) 141-9840,Pellentesque Corp.,11/21/2013 56 | Vaughan,Moss,adipiscing@Phasellusfermentum.net,(597) 730-0228,Tempor Institute,10/27/2013 57 | Elijah,Mcgowan,Aliquam@Quisqueornaretortor.ca,(127) 171-1859,Tempor Bibendum Donec LLC,08/26/2012 58 | Miranda,Ingram,fermentum@velitSedmalesuada.net,(864) 873-7359,Feugiat Non Lobortis Institute,08/20/2012 59 | Anastasia,Lawrence,Mauris.eu@pedeultrices.net,(106) 260-8688,Sit Amet Consulting,05/31/2012 60 | Samson,Patton,non.arcu@enimnislelementum.ca,(302) 330-4251,Hendrerit Associates,12/27/2013 61 | Erasmus,Sexton,lectus.justo@aliquam.org,(972) 793-9187,Feugiat Industries,10/15/2013 62 | Emery,Gardner,erat@lorem.org,(848) 534-1656,Nunc Sit Amet Industries,08/24/2012 63 | Nomlanga,Hensley,Fusce@leoVivamus.org,(644) 169-6243,Consectetuer Company,08/29/2012 64 | Jason,Craft,nunc.nulla@sapien.ca,(691) 770-9143,Blandit LLC,03/23/2013 65 | Kathleen,Haley,sed.dolor.Fusce@imperdietornare.edu,(891) 454-8400,Lorem Company,07/02/2012 66 | Aline,Flynn,a@Nunclaoreet.edu,(563) 400-6803,Et Netus LLP,01/28/2013 67 | Ursa,Dickson,Integer.sem@ullamcorpervelit.com,(371) 615-7750,Nullam Company,12/22/2012 68 | Wesley,Lopez,enim.non.nisi@vulputateduinec.edu,(287) 777-3724,Lobortis Ultrices Vivamus Corp.,06/17/2013 69 | Victoria,Mcleod,lectus.justo.eu@ut.ca,(583) 108-1294,Justo Faucibus Lectus Corporation,10/17/2012 70 | Shana,Roach,scelerisque.sed.sapien@afelisullamcorper.edu,(921) 385-2342,Quis Turpis Vitae Incorporated,05/26/2014 71 | Maxine,Ruiz,Donec.porttitor@hymenaeosMaurisut.edu,(520) 801-0808,Luctus Foundation,12/05/2013 72 | Harriet,Bishop,Quisque@Crasdictum.com,(758) 716-9401,Dictum Phasellus In Inc.,09/08/2013 73 | Serina,Williams,tincidunt.vehicula.risus@sedliberoProin.ca,(270) 288-0136,At Egestas A Corporation,03/17/2014 74 | Rhea,Copeland,laoreet.ipsum@Aliquam.co.uk,(775) 493-9118,Ipsum Incorporated,05/22/2013 75 | Evan,Holcomb,neque.sed@ullamcorperDuis.ca,(695) 656-8621,Sem Institute,02/16/2013 76 | Basil,Mccall,arcu.Vestibulum.ante@luctuslobortis.co.uk,(144) 989-4125,Feugiat Tellus Lorem Institute,02/25/2013 77 | Florence,Riley,sit.amet@Proinvel.org,(663) 529-4829,Enim Sit PC,01/14/2014 78 | Heather,Peck,mauris@scelerisqueneque.edu,(850) 444-0917,Curabitur Limited,01/16/2014 79 | Dara,Robinson,egestas@utnisi.net,(106) 576-1355,Urna Incorporated,12/15/2012 80 | Kylan,Maxwell,conubia.nostra@accumsan.com,(973) 206-2558,Aliquam Eros Turpis Company,08/21/2012 81 | Petra,Blake,faucibus.orci.luctus@dapibusrutrum.ca,(901) 207-9872,Ac Metus Institute,06/17/2013 82 | Fiona,Goff,tincidunt@enim.net,(265) 255-7749,Odio Phasellus Corp.,12/03/2012 83 | Kameko,Diaz,ac@turpisNulla.edu,(731) 354-4848,Montes Nascetur Corporation,08/16/2013 84 | Craig,Valentine,tristique@urnaVivamus.net,(437) 229-8198,Etiam Gravida Molestie Consulting,05/06/2014 85 | Samson,Cunningham,semper.pretium@auctor.edu,(335) 666-7758,Nec Ante Associates,07/02/2013 86 | Yoko,Rogers,nunc@Vivamus.net,(893) 405-6889,Fermentum Vel Mauris Corp.,03/29/2014 87 | Walter,Burnett,nisi.Mauris.nulla@felis.co.uk,(336) 411-9222,Suscipit Est Institute,06/26/2012 88 | Gisela,Nash,euismod@lectusrutrum.ca,(917) 249-0166,Non Magna LLP,11/23/2012 89 | Wanda,Pierce,Nulla@dolorsit.com,(480) 872-3389,Cum Sociis Natoque Limited,11/02/2013 90 | Jane,Dixon,eu.odio@Infaucibus.com,(112) 139-8563,Id Ante Dictum LLC,03/14/2014 91 | Octavius,Shannon,iaculis.aliquet@ante.ca,(541) 652-3295,Libero Est Institute,05/28/2014 92 | Rigel,Hunt,metus.Aenean.sed@inhendrerit.org,(792) 358-7505,Enim PC,09/05/2013 93 | Rachel,Gray,erat.in.consectetuer@Fuscealiquetmagna.org,(165) 973-1366,Suscipit Nonummy Fusce LLC,05/08/2013 94 | Madeline,Bradley,dignissim.Maecenas@egetmassaSuspendisse.co.uk,(436) 223-3135,Posuere PC,01/24/2014 95 | Emma,Conner,dictum@magnaDuisdignissim.com,(304) 429-2622,Nulla Incorporated,11/05/2013 96 | Halee,Mclean,amet.faucibus@Phasellus.net,(669) 364-0148,Ligula Consulting,03/05/2014 97 | Conan,Williams,massa@felisNulla.net,(999) 649-4433,Velit Eu Limited,05/15/2014 98 | Martena,Fowler,mi.lacinia@maurisa.ca,(405) 661-1762,Blandit Nam Institute,02/27/2013 99 | Robin,Buckley,cursus.Nunc.mauris@nislQuisque.net,(376) 771-9862,Sed Corp.,10/30/2012 100 | Isadora,Adams,arcu.Vestibulum@urna.co.uk,(138) 774-6058,Blandit Viverra Donec Institute,08/07/2012 101 | Bernard,Price,ultrices@Praesent.ca,(368) 882-6146,Egestas Blandit LLP,11/03/2013 -------------------------------------------------------------------------------- /scripts/13_random_name_generator.py: -------------------------------------------------------------------------------- 1 | from random import choice 2 | 3 | 4 | def random_name_generator(first, second, x): 5 | """ 6 | Generates random names. 7 | Arguments: 8 | - list of first names 9 | - list of last names 10 | - number of random names 11 | """ 12 | names = [] 13 | for i in range(x): 14 | names.append("{0} {1}".format(choice(first), choice(second))) 15 | return set(names) 16 | 17 | 18 | first_names = ["Drew", "Mike", "Landon", "Jeremy", "Tyler", "Tom", "Avery"] 19 | last_names = ["Smith", "Jones", "Brighton", "Taylor"] 20 | names = random_name_generator(first_names, last_names, 5) 21 | print('\n'.join(names)) 22 | -------------------------------------------------------------------------------- /scripts/14_html_to_markdown.sh: -------------------------------------------------------------------------------- 1 | # Convert all html files in a single directory to markdown 2 | # 3 | # 1. Install pandoc 4 | # 2. Run the script 5 | 6 | 7 | 8 | FILES=*.html 9 | for f in $FILES 10 | do 11 | # extension="${f##*.}" 12 | filename="${f%.*}" 13 | echo "Converting $f to $filename.md" 14 | `pandoc $f -t markdown -o ../mds/$filename.md` 15 | # uncomment this line to delete the source file. 16 | # rm $f 17 | done -------------------------------------------------------------------------------- /scripts/15_check_my_environment.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pass in a config file based on your environment. 3 | 4 | Example: 5 | 6 | import check_my_environment 7 | 8 | 9 | class Main: 10 | def __init__(self, configFile): 11 | pass 12 | 13 | def process(self): 14 | print("ok") 15 | 16 | if __name__ == "__main__": 17 | m = Main(some_script.CONFIGFILE) 18 | m.process() 19 | 20 | """ 21 | 22 | 23 | import os 24 | import sys 25 | ENVIRONMENT = "development" 26 | CONFIGFILE = None 27 | 28 | 29 | def get_config_file(): 30 | directory = os.path.dirname(__file__) 31 | return { 32 | "development": "{}/../config/development.cfg".format(directory), 33 | "staging": "{}/../config/staging.cfg".format(directory), 34 | "production": "{}/../config/production.cfg".format(directory) 35 | }.get(ENVIRONMENT, None) 36 | 37 | CONFIGFILE = get_config_file() 38 | 39 | if CONFIGFILE is None: 40 | sys.exit("Configuration error! Unknown environment set. \ 41 | Edit config.py and set appropriate environment") 42 | print("Config file: {}".format(CONFIGFILE)) 43 | if not os.path.exists(CONFIGFILE): 44 | sys.exit("Configuration error! Config file does not exist") 45 | print("Config ok ....") 46 | -------------------------------------------------------------------------------- /scripts/16_jinja_quick_load.py: -------------------------------------------------------------------------------- 1 | """ 2 | Render a quick Jinja2 template. 3 | Thanks Danny - http://pydanny.com/jinja2-quick-load-function.html 4 | 5 | Example: 6 | 7 | >>> from jinja_quick_load import render_from_template 8 | >>> data = { 9 | ... "date": "June 12, 2014", 10 | ... "items": ["oranges", "bananas", "steak", "milk"] 11 | ... } 12 | >>> render_from_template(".", "shopping_list.html", **data) 13 | 14 | """ 15 | 16 | 17 | from jinja2 import FileSystemLoader, Environment 18 | 19 | 20 | def render_from_template(directory, template_name, **kwargs): 21 | loader = FileSystemLoader(directory) 22 | env = Environment(loader=loader) 23 | template = env.get_template(template_name) 24 | return template.render(**kwargs) 25 | -------------------------------------------------------------------------------- /scripts/17_rewrite_git_history.md: -------------------------------------------------------------------------------- 1 | I always forget how to back date, so here we go ... 2 | 3 | > This is dangerous and should be signed off by the omniscience, omnipotence Git him/herself. Rewriting history is evil, in other words. 4 | 5 | ```bash 6 | $ git add 7 | $ export GIT_COMMITER_DATE="Sun Jun 15 14:00 2014 +0100" 8 | $ export GIT_AUTHOR_DATE="Sun Jun 15 14:00 2014 +0100" 9 | $ git commit -m "so bad" 10 | $ git push 11 | ``` 12 | 13 | > `GIT_COMMITER_DATE` and `GIT_AUTHOR_DATE` are environment variables -------------------------------------------------------------------------------- /scripts/18_zipper.py: -------------------------------------------------------------------------------- 1 | import os 2 | from datetime import datetime 3 | from zipfile import ZipFile 4 | 5 | 6 | # set file name and time of creation 7 | today = datetime.now() 8 | file_name = 'zipper_' + today.strftime('%Y.%m.%dh%H%M') + '.zip' 9 | dir_name = 'tmp/' # update path 10 | 11 | 12 | def zipdir(path, zip): 13 | for root, dirs, files in os.walk(path): 14 | for file in files: 15 | zip.write(os.path.join(root, file)) 16 | 17 | if __name__ == '__main__': 18 | zipfile = ZipFile(file_name, 'w') 19 | zipdir(dir_name, zipfile) 20 | zipfile.close() 21 | -------------------------------------------------------------------------------- /scripts/19_tsv-to-csv.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import csv 4 | 5 | 6 | def convert(input, out): 7 | if os.path.exists(out): 8 | raise ValueError("Output file already exists") 9 | 10 | reader = csv.reader(open(input, 'rU'), dialect=csv.excel_tab) 11 | writer = csv.writer(open(out, "wb+"), dialect="excel") 12 | for row in reader: 13 | writer.writerow(row) 14 | 15 | if __name__ == "__main__": 16 | convert(sys.argv[1], sys.argv[2]) 17 | -------------------------------------------------------------------------------- /scripts/20_restore_file_from_git.py: -------------------------------------------------------------------------------- 1 | from subprocess import check_output, call 2 | 3 | 4 | file_name = str(input('Enter the file name: ')) 5 | commit = check_output(["git", "rev-list", "-n", "1", "HEAD", "--", file_name]) 6 | print(str(commit).rstrip()) 7 | call(["git", "checkout", str(commit).rstrip()+"~1", file_name]) 8 | 9 | 10 | """ 11 | After entering a filename, this script searches your Git history for that file. 12 | If the file exists, then it will restore it. 13 | """ 14 | -------------------------------------------------------------------------------- /scripts/21_twitter_bot.py: -------------------------------------------------------------------------------- 1 | import tweepy 2 | 3 | # Authentication credentials - dev.twitter.com 4 | cfg = { 5 | 'consumer_key': 'VALUE', 6 | 'consumer_secret': 'VALUE', 7 | 'access_token': 'VALUE', 8 | 'access_token_secret': 'VALUE' 9 | } 10 | 11 | 12 | def get_api_handler(cfg): 13 | auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret']) 14 | auth.set_access_token(cfg['access_token'], cfg['access_token_secret']) 15 | return tweepy.API(auth) 16 | 17 | 18 | def main(): 19 | api = get_api_handler(cfg) 20 | tweet = 'Hello, world from Tweepy!' 21 | api.update_status(status=tweet) 22 | 23 | 24 | if __name__ == "__main__": 25 | main() 26 | -------------------------------------------------------------------------------- /scripts/22_git_tag.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | 5 | if len(sys.argv) == 3: 6 | tag = sys.argv[1] 7 | commit = sys.argv[2] 8 | command = 'git tag -a {0} {1} -m "{2}"'.format(tag, commit, tag) 9 | output = subprocess.check_output(command, shell=True).decode('utf-8') 10 | subprocess.call(command, shell=True) 11 | subprocess.call('git push --tags', shell=True) 12 | else: 13 | print('usage: tag.py TAG_NAME COMMIT') 14 | sys.exit(1) 15 | -------------------------------------------------------------------------------- /scripts/23_flask_session_test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from flask import Flask, session, url_for, redirect 3 | 4 | app = Flask(__name__) 5 | app.secret_key = 'secret' 6 | 7 | 8 | @app.route('/') 9 | def set(): 10 | session.clear() 11 | session['works'] = True 12 | return redirect(url_for('get')) 13 | 14 | 15 | @app.route('/get') 16 | def get(): 17 | works = session.get('works', False) 18 | return str(works) 19 | 20 | 21 | app.run(sys.argv[1], use_reloader=False) 22 | -------------------------------------------------------------------------------- /scripts/24_sql2csv.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import csv 3 | import sqlite3 4 | 5 | if len(sys.argv) < 3: 6 | print("Use: {0} DATABASE_NAME TABLE_NAME".format(sys.argv[0])) 7 | exit() 8 | 9 | conn = sqlite3.connect(sys.argv[1]) 10 | cur = conn.cursor() 11 | data = cur.execute("SELECT * FROM {0}".format(sys.argv[2])) 12 | 13 | with open('output.csv', 'wb') as f: 14 | writer = csv.writer(f) 15 | writer.writerows(data) 16 | 17 | conn.close() 18 | -------------------------------------------------------------------------------- /scripts/25_ip2geolocation.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import requests 3 | 4 | 5 | def get_addresses(filename): 6 | """ 7 | Given a CSV file, this function returns a list of lists 8 | where each element (list) in the outer list contains the 9 | row info from the csv file. 10 | """ 11 | all_addresses = [] 12 | with open(filename, 'rt') as f: 13 | reader = csv.reader(f) 14 | for row in reader: 15 | all_addresses.append(row) 16 | return all_addresses 17 | 18 | 19 | def get_geolocation(all_the_ip_address): 20 | """ 21 | Given a list of lists from `get_addresses()`, this function 22 | returns an updated lists of lists containing the geolocation. 23 | """ 24 | print("Getting geo information...") 25 | updated_addresses = [] 26 | counter = 1 27 | # update header 28 | header_row = all_the_ip_address.pop(0) 29 | header_row.extend(['Country', 'City']) 30 | # get geolocation 31 | for line in all_the_ip_address: 32 | print("Grabbing geo info for row # {0}".format(counter)) 33 | r = requests.get('https://freegeoip.net/json/{0}'.format(line[0])) 34 | line.extend([str(r.json()['country_name']), str(r.json()['city'])]) 35 | updated_addresses.append(line) 36 | counter += 1 37 | updated_addresses.insert(0, header_row) 38 | return updated_addresses 39 | 40 | 41 | def create_csv(updated_address_list): 42 | """ 43 | Given the updated lists of lists from `get_geolocation()`, this function 44 | creates a new CSV. 45 | """ 46 | import sys 47 | if sys.version_info >= (3, 0, 0): 48 | f = open('output.csv', 'w', newline='') 49 | else: 50 | f = open('output.csv', 'wb') 51 | with f: 52 | writer = csv.writer(f) 53 | writer.writerows(updated_address_list) 54 | print("All done!") 55 | 56 | 57 | if __name__ == '__main__': 58 | csv_file = '25_sample_csv.csv' 59 | all_the_ip_address = get_addresses(csv_file) 60 | updated_address_list = get_geolocation(all_the_ip_address) 61 | create_csv(updated_address_list) 62 | -------------------------------------------------------------------------------- /scripts/25_sample_csv.csv: -------------------------------------------------------------------------------- 1 | IP Address,Full Name,Id,Email 2 | 162.252.85.172,Virgie Simonis,0,Tatyana_Barton@domenico.net 3 | 208.110.83.202,Tyrese Bartoletti,1,Birdie.Greenholt@annetta.co.uk 4 | 108.162.199.95,Markus Sanford,2,Lela_Homenick@philip.net 5 | 169.228.182.227,Anastasia Sawayn,3,Abe@camylle.name 6 | 184.72.242.188,Ashly Howe,5,Kieran.Bashirian@ansley.com -------------------------------------------------------------------------------- /scripts/26_stock_scraper.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from lxml import html 3 | from collections import defaultdict 4 | 5 | 6 | def get_stocks(url): 7 | # Make Request 8 | page = requests.get(url) 9 | # Parse/Scrape 10 | tree = html.fromstring(page.text) 11 | xpath = '//*[@id="mw-content-text"]/table[1]' 12 | rows = tree.xpath(xpath)[0].findall("tr") 13 | rows = [(row.getchildren()[0], row.getchildren()[3]) for row in rows[1:]] 14 | rows = [(row[0].getchildren()[0].text, row[1].text) for row in rows] 15 | industries = defaultdict(list) 16 | for row in rows: 17 | industries[row[1]].append(row[0]) 18 | return industries 19 | 20 | 21 | def output_data(data_dict): 22 | for industry in data_dict: 23 | print('\n'+industry) 24 | print('-'*len(industry)) 25 | for ticker in data_dict[industry]: 26 | print(ticker) 27 | 28 | 29 | if __name__ == '__main__': 30 | url = 'http://en.wikipedia.org/wiki/List_of_S%26P_500_companies' 31 | scraped_data = get_stocks(url) 32 | output_data(scraped_data) 33 | -------------------------------------------------------------------------------- /scripts/27_send_sms.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | message = raw_input('Enter a Message: ') 4 | number = raw_input('Enter the phone number: ') 5 | 6 | 7 | payload = {'number': number, 'message': message} 8 | r = requests.post("http://textbelt.com/text", data=payload) 9 | if r.json()['success']: 10 | print('Success!') 11 | else: 12 | print('Error!') 13 | -------------------------------------------------------------------------------- /scripts/28_income_tax_calculator.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | headers = { 4 | 'Content-Type': 'application/x-www-form-urlencoded', 5 | 'Accept': 'application/json', 6 | } 7 | 8 | data = { 9 | 'pay_rate': '10000', 10 | 'filing_status': 'single', 11 | 'pay_periods': 1, 12 | 'state': 'CO', 13 | 'year': 14 | '2014' 15 | } 16 | 17 | r = requests.post( 18 | 'http://taxee.io/api/v1/calculate/2014', 19 | data=data, 20 | headers=headers 21 | ) 22 | 23 | print(r.text) 24 | -------------------------------------------------------------------------------- /scripts/29_json_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "colorsArray":[{ 3 | "colorName":"red", 4 | "hexValue":"#f00" 5 | }, 6 | { 7 | "colorName":"green", 8 | "hexValue":"#0f0" 9 | }, 10 | { 11 | "colorName":"blue", 12 | "hexValue":"#00f" 13 | }, 14 | { 15 | "colorName":"cyan", 16 | "hexValue":"#0ff" 17 | }, 18 | { 19 | "colorName":"magenta", 20 | "hexValue":"#f0f" 21 | }, 22 | { 23 | "colorName":"yellow", 24 | "hexValue":"#ff0" 25 | }, 26 | { 27 | "colorName":"black", 28 | "hexValue":"#000" 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /scripts/29_json_to_yaml.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import json 3 | import yaml 4 | 5 | """ 6 | Example usage: 7 | 8 | $ python 29_json_to_yaml.py 29_json_test.json 9 | """ 10 | 11 | # load json data 12 | json_data = json.loads(open(sys.argv[1]).read()) 13 | # convert unicode to string 14 | converted_json_data = json.dumps(json_data) 15 | # output yaml 16 | print(yaml.dump(yaml.load(converted_json_data), default_flow_style=False)) 17 | -------------------------------------------------------------------------------- /scripts/30_fullcontact.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import requests 4 | 5 | """ 6 | 7 | 1. pip install requests 8 | 2. Obtain an API key: https://www.fullcontact.com/developer/pricing/ 9 | 10 | Example usage: 11 | 12 | $ python 30_fullcontact.py email SOME@EMAIL.COM 13 | $ python 30_fullcontact.py twitter TWITTER_HANDLE 14 | """ 15 | 16 | 17 | # constants 18 | 19 | API_KEY = os.environ.get('FULLCONTACT_API_KEY') 20 | BASE_URL = 'http://api.fullcontact.com/v2/person.json' 21 | 22 | 23 | # helpers 24 | 25 | def get_arguments(): 26 | if len(sys.argv) is 3: 27 | return { 28 | 'media': sys.argv[1], 29 | 'user_info': sys.argv[2] 30 | } 31 | else: 32 | print('Specify at least 1 argument') 33 | sys.exit() 34 | 35 | 36 | def call_api(contact): 37 | url = BASE_URL + '?{0}={1}&apiKey={2}'.format( 38 | contact['media'], contact['user_info'], API_KEY) 39 | r = requests.get(url) 40 | if r.status_code == 200: 41 | return r.text 42 | else: 43 | return "Sorry, no results found." 44 | 45 | 46 | # main 47 | 48 | if __name__ == "__main__": 49 | media = get_arguments() 50 | print(call_api(media)) 51 | -------------------------------------------------------------------------------- /scripts/31_youtube_sentiment.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import requests 3 | from bs4 import BeautifulSoup as bs4 4 | 5 | """ 6 | Example usage: 7 | 8 | $ python 31_youtube_sentiment.py https://www.youtube.com/watch?v=_vrAjAHhUsA 9 | """ 10 | 11 | 12 | def get_arguments(): 13 | if len(sys.argv) is 2: 14 | return sys.argv[1] 15 | else: 16 | print('Specify at least 1 argument') 17 | sys.exit() 18 | 19 | 20 | def get_comments(url): 21 | html = requests.get('https://plus.googleapis.com/u/0/_/widget/render/comments?first_party_property=YOUTUBE&href=' + url) 22 | soup = bs4(html.text, 'html.parser') 23 | return [comment.string for comment in soup.findAll('div', class_='Ct')] 24 | 25 | 26 | def calculate_sentiment(comments): 27 | positive = 0 28 | negative = 0 29 | negative_words = [ 30 | 'hate', 'hated', 'dislike', 'disliked', 'awful', 'terrible', 'bad', 31 | 'painful', 'worst', 'suck', 'rubbish', 'sad', 'sodding' 32 | ] 33 | positive_words = [ 34 | 'love', 'loved', 'like', 'liked', 'awesome', 'amazing', 'good', 35 | 'great', 'excellent', 'brilliant', 'cool' 36 | ] 37 | for comment in comments: 38 | if comment is None: 39 | continue 40 | else: 41 | for word in comment.split(' '): 42 | if word in negative_words: 43 | negative += 1 44 | if word in positive_words: 45 | positive += 1 46 | return {'positive': positive, 'negative': negative} 47 | 48 | 49 | def main(): 50 | url = get_arguments() 51 | if url: 52 | comments = get_comments(url) 53 | if len(comments) <= 0: 54 | print('This video has no comments.') 55 | sys.exit() 56 | sentiment = calculate_sentiment(comments) 57 | positive_score = sentiment['positive'] 58 | negative_score = sentiment['negative'] 59 | total_score = positive_score + negative_score 60 | if positive_score > negative_score: 61 | print('This video is generally positive:') 62 | print('{0} positive / {1} total hits'.format( 63 | positive_score, total_score)) 64 | elif negative_score > positive_score: 65 | print('This video is generally negative:') 66 | print ('{0} negative / {1} total hits'.format( 67 | negative_score, total_score)) 68 | else: 69 | print('This video is mutual:') 70 | print('{0} positive {1} negative'.format( 71 | positive_score, negative_score)) 72 | else: 73 | print('No url supplied') 74 | 75 | 76 | if __name__ == '__main__': 77 | main() 78 | -------------------------------------------------------------------------------- /scripts/32_stock_scraper.py: -------------------------------------------------------------------------------- 1 | import urllib.request 2 | from bs4 import BeautifulSoup 3 | 4 | 5 | def get_stock_tickers(): 6 | req = urllib.request.Request( 7 | 'http://en.wikipedia.org/wiki/List_of_S%26P_500_companies') 8 | page = urllib.request.urlopen(req) 9 | soup = BeautifulSoup(page, 'html.parser') 10 | table = soup.find('table', {'class': 'wikitable sortable'}) 11 | tickers = [] 12 | for row in table.findAll('tr'): 13 | col = row.findAll('td') 14 | if len(col) > 0: 15 | tickers.append(str(col[0].string.strip())) 16 | tickers.sort() 17 | return tickers 18 | 19 | 20 | def get_stock_prices(ticker_list): 21 | for ticker in ticker_list: 22 | htmlfile = urllib.request.urlopen( 23 | "http://finance.yahoo.com/q?s={0}".format(ticker) 24 | ) 25 | htmltext = htmlfile.read() 26 | soup = BeautifulSoup(htmltext, 'html.parser') 27 | htmlSelector = 'yfs_l84_{0}'.format(ticker.lower()) 28 | for price in soup.find_all(id=htmlSelector): 29 | print('{0} is {1}'.format(ticker, price.text)) 30 | 31 | 32 | def main(): 33 | all_tickers = get_stock_tickers() 34 | get_stock_prices(all_tickers) 35 | 36 | 37 | if __name__ == '__main__': 38 | main() 39 | -------------------------------------------------------------------------------- /scripts/33_country_code.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import sys 3 | import json 4 | 5 | """ 6 | Example usage: 7 | 8 | $ python 33_country_code.py 33_sample_csv.csv 33_country_codes.json 9 | """ 10 | 11 | 12 | def get_data(csv_file, json_file): 13 | countryCodes = [] 14 | countryNames = [] 15 | continentNames = [] 16 | with open(csv_file, 'rt') as file_one: 17 | reader = csv.reader(file_one) 18 | with open(json_file) as file_two: 19 | json_data = json.load(file_two) 20 | all_countries = json_data["country"] 21 | for csv_row in reader: 22 | for json_row in all_countries: 23 | if csv_row[0] == json_row["countryCode"]: 24 | countryCodes.append(json_row["countryCode"]) 25 | countryNames.append(json_row["countryName"]) 26 | continentNames.append(json_row["continentName"]) 27 | 28 | return [ 29 | countryCodes, 30 | countryNames, 31 | continentNames 32 | ] 33 | 34 | 35 | def write_data(array_of_arrays): 36 | with open('data.csv', 'wt') as csv_out: 37 | writer = csv.writer(csv_out) 38 | rows = zip( 39 | array_of_arrays[0], 40 | array_of_arrays[1], 41 | array_of_arrays[2] 42 | ) 43 | for row in rows: 44 | writer.writerow(row) 45 | 46 | 47 | if __name__ == '__main__': 48 | csv_file_name = sys.argv[1] 49 | json_file_name = sys.argv[2] 50 | data = get_data(csv_file_name, json_file_name) 51 | write_data(data) 52 | -------------------------------------------------------------------------------- /scripts/33_country_codes.json: -------------------------------------------------------------------------------- 1 | { 2 | "country": [ 3 | { 4 | "countryCode": "AD", 5 | "countryName": "Andorra", 6 | "continentName": "Europe" 7 | }, 8 | { 9 | "countryCode": "AE", 10 | "countryName": "United Arab Emirates", 11 | "continentName": "Asia" 12 | }, 13 | { 14 | "countryCode": "AF", 15 | "countryName": "Afghanistan", 16 | "continentName": "Asia" 17 | }, 18 | { 19 | "countryCode": "AG", 20 | "countryName": "Antigua and Barbuda", 21 | "continentName": "North America" 22 | }, 23 | { 24 | "countryCode": "AI", 25 | "countryName": "Anguilla", 26 | "continentName": "North America" 27 | }, 28 | { 29 | "countryCode": "AL", 30 | "countryName": "Albania", 31 | "continentName": "Europe" 32 | }, 33 | { 34 | "countryCode": "AM", 35 | "countryName": "Armenia", 36 | "continentName": "Asia" 37 | }, 38 | { 39 | "countryCode": "AO", 40 | "countryName": "Angola", 41 | "continentName": "Africa" 42 | }, 43 | { 44 | "countryCode": "AQ", 45 | "countryName": "Antarctica", 46 | "continentName": "Antarctica" 47 | }, 48 | { 49 | "countryCode": "AR", 50 | "countryName": "Argentina", 51 | "continentName": "South America" 52 | }, 53 | { 54 | "countryCode": "AS", 55 | "countryName": "American Samoa", 56 | "continentName": "Oceania" 57 | }, 58 | { 59 | "countryCode": "AT", 60 | "countryName": "Austria", 61 | "continentName": "Europe" 62 | }, 63 | { 64 | "countryCode": "AU", 65 | "countryName": "Australia", 66 | "continentName": "Oceania" 67 | }, 68 | { 69 | "countryCode": "AW", 70 | "countryName": "Aruba", 71 | "continentName": "North America" 72 | }, 73 | { 74 | "countryCode": "AX", 75 | "countryName": "Åland", 76 | "continentName": "Europe" 77 | }, 78 | { 79 | "countryCode": "AZ", 80 | "countryName": "Azerbaijan", 81 | "continentName": "Asia" 82 | }, 83 | { 84 | "countryCode": "BA", 85 | "countryName": "Bosnia and Herzegovina", 86 | "continentName": "Europe" 87 | }, 88 | { 89 | "countryCode": "BB", 90 | "countryName": "Barbados", 91 | "continentName": "North America" 92 | }, 93 | { 94 | "countryCode": "BD", 95 | "countryName": "Bangladesh", 96 | "continentName": "Asia" 97 | }, 98 | { 99 | "countryCode": "BE", 100 | "countryName": "Belgium", 101 | "continentName": "Europe" 102 | }, 103 | { 104 | "countryCode": "BF", 105 | "countryName": "Burkina Faso", 106 | "continentName": "Africa" 107 | }, 108 | { 109 | "countryCode": "BG", 110 | "countryName": "Bulgaria", 111 | "continentName": "Europe" 112 | }, 113 | { 114 | "countryCode": "BH", 115 | "countryName": "Bahrain", 116 | "continentName": "Asia" 117 | }, 118 | { 119 | "countryCode": "BI", 120 | "countryName": "Burundi", 121 | "continentName": "Africa" 122 | }, 123 | { 124 | "countryCode": "BJ", 125 | "countryName": "Benin", 126 | "continentName": "Africa" 127 | }, 128 | { 129 | "countryCode": "BL", 130 | "countryName": "Saint Barthélemy", 131 | "continentName": "North America" 132 | }, 133 | { 134 | "countryCode": "BM", 135 | "countryName": "Bermuda", 136 | "continentName": "North America" 137 | }, 138 | { 139 | "countryCode": "BN", 140 | "countryName": "Brunei", 141 | "continentName": "Asia" 142 | }, 143 | { 144 | "countryCode": "BO", 145 | "countryName": "Bolivia", 146 | "continentName": "South America" 147 | }, 148 | { 149 | "countryCode": "BQ", 150 | "countryName": "Bonaire", 151 | "continentName": "North America" 152 | }, 153 | { 154 | "countryCode": "BR", 155 | "countryName": "Brazil", 156 | "continentName": "South America" 157 | }, 158 | { 159 | "countryCode": "BS", 160 | "countryName": "Bahamas", 161 | "continentName": "North America" 162 | }, 163 | { 164 | "countryCode": "BT", 165 | "countryName": "Bhutan", 166 | "continentName": "Asia" 167 | }, 168 | { 169 | "countryCode": "BV", 170 | "countryName": "Bouvet Island", 171 | "continentName": "Antarctica" 172 | }, 173 | { 174 | "countryCode": "BW", 175 | "countryName": "Botswana", 176 | "continentName": "Africa" 177 | }, 178 | { 179 | "countryCode": "BY", 180 | "countryName": "Belarus", 181 | "continentName": "Europe" 182 | }, 183 | { 184 | "countryCode": "BZ", 185 | "countryName": "Belize", 186 | "continentName": "North America" 187 | }, 188 | { 189 | "countryCode": "CA", 190 | "countryName": "Canada", 191 | "continentName": "North America" 192 | }, 193 | { 194 | "countryCode": "CC", 195 | "countryName": "Cocos [Keeling] Islands", 196 | "continentName": "Asia" 197 | }, 198 | { 199 | "countryCode": "CD", 200 | "countryName": "Democratic Republic of the Congo", 201 | "continentName": "Africa" 202 | }, 203 | { 204 | "countryCode": "CF", 205 | "countryName": "Central African Republic", 206 | "continentName": "Africa" 207 | }, 208 | { 209 | "countryCode": "CG", 210 | "countryName": "Republic of the Congo", 211 | "continentName": "Africa" 212 | }, 213 | { 214 | "countryCode": "CH", 215 | "countryName": "Switzerland", 216 | "continentName": "Europe" 217 | }, 218 | { 219 | "countryCode": "CI", 220 | "countryName": "Ivory Coast", 221 | "continentName": "Africa" 222 | }, 223 | { 224 | "countryCode": "CK", 225 | "countryName": "Cook Islands", 226 | "continentName": "Oceania" 227 | }, 228 | { 229 | "countryCode": "CL", 230 | "countryName": "Chile", 231 | "continentName": "South America" 232 | }, 233 | { 234 | "countryCode": "CM", 235 | "countryName": "Cameroon", 236 | "continentName": "Africa" 237 | }, 238 | { 239 | "countryCode": "CN", 240 | "countryName": "China", 241 | "continentName": "Asia" 242 | }, 243 | { 244 | "countryCode": "CO", 245 | "countryName": "Colombia", 246 | "continentName": "South America" 247 | }, 248 | { 249 | "countryCode": "CR", 250 | "countryName": "Costa Rica", 251 | "continentName": "North America" 252 | }, 253 | { 254 | "countryCode": "CU", 255 | "countryName": "Cuba", 256 | "continentName": "North America" 257 | }, 258 | { 259 | "countryCode": "CV", 260 | "countryName": "Cape Verde", 261 | "continentName": "Africa" 262 | }, 263 | { 264 | "countryCode": "CW", 265 | "countryName": "Curacao", 266 | "continentName": "North America" 267 | }, 268 | { 269 | "countryCode": "CX", 270 | "countryName": "Christmas Island", 271 | "continentName": "Asia" 272 | }, 273 | { 274 | "countryCode": "CY", 275 | "countryName": "Cyprus", 276 | "continentName": "Europe" 277 | }, 278 | { 279 | "countryCode": "CZ", 280 | "countryName": "Czechia", 281 | "continentName": "Europe" 282 | }, 283 | { 284 | "countryCode": "DE", 285 | "countryName": "Germany", 286 | "continentName": "Europe" 287 | }, 288 | { 289 | "countryCode": "DJ", 290 | "countryName": "Djibouti", 291 | "continentName": "Africa" 292 | }, 293 | { 294 | "countryCode": "DK", 295 | "countryName": "Denmark", 296 | "continentName": "Europe" 297 | }, 298 | { 299 | "countryCode": "DM", 300 | "countryName": "Dominica", 301 | "continentName": "North America" 302 | }, 303 | { 304 | "countryCode": "DO", 305 | "countryName": "Dominican Republic", 306 | "continentName": "North America" 307 | }, 308 | { 309 | "countryCode": "DZ", 310 | "countryName": "Algeria", 311 | "continentName": "Africa" 312 | }, 313 | { 314 | "countryCode": "EC", 315 | "countryName": "Ecuador", 316 | "continentName": "South America" 317 | }, 318 | { 319 | "countryCode": "EE", 320 | "countryName": "Estonia", 321 | "continentName": "Europe" 322 | }, 323 | { 324 | "countryCode": "EG", 325 | "countryName": "Egypt", 326 | "continentName": "Africa" 327 | }, 328 | { 329 | "countryCode": "EH", 330 | "countryName": "Western Sahara", 331 | "continentName": "Africa" 332 | }, 333 | { 334 | "countryCode": "ER", 335 | "countryName": "Eritrea", 336 | "continentName": "Africa" 337 | }, 338 | { 339 | "countryCode": "ES", 340 | "countryName": "Spain", 341 | "continentName": "Europe" 342 | }, 343 | { 344 | "countryCode": "ET", 345 | "countryName": "Ethiopia", 346 | "continentName": "Africa" 347 | }, 348 | { 349 | "countryCode": "FI", 350 | "countryName": "Finland", 351 | "continentName": "Europe" 352 | }, 353 | { 354 | "countryCode": "FJ", 355 | "countryName": "Fiji", 356 | "continentName": "Oceania" 357 | }, 358 | { 359 | "countryCode": "FK", 360 | "countryName": "Falkland Islands", 361 | "continentName": "South America" 362 | }, 363 | { 364 | "countryCode": "FM", 365 | "countryName": "Micronesia", 366 | "continentName": "Oceania" 367 | }, 368 | { 369 | "countryCode": "FO", 370 | "countryName": "Faroe Islands", 371 | "continentName": "Europe" 372 | }, 373 | { 374 | "countryCode": "FR", 375 | "countryName": "France", 376 | "continentName": "Europe" 377 | }, 378 | { 379 | "countryCode": "GA", 380 | "countryName": "Gabon", 381 | "continentName": "Africa" 382 | }, 383 | { 384 | "countryCode": "GB", 385 | "countryName": "United Kingdom", 386 | "continentName": "Europe" 387 | }, 388 | { 389 | "countryCode": "GD", 390 | "countryName": "Grenada", 391 | "continentName": "North America" 392 | }, 393 | { 394 | "countryCode": "GE", 395 | "countryName": "Georgia", 396 | "continentName": "Asia" 397 | }, 398 | { 399 | "countryCode": "GF", 400 | "countryName": "French Guiana", 401 | "continentName": "South America" 402 | }, 403 | { 404 | "countryCode": "GG", 405 | "countryName": "Guernsey", 406 | "continentName": "Europe" 407 | }, 408 | { 409 | "countryCode": "GH", 410 | "countryName": "Ghana", 411 | "continentName": "Africa" 412 | }, 413 | { 414 | "countryCode": "GI", 415 | "countryName": "Gibraltar", 416 | "continentName": "Europe" 417 | }, 418 | { 419 | "countryCode": "GL", 420 | "countryName": "Greenland", 421 | "continentName": "North America" 422 | }, 423 | { 424 | "countryCode": "GM", 425 | "countryName": "Gambia", 426 | "continentName": "Africa" 427 | }, 428 | { 429 | "countryCode": "GN", 430 | "countryName": "Guinea", 431 | "continentName": "Africa" 432 | }, 433 | { 434 | "countryCode": "GP", 435 | "countryName": "Guadeloupe", 436 | "continentName": "North America" 437 | }, 438 | { 439 | "countryCode": "GQ", 440 | "countryName": "Equatorial Guinea", 441 | "continentName": "Africa" 442 | }, 443 | { 444 | "countryCode": "GR", 445 | "countryName": "Greece", 446 | "continentName": "Europe" 447 | }, 448 | { 449 | "countryCode": "GS", 450 | "countryName": "South Georgia and the South Sandwich Islands", 451 | "continentName": "Antarctica" 452 | }, 453 | { 454 | "countryCode": "GT", 455 | "countryName": "Guatemala", 456 | "continentName": "North America" 457 | }, 458 | { 459 | "countryCode": "GU", 460 | "countryName": "Guam", 461 | "continentName": "Oceania" 462 | }, 463 | { 464 | "countryCode": "GW", 465 | "countryName": "Guinea-Bissau", 466 | "continentName": "Africa" 467 | }, 468 | { 469 | "countryCode": "GY", 470 | "countryName": "Guyana", 471 | "continentName": "South America" 472 | }, 473 | { 474 | "countryCode": "HK", 475 | "countryName": "Hong Kong", 476 | "continentName": "Asia" 477 | }, 478 | { 479 | "countryCode": "HM", 480 | "countryName": "Heard Island and McDonald Islands", 481 | "continentName": "Antarctica" 482 | }, 483 | { 484 | "countryCode": "HN", 485 | "countryName": "Honduras", 486 | "continentName": "North America" 487 | }, 488 | { 489 | "countryCode": "HR", 490 | "countryName": "Croatia", 491 | "continentName": "Europe" 492 | }, 493 | { 494 | "countryCode": "HT", 495 | "countryName": "Haiti", 496 | "continentName": "North America" 497 | }, 498 | { 499 | "countryCode": "HU", 500 | "countryName": "Hungary", 501 | "continentName": "Europe" 502 | }, 503 | { 504 | "countryCode": "ID", 505 | "countryName": "Indonesia", 506 | "continentName": "Asia" 507 | }, 508 | { 509 | "countryCode": "IE", 510 | "countryName": "Ireland", 511 | "continentName": "Europe" 512 | }, 513 | { 514 | "countryCode": "IL", 515 | "countryName": "Israel", 516 | "continentName": "Asia" 517 | }, 518 | { 519 | "countryCode": "IM", 520 | "countryName": "Isle of Man", 521 | "continentName": "Europe" 522 | }, 523 | { 524 | "countryCode": "IN", 525 | "countryName": "India", 526 | "continentName": "Asia" 527 | }, 528 | { 529 | "countryCode": "IO", 530 | "countryName": "British Indian Ocean Territory", 531 | "continentName": "Asia" 532 | }, 533 | { 534 | "countryCode": "IQ", 535 | "countryName": "Iraq", 536 | "continentName": "Asia" 537 | }, 538 | { 539 | "countryCode": "IR", 540 | "countryName": "Iran", 541 | "continentName": "Asia" 542 | }, 543 | { 544 | "countryCode": "IS", 545 | "countryName": "Iceland", 546 | "continentName": "Europe" 547 | }, 548 | { 549 | "countryCode": "IT", 550 | "countryName": "Italy", 551 | "continentName": "Europe" 552 | }, 553 | { 554 | "countryCode": "JE", 555 | "countryName": "Jersey", 556 | "continentName": "Europe" 557 | }, 558 | { 559 | "countryCode": "JM", 560 | "countryName": "Jamaica", 561 | "continentName": "North America" 562 | }, 563 | { 564 | "countryCode": "JO", 565 | "countryName": "Jordan", 566 | "continentName": "Asia" 567 | }, 568 | { 569 | "countryCode": "JP", 570 | "countryName": "Japan", 571 | "continentName": "Asia" 572 | }, 573 | { 574 | "countryCode": "KE", 575 | "countryName": "Kenya", 576 | "continentName": "Africa" 577 | }, 578 | { 579 | "countryCode": "KG", 580 | "countryName": "Kyrgyzstan", 581 | "continentName": "Asia" 582 | }, 583 | { 584 | "countryCode": "KH", 585 | "countryName": "Cambodia", 586 | "continentName": "Asia" 587 | }, 588 | { 589 | "countryCode": "KI", 590 | "countryName": "Kiribati", 591 | "continentName": "Oceania" 592 | }, 593 | { 594 | "countryCode": "KM", 595 | "countryName": "Comoros", 596 | "continentName": "Africa" 597 | }, 598 | { 599 | "countryCode": "KN", 600 | "countryName": "Saint Kitts and Nevis", 601 | "continentName": "North America" 602 | }, 603 | { 604 | "countryCode": "KP", 605 | "countryName": "North Korea", 606 | "continentName": "Asia" 607 | }, 608 | { 609 | "countryCode": "KR", 610 | "countryName": "South Korea", 611 | "continentName": "Asia" 612 | }, 613 | { 614 | "countryCode": "KW", 615 | "countryName": "Kuwait", 616 | "continentName": "Asia" 617 | }, 618 | { 619 | "countryCode": "KY", 620 | "countryName": "Cayman Islands", 621 | "continentName": "North America" 622 | }, 623 | { 624 | "countryCode": "KZ", 625 | "countryName": "Kazakhstan", 626 | "continentName": "Asia" 627 | }, 628 | { 629 | "countryCode": "LA", 630 | "countryName": "Laos", 631 | "continentName": "Asia" 632 | }, 633 | { 634 | "countryCode": "LB", 635 | "countryName": "Lebanon", 636 | "continentName": "Asia" 637 | }, 638 | { 639 | "countryCode": "LC", 640 | "countryName": "Saint Lucia", 641 | "continentName": "North America" 642 | }, 643 | { 644 | "countryCode": "LI", 645 | "countryName": "Liechtenstein", 646 | "continentName": "Europe" 647 | }, 648 | { 649 | "countryCode": "LK", 650 | "countryName": "Sri Lanka", 651 | "continentName": "Asia" 652 | }, 653 | { 654 | "countryCode": "LR", 655 | "countryName": "Liberia", 656 | "continentName": "Africa" 657 | }, 658 | { 659 | "countryCode": "LS", 660 | "countryName": "Lesotho", 661 | "continentName": "Africa" 662 | }, 663 | { 664 | "countryCode": "LT", 665 | "countryName": "Lithuania", 666 | "continentName": "Europe" 667 | }, 668 | { 669 | "countryCode": "LU", 670 | "countryName": "Luxembourg", 671 | "continentName": "Europe" 672 | }, 673 | { 674 | "countryCode": "LV", 675 | "countryName": "Latvia", 676 | "continentName": "Europe" 677 | }, 678 | { 679 | "countryCode": "LY", 680 | "countryName": "Libya", 681 | "continentName": "Africa" 682 | }, 683 | { 684 | "countryCode": "MA", 685 | "countryName": "Morocco", 686 | "continentName": "Africa" 687 | }, 688 | { 689 | "countryCode": "MC", 690 | "countryName": "Monaco", 691 | "continentName": "Europe" 692 | }, 693 | { 694 | "countryCode": "MD", 695 | "countryName": "Moldova", 696 | "continentName": "Europe" 697 | }, 698 | { 699 | "countryCode": "ME", 700 | "countryName": "Montenegro", 701 | "continentName": "Europe" 702 | }, 703 | { 704 | "countryCode": "MF", 705 | "countryName": "Saint Martin", 706 | "continentName": "North America" 707 | }, 708 | { 709 | "countryCode": "MG", 710 | "countryName": "Madagascar", 711 | "continentName": "Africa" 712 | }, 713 | { 714 | "countryCode": "MH", 715 | "countryName": "Marshall Islands", 716 | "continentName": "Oceania" 717 | }, 718 | { 719 | "countryCode": "MK", 720 | "countryName": "Macedonia", 721 | "continentName": "Europe" 722 | }, 723 | { 724 | "countryCode": "ML", 725 | "countryName": "Mali", 726 | "continentName": "Africa" 727 | }, 728 | { 729 | "countryCode": "MM", 730 | "countryName": "Myanmar [Burma]", 731 | "continentName": "Asia" 732 | }, 733 | { 734 | "countryCode": "MN", 735 | "countryName": "Mongolia", 736 | "continentName": "Asia" 737 | }, 738 | { 739 | "countryCode": "MO", 740 | "countryName": "Macao", 741 | "continentName": "Asia" 742 | }, 743 | { 744 | "countryCode": "MP", 745 | "countryName": "Northern Mariana Islands", 746 | "continentName": "Oceania" 747 | }, 748 | { 749 | "countryCode": "MQ", 750 | "countryName": "Martinique", 751 | "continentName": "North America" 752 | }, 753 | { 754 | "countryCode": "MR", 755 | "countryName": "Mauritania", 756 | "continentName": "Africa" 757 | }, 758 | { 759 | "countryCode": "MS", 760 | "countryName": "Montserrat", 761 | "continentName": "North America" 762 | }, 763 | { 764 | "countryCode": "MT", 765 | "countryName": "Malta", 766 | "continentName": "Europe" 767 | }, 768 | { 769 | "countryCode": "MU", 770 | "countryName": "Mauritius", 771 | "continentName": "Africa" 772 | }, 773 | { 774 | "countryCode": "MV", 775 | "countryName": "Maldives", 776 | "continentName": "Asia" 777 | }, 778 | { 779 | "countryCode": "MW", 780 | "countryName": "Malawi", 781 | "continentName": "Africa" 782 | }, 783 | { 784 | "countryCode": "MX", 785 | "countryName": "Mexico", 786 | "continentName": "North America" 787 | }, 788 | { 789 | "countryCode": "MY", 790 | "countryName": "Malaysia", 791 | "continentName": "Asia" 792 | }, 793 | { 794 | "countryCode": "MZ", 795 | "countryName": "Mozambique", 796 | "continentName": "Africa" 797 | }, 798 | { 799 | "countryCode": "NA", 800 | "countryName": "Namibia", 801 | "continentName": "Africa" 802 | }, 803 | { 804 | "countryCode": "NC", 805 | "countryName": "New Caledonia", 806 | "continentName": "Oceania" 807 | }, 808 | { 809 | "countryCode": "NE", 810 | "countryName": "Niger", 811 | "continentName": "Africa" 812 | }, 813 | { 814 | "countryCode": "NF", 815 | "countryName": "Norfolk Island", 816 | "continentName": "Oceania" 817 | }, 818 | { 819 | "countryCode": "NG", 820 | "countryName": "Nigeria", 821 | "continentName": "Africa" 822 | }, 823 | { 824 | "countryCode": "NI", 825 | "countryName": "Nicaragua", 826 | "continentName": "North America" 827 | }, 828 | { 829 | "countryCode": "NL", 830 | "countryName": "Netherlands", 831 | "continentName": "Europe" 832 | }, 833 | { 834 | "countryCode": "NO", 835 | "countryName": "Norway", 836 | "continentName": "Europe" 837 | }, 838 | { 839 | "countryCode": "NP", 840 | "countryName": "Nepal", 841 | "continentName": "Asia" 842 | }, 843 | { 844 | "countryCode": "NR", 845 | "countryName": "Nauru", 846 | "continentName": "Oceania" 847 | }, 848 | { 849 | "countryCode": "NU", 850 | "countryName": "Niue", 851 | "continentName": "Oceania" 852 | }, 853 | { 854 | "countryCode": "NZ", 855 | "countryName": "New Zealand", 856 | "continentName": "Oceania" 857 | }, 858 | { 859 | "countryCode": "OM", 860 | "countryName": "Oman", 861 | "continentName": "Asia" 862 | }, 863 | { 864 | "countryCode": "PA", 865 | "countryName": "Panama", 866 | "continentName": "North America" 867 | }, 868 | { 869 | "countryCode": "PE", 870 | "countryName": "Peru", 871 | "continentName": "South America" 872 | }, 873 | { 874 | "countryCode": "PF", 875 | "countryName": "French Polynesia", 876 | "continentName": "Oceania" 877 | }, 878 | { 879 | "countryCode": "PG", 880 | "countryName": "Papua New Guinea", 881 | "continentName": "Oceania" 882 | }, 883 | { 884 | "countryCode": "PH", 885 | "countryName": "Philippines", 886 | "continentName": "Asia" 887 | }, 888 | { 889 | "countryCode": "PK", 890 | "countryName": "Pakistan", 891 | "continentName": "Asia" 892 | }, 893 | { 894 | "countryCode": "PL", 895 | "countryName": "Poland", 896 | "continentName": "Europe" 897 | }, 898 | { 899 | "countryCode": "PM", 900 | "countryName": "Saint Pierre and Miquelon", 901 | "continentName": "North America" 902 | }, 903 | { 904 | "countryCode": "PN", 905 | "countryName": "Pitcairn Islands", 906 | "continentName": "Oceania" 907 | }, 908 | { 909 | "countryCode": "PR", 910 | "countryName": "Puerto Rico", 911 | "continentName": "North America" 912 | }, 913 | { 914 | "countryCode": "PS", 915 | "countryName": "Palestine", 916 | "continentName": "Asia" 917 | }, 918 | { 919 | "countryCode": "PT", 920 | "countryName": "Portugal", 921 | "continentName": "Europe" 922 | }, 923 | { 924 | "countryCode": "PW", 925 | "countryName": "Palau", 926 | "continentName": "Oceania" 927 | }, 928 | { 929 | "countryCode": "PY", 930 | "countryName": "Paraguay", 931 | "continentName": "South America" 932 | }, 933 | { 934 | "countryCode": "QA", 935 | "countryName": "Qatar", 936 | "continentName": "Asia" 937 | }, 938 | { 939 | "countryCode": "RE", 940 | "countryName": "Réunion", 941 | "continentName": "Africa" 942 | }, 943 | { 944 | "countryCode": "RO", 945 | "countryName": "Romania", 946 | "continentName": "Europe" 947 | }, 948 | { 949 | "countryCode": "RS", 950 | "countryName": "Serbia", 951 | "continentName": "Europe" 952 | }, 953 | { 954 | "countryCode": "RU", 955 | "countryName": "Russia", 956 | "continentName": "Europe" 957 | }, 958 | { 959 | "countryCode": "RW", 960 | "countryName": "Rwanda", 961 | "continentName": "Africa" 962 | }, 963 | { 964 | "countryCode": "SA", 965 | "countryName": "Saudi Arabia", 966 | "continentName": "Asia" 967 | }, 968 | { 969 | "countryCode": "SB", 970 | "countryName": "Solomon Islands", 971 | "continentName": "Oceania" 972 | }, 973 | { 974 | "countryCode": "SC", 975 | "countryName": "Seychelles", 976 | "continentName": "Africa" 977 | }, 978 | { 979 | "countryCode": "SD", 980 | "countryName": "Sudan", 981 | "continentName": "Africa" 982 | }, 983 | { 984 | "countryCode": "SE", 985 | "countryName": "Sweden", 986 | "continentName": "Europe" 987 | }, 988 | { 989 | "countryCode": "SG", 990 | "countryName": "Singapore", 991 | "continentName": "Asia" 992 | }, 993 | { 994 | "countryCode": "SH", 995 | "countryName": "Saint Helena", 996 | "continentName": "Africa" 997 | }, 998 | { 999 | "countryCode": "SI", 1000 | "countryName": "Slovenia", 1001 | "continentName": "Europe" 1002 | }, 1003 | { 1004 | "countryCode": "SJ", 1005 | "countryName": "Svalbard and Jan Mayen", 1006 | "continentName": "Europe" 1007 | }, 1008 | { 1009 | "countryCode": "SK", 1010 | "countryName": "Slovakia", 1011 | "continentName": "Europe" 1012 | }, 1013 | { 1014 | "countryCode": "SL", 1015 | "countryName": "Sierra Leone", 1016 | "continentName": "Africa" 1017 | }, 1018 | { 1019 | "countryCode": "SM", 1020 | "countryName": "San Marino", 1021 | "continentName": "Europe" 1022 | }, 1023 | { 1024 | "countryCode": "SN", 1025 | "countryName": "Senegal", 1026 | "continentName": "Africa" 1027 | }, 1028 | { 1029 | "countryCode": "SO", 1030 | "countryName": "Somalia", 1031 | "continentName": "Africa" 1032 | }, 1033 | { 1034 | "countryCode": "SR", 1035 | "countryName": "Suriname", 1036 | "continentName": "South America" 1037 | }, 1038 | { 1039 | "countryCode": "SS", 1040 | "countryName": "South Sudan", 1041 | "continentName": "Africa" 1042 | }, 1043 | { 1044 | "countryCode": "ST", 1045 | "countryName": "São Tomé and Príncipe", 1046 | "continentName": "Africa" 1047 | }, 1048 | { 1049 | "countryCode": "SV", 1050 | "countryName": "El Salvador", 1051 | "continentName": "North America" 1052 | }, 1053 | { 1054 | "countryCode": "SX", 1055 | "countryName": "Sint Maarten", 1056 | "continentName": "North America" 1057 | }, 1058 | { 1059 | "countryCode": "SY", 1060 | "countryName": "Syria", 1061 | "continentName": "Asia" 1062 | }, 1063 | { 1064 | "countryCode": "SZ", 1065 | "countryName": "Swaziland", 1066 | "continentName": "Africa" 1067 | }, 1068 | { 1069 | "countryCode": "TC", 1070 | "countryName": "Turks and Caicos Islands", 1071 | "continentName": "North America" 1072 | }, 1073 | { 1074 | "countryCode": "TD", 1075 | "countryName": "Chad", 1076 | "continentName": "Africa" 1077 | }, 1078 | { 1079 | "countryCode": "TF", 1080 | "countryName": "French Southern Territories", 1081 | "continentName": "Antarctica" 1082 | }, 1083 | { 1084 | "countryCode": "TG", 1085 | "countryName": "Togo", 1086 | "continentName": "Africa" 1087 | }, 1088 | { 1089 | "countryCode": "TH", 1090 | "countryName": "Thailand", 1091 | "continentName": "Asia" 1092 | }, 1093 | { 1094 | "countryCode": "TJ", 1095 | "countryName": "Tajikistan", 1096 | "continentName": "Asia" 1097 | }, 1098 | { 1099 | "countryCode": "TK", 1100 | "countryName": "Tokelau", 1101 | "continentName": "Oceania" 1102 | }, 1103 | { 1104 | "countryCode": "TL", 1105 | "countryName": "East Timor", 1106 | "continentName": "Oceania" 1107 | }, 1108 | { 1109 | "countryCode": "TM", 1110 | "countryName": "Turkmenistan", 1111 | "continentName": "Asia" 1112 | }, 1113 | { 1114 | "countryCode": "TN", 1115 | "countryName": "Tunisia", 1116 | "continentName": "Africa" 1117 | }, 1118 | { 1119 | "countryCode": "TO", 1120 | "countryName": "Tonga", 1121 | "continentName": "Oceania" 1122 | }, 1123 | { 1124 | "countryCode": "TR", 1125 | "countryName": "Turkey", 1126 | "continentName": "Asia" 1127 | }, 1128 | { 1129 | "countryCode": "TT", 1130 | "countryName": "Trinidad and Tobago", 1131 | "continentName": "North America" 1132 | }, 1133 | { 1134 | "countryCode": "TV", 1135 | "countryName": "Tuvalu", 1136 | "continentName": "Oceania" 1137 | }, 1138 | { 1139 | "countryCode": "TW", 1140 | "countryName": "Taiwan", 1141 | "continentName": "Asia" 1142 | }, 1143 | { 1144 | "countryCode": "TZ", 1145 | "countryName": "Tanzania", 1146 | "continentName": "Africa" 1147 | }, 1148 | { 1149 | "countryCode": "UA", 1150 | "countryName": "Ukraine", 1151 | "continentName": "Europe" 1152 | }, 1153 | { 1154 | "countryCode": "UG", 1155 | "countryName": "Uganda", 1156 | "continentName": "Africa" 1157 | }, 1158 | { 1159 | "countryCode": "UM", 1160 | "countryName": "U.S. Minor Outlying Islands", 1161 | "continentName": "Oceania" 1162 | }, 1163 | { 1164 | "countryCode": "US", 1165 | "countryName": "United States", 1166 | "continentName": "North America" 1167 | }, 1168 | { 1169 | "countryCode": "UY", 1170 | "countryName": "Uruguay", 1171 | "continentName": "South America" 1172 | }, 1173 | { 1174 | "countryCode": "UZ", 1175 | "countryName": "Uzbekistan", 1176 | "continentName": "Asia" 1177 | }, 1178 | { 1179 | "countryCode": "VA", 1180 | "countryName": "Vatican City", 1181 | "continentName": "Europe" 1182 | }, 1183 | { 1184 | "countryCode": "VC", 1185 | "countryName": "Saint Vincent and the Grenadines", 1186 | "continentName": "North America" 1187 | }, 1188 | { 1189 | "countryCode": "VE", 1190 | "countryName": "Venezuela", 1191 | "continentName": "South America" 1192 | }, 1193 | { 1194 | "countryCode": "VG", 1195 | "countryName": "British Virgin Islands", 1196 | "continentName": "North America" 1197 | }, 1198 | { 1199 | "countryCode": "VI", 1200 | "countryName": "U.S. Virgin Islands", 1201 | "continentName": "North America" 1202 | }, 1203 | { 1204 | "countryCode": "VN", 1205 | "countryName": "Vietnam", 1206 | "continentName": "Asia" 1207 | }, 1208 | { 1209 | "countryCode": "VU", 1210 | "countryName": "Vanuatu", 1211 | "continentName": "Oceania" 1212 | }, 1213 | { 1214 | "countryCode": "WF", 1215 | "countryName": "Wallis and Futuna", 1216 | "continentName": "Oceania" 1217 | }, 1218 | { 1219 | "countryCode": "WS", 1220 | "countryName": "Samoa", 1221 | "continentName": "Oceania" 1222 | }, 1223 | { 1224 | "countryCode": "XK", 1225 | "countryName": "Kosovo", 1226 | "continentName": "Europe" 1227 | }, 1228 | { 1229 | "countryCode": "YE", 1230 | "countryName": "Yemen", 1231 | "continentName": "Asia" 1232 | }, 1233 | { 1234 | "countryCode": "YT", 1235 | "countryName": "Mayotte", 1236 | "continentName": "Africa" 1237 | }, 1238 | { 1239 | "countryCode": "ZA", 1240 | "countryName": "South Africa", 1241 | "continentName": "Africa" 1242 | }, 1243 | { 1244 | "countryCode": "ZM", 1245 | "countryName": "Zambia", 1246 | "continentName": "Africa" 1247 | }, 1248 | { 1249 | "countryCode": "ZW", 1250 | "countryName": "Zimbabwe", 1251 | "continentName": "Africa" 1252 | } 1253 | ] 1254 | } 1255 | -------------------------------------------------------------------------------- /scripts/33_sample_csv.csv: -------------------------------------------------------------------------------- 1 | A2 2 | AE 3 | AL 4 | AP 5 | AR 6 | AT 7 | AU 8 | AZ 9 | BA 10 | BD 11 | BE 12 | BG 13 | BH 14 | BN 15 | BR 16 | BY 17 | CA 18 | CH 19 | CL 20 | CN 21 | CO 22 | CR 23 | CW 24 | CY 25 | CZ 26 | DE 27 | DK 28 | DO 29 | EC 30 | EE 31 | ES 32 | FI 33 | FR 34 | GB 35 | GE 36 | GG 37 | GH 38 | GI 39 | GR 40 | GT 41 | HK 42 | HR 43 | HT 44 | HU 45 | ID 46 | IE 47 | IL 48 | IN 49 | IS 50 | IT 51 | JM 52 | JO 53 | JP 54 | KE 55 | KG 56 | KR 57 | KW 58 | KY 59 | KZ 60 | LA 61 | LB 62 | LK 63 | LT 64 | LU 65 | LV 66 | MD 67 | MG 68 | MK 69 | MO 70 | MT 71 | MV 72 | MX 73 | MY 74 | NC 75 | NG 76 | NI 77 | NL 78 | NO 79 | NP 80 | NZ 81 | OM 82 | PA 83 | PE 84 | PH 85 | PK 86 | PL 87 | PR 88 | PT 89 | PY 90 | RO 91 | RS 92 | RU 93 | SA 94 | SE 95 | SG 96 | SI 97 | SK 98 | SO 99 | TH 100 | TR 101 | TW 102 | TZ 103 | UA 104 | US 105 | UY 106 | VN 107 | VU 108 | ZA 109 | ZW 110 | -------------------------------------------------------------------------------- /scripts/34_git_all_repos.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import requests 4 | 5 | 6 | def get_total_repos(group, name): 7 | repo_urls = [] 8 | page = 1 9 | while True: 10 | url = 'https://api.github.com/{0}/{1}/repos?per_page=100&page={2}' 11 | r = requests.get(url.format(group, name, page)) 12 | if r.status_code == 200: 13 | rdata = r.json() 14 | for repo in rdata: 15 | repo_urls.append(repo['clone_url']) 16 | if (len(rdata) >= 100): 17 | page += 1 18 | else: 19 | print('Found {0} repos.'.format(len(repo_urls))) 20 | break 21 | else: 22 | print(r) 23 | return False 24 | return repo_urls 25 | 26 | 27 | def clone_repos(all_repos): 28 | count = 1 29 | print('Cloning...') 30 | for repo in all_repos: 31 | os.system('Git clone ' + repo) 32 | print('Completed repo #{0} of {1}'.format(count, len(all_repos))) 33 | count += 1 34 | 35 | if __name__ == '__main__': 36 | if len(sys.argv) > 2: 37 | total = get_total_repos(sys.argv[1], sys.argv[2]) 38 | if total: 39 | clone_repos(total) 40 | 41 | else: 42 | print('Usage: python USERS_OR_ORG GITHUB_USER_OR_ORG-NAME') 43 | -------------------------------------------------------------------------------- /scripts/data.csv: -------------------------------------------------------------------------------- 1 | AE,United Arab Emirates,Asia 2 | AL,Albania,Europe 3 | AR,Argentina,South America 4 | AT,Austria,Europe 5 | AU,Australia,Oceania 6 | AZ,Azerbaijan,Asia 7 | BA,Bosnia and Herzegovina,Europe 8 | BD,Bangladesh,Asia 9 | BE,Belgium,Europe 10 | BG,Bulgaria,Europe 11 | BH,Bahrain,Asia 12 | BN,Brunei,Asia 13 | BR,Brazil,South America 14 | BY,Belarus,Europe 15 | CA,Canada,North America 16 | CH,Switzerland,Europe 17 | CL,Chile,South America 18 | CN,China,Asia 19 | CO,Colombia,South America 20 | CR,Costa Rica,North America 21 | CW,Curacao,North America 22 | CY,Cyprus,Europe 23 | CZ,Czechia,Europe 24 | DE,Germany,Europe 25 | DK,Denmark,Europe 26 | DO,Dominican Republic,North America 27 | EC,Ecuador,South America 28 | EE,Estonia,Europe 29 | ES,Spain,Europe 30 | FI,Finland,Europe 31 | FR,France,Europe 32 | GB,United Kingdom,Europe 33 | GE,Georgia,Asia 34 | GG,Guernsey,Europe 35 | GH,Ghana,Africa 36 | GI,Gibraltar,Europe 37 | GR,Greece,Europe 38 | GT,Guatemala,North America 39 | HK,Hong Kong,Asia 40 | HR,Croatia,Europe 41 | HT,Haiti,North America 42 | HU,Hungary,Europe 43 | ID,Indonesia,Asia 44 | IE,Ireland,Europe 45 | IL,Israel,Asia 46 | IN,India,Asia 47 | IS,Iceland,Europe 48 | IT,Italy,Europe 49 | JM,Jamaica,North America 50 | JO,Jordan,Asia 51 | JP,Japan,Asia 52 | KE,Kenya,Africa 53 | KG,Kyrgyzstan,Asia 54 | KR,South Korea,Asia 55 | KW,Kuwait,Asia 56 | KY,Cayman Islands,North America 57 | KZ,Kazakhstan,Asia 58 | LA,Laos,Asia 59 | LB,Lebanon,Asia 60 | LK,Sri Lanka,Asia 61 | LT,Lithuania,Europe 62 | LU,Luxembourg,Europe 63 | LV,Latvia,Europe 64 | MD,Moldova,Europe 65 | MG,Madagascar,Africa 66 | MK,Macedonia,Europe 67 | MO,Macao,Asia 68 | MT,Malta,Europe 69 | MV,Maldives,Asia 70 | MX,Mexico,North America 71 | MY,Malaysia,Asia 72 | NC,New Caledonia,Oceania 73 | NG,Nigeria,Africa 74 | NI,Nicaragua,North America 75 | NL,Netherlands,Europe 76 | NO,Norway,Europe 77 | NP,Nepal,Asia 78 | NZ,New Zealand,Oceania 79 | OM,Oman,Asia 80 | PA,Panama,North America 81 | PE,Peru,South America 82 | PH,Philippines,Asia 83 | PK,Pakistan,Asia 84 | PL,Poland,Europe 85 | PR,Puerto Rico,North America 86 | PT,Portugal,Europe 87 | PY,Paraguay,South America 88 | RO,Romania,Europe 89 | RS,Serbia,Europe 90 | RU,Russia,Europe 91 | SA,Saudi Arabia,Asia 92 | SE,Sweden,Europe 93 | SG,Singapore,Asia 94 | SI,Slovenia,Europe 95 | SK,Slovakia,Europe 96 | SO,Somalia,Africa 97 | TH,Thailand,Asia 98 | TR,Turkey,Asia 99 | TW,Taiwan,Asia 100 | TZ,Tanzania,Africa 101 | UA,Ukraine,Europe 102 | US,United States,North America 103 | UY,Uruguay,South America 104 | VN,Vietnam,Asia 105 | VU,Vanuatu,Oceania 106 | ZA,South Africa,Africa 107 | ZW,Zimbabwe,Africa 108 | --------------------------------------------------------------------------------