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
| # Even spaces are compared! | |
| my_string1 = "h4110 w0r1d" | |
| my_string2 = "hello world" | |
| def similar(my_string1, my_string2): | |
| a = b = c = d = [] | |
| a.append(my_string1) | |
| b.append(my_string2) | |
| counter = 0 |
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 random | |
| foo = [1, 2, 3, 4, 5, 6] | |
| random_selection = lambda: random.choice(foo) | |
| random_selection() |
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 random | |
| import sys | |
| picked_num = random.randint(1, 10) | |
| counter = 5 | |
| def guess_game(counter, picked_num): | |
| while counter: | |
| try: | |
| number = int(input("Please choose a number between 1 and 10: ")) |
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 datetime | |
| import os | |
| import sys | |
| import time | |
| import urllib | |
| from colored import attr | |
| from colored import bg as background | |
| from colored import fg as foreground | |
| from googlefinance import getQuotes | |
| from time import sleep |
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 datetime | |
| import os | |
| import shutil | |
| import sys | |
| from envelopes import Envelope | |
| def mail_send(files_to_send): | |
| right_now = datetime.datetime.now() |
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
| # Using SystemRandom which is cryptographically secure[1], | |
| # this prints out 64 psuedorandom characters for you to use in whatever. | |
| # [1]https://docs.python.org/2/library/random.html | |
| # "( Use os.urandom() or SystemRandom if you require a | |
| # cryptographically secure pseudo-random number generator. )" | |
| import random | |
| import string | |
| import sys |
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 requests import get | |
| from yaml import load | |
| import sys | |
| # in a virtualenv: pip install libyaml | |
| # input is always split by a comma | |
| # if you were searching for 2 things it would be q=a,b& | |
| base = 'https://www.google.com/trends/fetchComponent?hl=en-US&q=[INPUT_HERE]&cid=TIMESERIES_GRAPH_0&export=5' |
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
| #!/usr/bin/env python3 | |
| import sys | |
| complete = False | |
| print('Ctrl+C / Ctrl+D to quit at anytime') | |
| def bmi(): | |
| try: | |
| measurement_type = input('(I)mperial or (M)etric?: ') |
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 json | |
| raw = requests.get('https://api.duckduckgo.com/?q=ip&format=json') | |
| raw_json = json.loads(raw.text) | |
| answer = raw_json["Answer"].split(' ') | |
| print (' '.join(answer[:5])) |
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
| # like this :-) | |
| # doesn't work for nested lists :-( | |
| import random | |
| my_dict = {'lol': [1, 2, 3, 4], 'wut': [5, 6, 7]} | |
| print(random.choice(sum(my_dict.values(), []))) |