Skip to content

Instantly share code, notes, and snippets.

View Avlyssna's full-sized avatar

Dennis Avlyssna

  • Omnipresent
  • 11:11 (UTC -05:00)
View GitHub Profile
@Avlyssna
Avlyssna / backupMinecraft.py
Created January 4, 2021 01:21
A simple Python script to provide lightweight backup operations for Minecraft worlds and playerdata.
#!/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):
@Avlyssna
Avlyssna / cali.py
Last active September 24, 2019 17:36
An interface built for iMail's CAL format
#!/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
# 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()
# Standard library imports
from time import time
# Third-party imports
from humanfriendly import format_timespan
class Progress:
def __init__(self, total):
# 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:
# Standard library imports
import re
# Third-party imports
import editdistance
import unidecode
def convert_to_expression(string):
patterns = ['\w', '\s']
expression = ''
# Standard library imports
import threading
import queue
class ConcurrentFunction:
def __init__(self, function, args=(), kwargs={}):
self.function = function
self.args = args
self.kwargs = kwargs
# Standard-library imports
from random import Random
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
def get_seeded_name(seed, length=8):
random = Random(seed)
word = ''
# 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
# Standard library imports
import logging
import json
def load_document(string):
document = None
try:
document = json.loads(string)
except: