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 time | |
from PIL import Image, ImageFilter | |
def do_thing(duration:int=1): | |
print(f"Sleeping for {duration} second") | |
time.sleep(duration) | |
print("Done sleeping") | |
return "success" | |
def process_image(img_name): |
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 time | |
import threading | |
import concurrent.futures | |
start = time.perf_counter() | |
def do_thing(duration:int): | |
print(f"Sleeping for {duration} second") | |
time.sleep(duration) | |
print("Done sleeping") |
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 datetime | |
from pymongo import MongoClient | |
from bson.objectid import ObjectId | |
clust = MongoClient("mongodb://localhost:27017/") | |
print(clust) | |
db = clust["intro"] | |
print(db) | |
coll = db["introdb"] |
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 praw | |
import datetime | |
class RedditPuller(): | |
def __init__(self, *args, **kwargs): | |
pass | |
def reddit_oauth(self): | |
""" | |
Method required by bearer token authentication. |
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
# Code snippets stolen from different SO threads and put together to accomplish variable checking in functions | |
import sys | |
from types import FunctionType | |
from gc import get_referents | |
def sizeof_fmt(num, suffix='B'): | |
''' by Fred Cirera, https://stackoverflow.com/a/1094933/1870254, modified''' | |
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: | |
if abs(num) < 1024.0: |
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 twitter | |
import twitter_config # Local file used to store private data like keys, etc. | |
api = twitter.Api(consumer_key=twitter_config.consumer_key, | |
consumer_secret=twitter_config.consumer_secret, | |
access_token_key=twitter_config.access_token_key, | |
access_token_secret=twitter_config.access_token_secret) | |
if api.GetStatus(1217704947225108481).current_user_retweet: |
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 | |
API_KEY = "" | |
def create_champion_mapping(): | |
champ_map = dict() | |
champion_json = requests.get("http://ddragon.leagueoflegends.com/cdn/9.22.1/data/en_US/champion.json") | |
for champion in champion_json.json()['data']: | |
key = champion_json.json()['data'][champion]['key'] | |
champ_map[key] = champion_json.json()['data'][champion]['id'] |
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
const Faker = require("faker"); | |
function fakeProducts(int){ | |
for (let i = 0; i < int; i++){ | |
console.log(Faker.commerce.productName() + " - $" + Faker.commerce.price()); | |
}; | |
}; | |
fakeProducts(10); |
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
function echo(word, x){ | |
for (i = 0; i < x; i++){ | |
console.log(word); | |
}; | |
}; | |
echo("Echo!!", 10); | |
echo("Tater tots", 3); | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Score Keeper</title> | |
</head> | |
<body> | |
<h1 id="scoreboard"> |
NewerOlder