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
# Make sure to pip install pyperclip and colorama. | |
# Because output is better with color! | |
import pyperclip | |
from colorama import Fore | |
def main(): | |
print(Fore.WHITE + "-----------------------------") | |
print(Fore.WHITE + " URLIFY ") | |
print(Fore.WHITE + "-----------------------------") |
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
# Requirements: | |
# aiohttp | |
# aiodns | |
# cchardet | |
# requests | |
# unsync | |
import asyncio | |
from unsync import unsync |
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
# Here is an example of some syntax I'm proposing: | |
# See the github repo at https://github.com/mikeckennedy/python-switch | |
def test_switch(): | |
num = 7 | |
val = input("Enter a key. a, b, c or any other: ") | |
with Switch(val) as s: | |
s.case('a', process_a) | |
s.case('b', process_b) |
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
symbol | open | high | low | close | volume | |
---|---|---|---|---|---|---|
AAL | 49 | 49.1 | 48.47 | 48.63 | 11901883 | |
AAPL | 145.13 | 147.16 | 145.11 | 146.28 | 33917635 | |
ADBE | 143.75 | 145.59 | 143.06 | 145.41 | 3383524 | |
AMZN | 1002.54 | 1004.62 | 998.02 | 1003.74 | 2832807 | |
GOOGL | 975.5 | 986.62 | 974.46 | 986.09 | 1524905 | |
MAT | 20.22 | 20.75 | 20.11 | 20.68 | 10603967 | |
MSFT | 70.09 | 71.25 | 69.92 | 71.21 | 26803888 | |
NTES | 320 | 333.78 | 319 | 333.56 | 1356386 |
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 collections | |
Stock = collections.namedtuple('Stock', 'symbol, open, high, low, close, volume') | |
stocks = [ | |
Stock('AAL', 49, 49.1, 48.47, 48.63, 11901883), | |
Stock('AAPL', 145.13, 147.16, 145.11, 146.28, 33917635), | |
Stock('ADBE', 143.75, 145.59, 143.06, 145.41, 3383524), | |
Stock('AMZN', 1002.54, 1004.62, 998.02, 1003.74, 2832807), | |
Stock('GOOGL', 975.5, 986.62, 974.46, 986.09, 1524905), |
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
# Original version | |
def main(): | |
name = print_intro() | |
the_list = bash_list.commands | |
flag='1' | |
while flag=='1': | |
random.shuffle(the_list) | |
correct, incorrect, answer_list = question_loop(the_list) | |
percentage = calculate_stats(correct, incorrect) | |
print_results(correct, incorrect, percentage, name) |
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
try: | |
from xml.etree.cElementTree import XML | |
except ImportError: | |
from xml.etree.ElementTree import XML | |
import zipfile | |
""" | |
Module that extract text from MS XML Word document (.docx). | |
(Inspired by python-docx <https://github.com/mikemaccana/python-docx>) |
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
# requires request and Python 3 | |
import requests | |
import sys | |
import os | |
from xml.etree import ElementTree | |
def main(): | |
rss_url = 'https://pythonbytes.fm/episodes/rss' | |
resp = requests.get(rss_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
# Setup a virtual environment (running Python 3.5 foundation) | |
python -m venv ~/.python3_venv | |
# Activate the virtual environment | |
source ~/.python3_venv/bin/activate | |
# Install a few dependencies needed to bootstrap things | |
pip install setuptools nose mailchimp | |
# Register the website package (pyramid web app) as a package |
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
# Parse this busted file: | |
# | |
# A,B,C,D,E, | |
# A,B,C,D,E, | |
# A,B,C,D,E, A,B,C,D,E, | |
# | |
# A,B,C,D,E, | |
# A,B,C,D,E, | |
data = [] |