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 math | |
# note: this can easily be implemented using conditions, but I like leveraging math for it instead | |
# map input to 1 (when a = x), other values (a != x) to 0; domain is ASCII table values (0-255) | |
# 0.0001 should be an arbitrarily small number approaching 0 to prevent dividing by zero error when x=a | |
def f(x, a): | |
return math.floor(1 - ( abs(x-a)/(abs(x-a) + 0.0001) )) | |
def decode(character): |
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
#!/bin/bash | |
USER="your-username" | |
curl -s https://api.github.com/users/$USER/repos | grep "https://github.com/[a-zA-Z0-9-]*/[a-zA-Z0-9-]*.git" -o | xargs -n1 git clone |
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, threading, logging | |
class Progress_Bar: | |
""" | |
Maintain an easily identifiable progress bar(live updates to the CLI), along with important progress information all encapsulated in one object. | |
""" | |
logger = logging.getLogger("progress_logger") | |
logger.setLevel(logging.DEBUG) | |
logging.basicConfig(filename="app.log", filemode="w", format="%(asctime)s %(levelname)s:%(funcName)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S") |