This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from mpl_toolkits.basemap import Basemap | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import pandas as pd | |
| import random | |
| # Import our csv into a panda dataframe | |
| df = pd.read_csv('iss.csv') | |
| # Convert timestamp column to a datetime format | |
| df['timestamp'] = pd.to_datetime(df['timestamp'], unit='s') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| latitude | longitude | timestamp | |
|---|---|---|---|
| -47.8109 | -83.3540 | 1586852138 | |
| -47.5613 | -82.5117 | 1586852149 | |
| -47.2920 | -81.6365 | 1586852159 | |
| -47.0154 | -80.7709 | 1586852170 | |
| -46.7453 | -79.9550 | 1586852180 | |
| -46.4548 | -79.1078 | 1586852190 | |
| -46.1719 | -78.3099 | 1586852200 | |
| -45.8682 | -77.4814 | 1586852211 | |
| -45.5579 | -76.6625 | 1586852221 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| import sys | |
| import boto3 | |
| import concurrent.futures | |
| # Get the script action | |
| action = str(sys.argv[1]) | |
| def describeInstances(action): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from kafka import KafkaConsumer, KafkaProducer, TopicPartition | |
| from datetime import datetime | |
| import boto3 | |
| import os | |
| import sys | |
| #settings | |
| client = ["node01:9092", "node02:9092", "node03:9092"] | |
| topic = 'test-auto-kafka' | |
| nbrrecords = int(50) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Connect4: | |
| def __init__(self): | |
| self.numberOfColumns = 7 | |
| self.numberOfLines = 6 | |
| self.board = [ [ ' ' for _ in range( self.numberOfColumns)] for _ in range(self.numberOfLines) ] | |
| def displayBoard(self): | |
| for i, line in enumerate(self.board): | |
| # Printing the line separators |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
| class weightlifting: | |
| def __init__(self): | |
| self.woman_barbell = 15 | |
| self.man_barbell = 20 | |
| self.gender = "F" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import logging | |
| from bs4 import BeautifulSoup | |
| import argparse | |
| import datetime | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-v', '--verbose', action='count', default=0) | |
| args = parser.parse_args() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # # Analysis with beautifulsoup | |
| soup = BeautifulSoup(response.content, 'html.parser') | |
| table = soup.find("table",{"class":"result"}) | |
| table_body = table.find('tbody') | |
| logging.debug(table_body) | |
| rows = table_body.find_all('tr') | |
| tournament_idx_lst = [] | |
| for i, row in enumerate(rows): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getPlayersFullName(playerUrl): | |
| player_url = 'https://www.tennisexplorer.com'+ playerUrl | |
| player_response = requests.get(player_url) | |
| player_soup = BeautifulSoup(player_response.content, 'html.parser') | |
| player_table = player_soup.find("table",{"class":"plDetail"}) | |
| player_table_body = player_table.find('tbody') | |
| player_name = player_table_body.find_all('h3') | |
| return ' '.join(player_name[0].text.split()[::-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i, item in enumerate(tournament_idx_lst[:-1]): | |
| tournament_name = rows[item].find("td", class_="t-name").text.strip() | |
| if "Pro Tennis" in tournament_name or "Futures" in tournament_name or "challenger" in tournament_name: | |
| continue | |
| if not tournament_dict.get(tournament_name): | |
| tournament_dict[tournament_name] = {} | |
| tournament_dict[tournament_name][current_date] = [] | |
| for c in range (item+1, tournament_idx_lst[i+1], 2): | |
| tournament_dict[tournament_name][current_date].append(getPlayersFullName(rows[c].find("td", class_="t-name").a['href']) + ' vs ' + getPlayersFullName(rows[c+1].find("td", class_="t-name").a['href'])) |