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
#!/usr/bin/env python3 | |
from datetime import datetime as DateTime | |
from pathlib import Path | |
from shutil import copy2, rmtree | |
MINECRAFT_ROOT = Path('/opt/minecraft') | |
def take_backup(target, storage, files): |
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
#!/usr/bin/env python3 | |
'''Control Access List Interface | |
This module provides an interface to iMail's CAL file format (.ACC). This | |
format is most significantly used in the `POP3d32.acc` file, located within | |
iMail's installation directory. The file itself controls which IP addresses or | |
IP address ranges are blacklisted or whitelisted for IMAP/POP access. | |
Another significant file is the `smtpd32.acc` file. This file controls which IP |
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
# Standard library imports | |
from datetime import datetime | |
from pathlib import Path | |
from pickle import dumps, loads | |
class CachedObject: | |
def __init__(self, value): | |
self.value = value | |
self.cached_at = datetime.now() |
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
# Standard library imports | |
from time import time | |
# Third-party imports | |
from humanfriendly import format_timespan | |
class Progress: | |
def __init__(self, total): |
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
# Standard library imports | |
import base64 | |
import io | |
import pathlib | |
import zipfile | |
def pack_files(file_names): | |
zip_buffer = io.BytesIO() | |
with zipfile.ZipFile(zip_buffer, 'w', zipfile.ZIP_LZMA) as zip_file: |
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
# Standard library imports | |
import re | |
# Third-party imports | |
import editdistance | |
import unidecode | |
def convert_to_expression(string): | |
patterns = ['\w', '\s'] | |
expression = '' |
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
# Standard library imports | |
import threading | |
import queue | |
class ConcurrentFunction: | |
def __init__(self, function, args=(), kwargs={}): | |
self.function = function | |
self.args = args | |
self.kwargs = kwargs |
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
# Standard-library imports | |
from random import Random | |
VOWELS = 'aeiou' | |
CONSONANTS = 'bcdfghjklmnpqrstvwxyz' | |
def get_seeded_name(seed, length=8): | |
random = Random(seed) | |
word = '' |
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
# Standard library imports | |
import ctypes | |
# Keyboard scan codes | |
SCANCODE_ESCAPE = 0x01 | |
SCANCODE_1 = 0x02 | |
SCANCODE_2 = 0x03 | |
SCANCODE_3 = 0x04 | |
SCANCODE_4 = 0x05 | |
SCANCODE_5 = 0x06 |
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
# Standard library imports | |
import logging | |
import json | |
def load_document(string): | |
document = None | |
try: | |
document = json.loads(string) | |
except: |
NewerOlder