Skip to content

Instantly share code, notes, and snippets.

View Vgr255's full-sized avatar

Anilyka Barry Vgr255

View GitHub Profile
Personal rating is out of 10
Before 2022 (in no particular order):
- [8] The Lost Coast [modern fantasy], Amy Rose Capetta
- [7] The Brilliant Death (Brilliant Death 1/2) [high fantasy], Amy Rose Capetta
- [6] The Storm of Life (Brilliant Death 2/2) [high fantasy], Amy Rose Capetta
- [8] Breaking Legacies [high fantasy], Zoe "Reye" Reed
- [8] Red, White & Royal Blue [romance], Casey McQuiston
- [9] One Last Stop [urban fantasy/romance], Casey McQuiston
- [6] The Long Way to a Small, Angry Planet (Wayfarers 1/4) [sci-fi], Becky Chambers
def map_users(self, users): # 'users' is the list of joined players
clients = {client: [] for client in self.secondary_clients}
maxlen = max(len(users) // len(clients) + self.threshold, 1)
unassigned = set() # using a set to get a semi-random order
for user in users:
if user in self.nick_client_mapping:
clients[self.nick_client_mapping[user]].append(user)
else:
unassigned.add(user)
Wrote down my ideas about the new IRC system for lykos. Have fun reading -Vgr
# thoughts about this new system that I talked about in -dev
# the new lykos (with this system) should be separated on at least 2 layers
# the first layer is the IRC stuff. first thing to launch, last thing to close
# when launching the process, the IRC layer is launched
# the main client is started, and as the sole running piece of code at the time, attempts to connect
# the client can handle all IRC-related things by itself, so nothing else needs to run yet
# when it's joined the channel and working, it loads the game stuff
# the main client then hooks into it, and is ready to start a game
>>> import py_builtins, builtins, inspect, os
>>> names = os._get_exports_list(py_builtins)
>>> names
['abs', 'all', 'any', 'ascii', 'bin', 'callable', 'delattr', 'dir', 'divmod', 'format', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'isinstance', 'issubclass', 'iter', 'len', 'locals', 'max', 'min', 'next', 'oct', 'pow', 'print','repr', 'round', 'setattr', 'sorted', 'sum', 'vars']
>>> builtin_names = [x for x in dir(builtins) if x.islower() and inspect.isroutine(getattr(builtins, x)) and x[0] != "_"]
>>> builtin_names
['abs', 'all', 'any', 'ascii', 'bin', 'callable', 'chr', 'compile', 'delattr', 'dir', 'divmod', 'eval', 'exec', 'format', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'isinstance', 'issubclass', 'iter', 'len', 'locals', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow', 'print', 'repr', 'round', 'setattr', 'sorted', 'sum', 'vars']
>>> sorted(set(builtin_names) ^ set(names))
['chr', 'compile', 'eval', 'exec', 'input', 'open', 'ord']
>>> r"\"
File "<stdin>", line 1
r"\"
^
SyntaxError: EOL while scanning string literal
>>> r"\""
'\\"'
>>> r"\\"
'\\\\'
>>> e = range(0, 100, 5)
>>> len(e)
20
>>> e[10]
50
>>> e[5]
25
>>> e[15]
75
>>> e[10:15:5]
import shutil
import os
def CopyFolder(src, dst, overwrite=True):
"""Copy a source directory into another. This is recursive."""
os.makedirs(dst, exist_ok=True)
for file in os.listdir(src):
if not overwrite and os.path.isfile(os.path.join(dst, file)):
class MetaRedirector(type):
instance = None
cls = None
def __new__(meta, cls, bases, clsdict):
self = type.__new__(meta, cls, bases, clsdict)
meta.__class__.cls = self
return self
def __call__(self, *args, **kwargs):
if self.__class__.instance is not None:
return self.__class__.instance
from distutils.core import setup, Extension
setup(name="LGP", version="0.1", ext_modules=[Extension("lgp", ["_lgpmodule.c"])])
child = subprocess.Popen([your_prog], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = child.communicate()