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 weather | |
import smtp | |
''' | |
Send a greeting email to our customer email list | |
with the daily weather forecast and schedule | |
''' | |
def get_emails(): | |
# Reading emails from a file |
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
'''Simple tictactoe game, board positions are like keyboard | |
7 8 9 | |
4 5 6 | |
1 2 3 | |
''' | |
from builtins import input | |
from collections import Counter | |
from functools import wraps | |
import itertools |
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
"""Written on iPhone with the Pythonista 3 app | |
As a joke for the PyBites guys, I don't see why it wouldn't work anywhere else though. They always | |
start off their newsletter annoucements with: | |
from @PyBites import newsletter | |
So I turned it into actual code that pulls their feed and opens their latest newsletter in a browser :) | |
""" | |
import webbrowser |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!python3 | |
# my first VBA macro redone in Python | |
# related article: How I got fired up about programming | |
# https://bobbelderbos.com/2016/02/fired-up-about-programming/ | |
# 1. download game here: http://juegosexcel.com/foro/viewtopic.php?t=6396 | |
# 2. (to avoid loosing a lot of time using older excel libs) save file to xlsx | |
# | |
from collections import namedtuple | |
import re |
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 collections import Counter | |
import os | |
import sys | |
from slackclient import SlackClient | |
token = os.environ.get('SLACK_TOKEN') or sys.exit('need slack api token') | |
client = SlackClient(token) | |
users = client.api_call("users.list") | |
timezones = Counter() |
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
{"achievementPoints": 14565, | |
"battlegroup": "Cyclone", | |
"calcClass": "V", | |
"class": 9, | |
"faction": 0, | |
"gender": 0, | |
"lastModified": 1519011260000, | |
"level": 110, | |
"mounts": {"collected": [{"creatureId": 32158, | |
"icon": "ability_mount_drake_blue", |
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 | |
# make venv and pip install selenium | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
# set your codechalleng.es username and password in venv/bin/activate, then source it | |
user = os.getenv('PB_USER') | |
password = os.getenv('PB_PW') |
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 pyperclip | |
def gen_affiliation_link(url): | |
if not re.search(r"amazon.*/dp/", url): | |
raise ValueError(f"{url} is not a valid Amazon product link") | |
asin = re.sub(r".*/dp/([^/]+).*", r"\1", url) |
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 concurrent.futures | |
import os | |
import re | |
from timeit import timeit | |
import requests | |
URLS = 'urls' | |
OlderNewer