This file contains 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
""" | |
The wins file generator script we use at PyBites | |
Because it matters! | |
https://pybit.es/articles/boost-your-motivation-with-brag-doc/ | |
""" | |
from datetime import date, datetime | |
import sys | |
LAST_WEEK_NUMBER = 52 |
This file contains 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 | |
from rich.console import Console | |
from rich.table import Table | |
ARTICLES_API = "https://codechalleng.es/api/articles/" | |
TABLE_TITLE = "Matching Pybites Articles" | |
COLUMNS = ("title", "link", "author", "publish_date", "tags") | |
COLORS = ("#ff6e4a", "#00bfff", "magenta", "cyan", "#5f87d7") | |
console = Console() |
This file contains 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 datetime import date, datetime, time | |
import logging | |
import os | |
from slack_sdk import WebClient | |
from slack_sdk.errors import SlackApiError | |
STOIC_CHANNEL = os.environ["STOIC_CHANNEL"] | |
SLACK_BOT_TOKEN = os.environ["SLACK_BOT_TOKEN"] | |
THIS_YEAR = date.today().year |
This file contains 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 collections import Counter | |
from datetime import date | |
from dateutil.parser import parse | |
import plotext as plt | |
import requests | |
API_URL = "https://codechalleng.es/api/articles/" | |
START_YEAR = 2017 | |
THIS_YEAR = date.today().year |
This file contains 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
"""Script to create an index file from my Zettelkasten notes (md files)""" | |
from collections import defaultdict | |
import os | |
from pathlib import Path | |
import re | |
from typing import NamedTuple | |
INDEX_NAME = "index.md" | |
NOTE_FILENAME_REGEX = re.compile(r"^\d.*\.md") | |
TAG_REGEX = re.compile(r"#\S+") |
This file contains 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 datetime import datetime | |
>>> import time | |
>>> import sched | |
>>> s = sched.scheduler(time.time, time.sleep) | |
>>> def hydrate(sc): | |
... print(datetime.now(), "Sip water!") | |
... s.enter(300, 1, hydrate, (sc,)) | |
... | |
>>> s.enter(300, 1, hydrate, (s,)) | |
Event(time=1611405298.4987588, priority=1, action=... |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" /> | |
<script defer src="https://pyscript.net/latest/pyscript.js"></script> | |
</head> | |
<body> | |
<h1>Time left till New Year:</h1> | |
<h2 id="showtime"></h2> | |
<py-config> | |
packages = ["python-dateutil"] |
This file contains 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 csv | |
from urllib.request import urlretrieve | |
GEO_DATA = ( | |
"https://raw.githubusercontent.com/pybites/" | |
"100DaysOfCode/master/050/simplemaps-worldcities-basic.csv" | |
) | |
CITIES = [ | |
"Amsterdam", | |
"Paris", |
This file contains 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
city_coords = { | |
"Amsterdam": ["52.34996869", "4.916640176"], | |
"Barcelona": ["10.13037518", "-64.72001367"], | |
"Berlin": ["52.52181866", "13.40154862"], | |
"Biarritz": ["43.47327537", "-1.561594891"], | |
"Brussels": ["50.83331708", "4.333316608"], | |
"Bucharest": ["44.4333718", "26.09994665"], | |
"Edinburgh": ["55.94832786", "-3.219090618"], | |
"Florence": ["34.19567629", "-79.76279057"], | |
"København": ["55.67856419", "12.56348575"], |
This file contains 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
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" /> | |
<script defer src="https://pyscript.net/latest/pyscript.js"></script> | |
</head> | |
<body> | |
<h1>Some places I have visited over the years:</h1> | |
<div id="folium"></div> | |
<py-config> | |
packages = ["folium"] |