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
/** | |
* Reddit Gag Userstyle | |
* | |
* by ievans3024 | |
* | |
* For when you just need to prevent yourself from getting into arguments with idiots. | |
* This style hides all reply/submit/comment forms and links, except in existing private messages. | |
*/ | |
@namespace url(http://www.w3.org/1999/xhtml); |
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
/** | |
* Reddit Comment Hider Userstyle | |
* | |
* by ievans3024 | |
* | |
* For when you just need to prevent yourself from getting into arguments with idiots. | |
* This style hides all comment sections in all posts. | |
*/ | |
@namespace url(http://www.w3.org/1999/xhtml); |
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 | |
""" | |
A small module extending timedelta. | |
Provides a method to print a formatted | |
string detailing elapsed time in the given delta | |
""" | |
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 logging | |
# keep in mind that the lower the number, the more verbose the log output | |
# everything greater than that number will also print | |
logging.DEBUG_PLUS = 5 # more verbose debug | |
logging.INFO_PLUS = 15 # more verbose info | |
logging.WARNING_PLUS = 25 # more verbose warning | |
logging.ERROR_PLUS = 35 # more verbose error | |
logging.CRITICAL_PLUS = 45 # more verbose critical |
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
""" | |
A demonstration of how to control stdout verbosity with argparse and logging. | |
Examples of running this file and its expected output: | |
$ python verbosity.py | |
CRITICAL :: A critical message. | |
$ python verbosity.py -v | |
CRITICAL :: A critical message. |
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
"""Proving Jeremy wrong, indentation experimentation""" | |
def four(): | |
# indented with 4 spaces | |
return 4 | |
def three(): | |
# indented with 3 spaces | |
return 3 |
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 struct | |
""" | |
An overengineered way to get what 1-based index a letter is in the roman alphabet | |
""" | |
class AlphaBytes: | |
UPPERCASE = set([struct.pack('>b', i) for i in range(65, 91)]) | |
LOWERCASE = set([struct.pack('>b', i) for i in range(97, 123)]) |
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 logging | |
LOG_LEVELS = [ | |
logging.CRITICAL, | |
logging.ERROR, | |
logging.WARNING, | |
logging.INFO, | |
logging.DEBUG | |
] |
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 curses | |
from argparse import ArgumentParser | |
from datetime import datetime | |
from time import sleep | |
ON = '\N{BLACK CIRCLE}' | |
OFF = '\N{WHITE CIRCLE}' | |
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 configparser import * | |
# copypasta from configparser source | |
# see https://github.com/python/cpython/blob/3.8/Lib/configparser.py#L357 | |
_UNSET = object() | |
class ConfigParser(ConfigParser): | |
def __init__(self, *args, sectionless=False, strip_quotes=False, **kwargs): | |
self.__sectionless = sectionless |
OlderNewer