Skip to content

Instantly share code, notes, and snippets.

View Zomatree's full-sized avatar
:fishsticks:

Angelo Kontaxis Zomatree

:fishsticks:
View GitHub Profile
(lambda YTDLSource, coroutine, config, discord, random, math, re, logging, _import, sqlite3, asyncio, token, commands, regex, bot: [logging.basicConfig(level=logging.INFO),bot.load_extension("jishaku"),bot.event(coroutine(lambda: print("Ready!"))),bot.command(name="hello")(coroutine(lambda ctx: ctx.send("hello world"))),(lambda mention:(lambda temp_command: [setattr(temp_command, "__annotations__", {"user": discord.Member}),setattr(temp_command, "_doc__", "mentions someone"),setattr(mention, "callback", temp_command),mention.error(coroutine(lambda ctx, error: ctx.send("error" if not isinstance(error, commands.MissingRequiredArgument) else "no `user` arg, please pass one, thank u"))),])(lambda ctx, user: ctx.send(user.mention)))(bot.command(name="mention")(coroutine(lambda ctx, user: ()))),bot.command(name="8ball")(coroutine(lambda ctx, *, args: ctx.send(random.choice(["yes", "no", "idk", "shrug"])))),bot.command(name="quad")(coroutine(lambda ctx, *, args: ctx.send((lambda match: f"{-int(match[2])+math.sqrt((i
import string
class CyclicList(list):
def __getitem__(self, x):
index = x.__index__()
return super().__getitem__(index % len(self))
l = CyclicList(string.ascii_lowercase+string.punctuation+string.whitespace)
inp = input("Enter text: ").lower()
# n1
read_file = (lambda filename: (lambda file: [list(__import__("csv").reader(file)), file.__exit__()][0])(open(filename).__enter__()))
print(read_file("test.csv"))
# n2
print(read_file("test.csv")[1][1])
# n3
print(list(map(lambda r: list(map(float, r)), read_file("test.csv"))))
@Zomatree
Zomatree / oneliners.py
Last active October 18, 2020 02:23
Random one-line stuff
# simple recursive func maker
y = (lambda f: lambda *args: f(f, *args))
# fibinaci sequance
fib = y(lambda func, n: n if n <= 1 else func(func, n-1) + func(func, n-2))
# fizz buzz
fizzbuzz = lambda num: print('\n'.join([("".join([v for k,v in {3: "fizz", 5: "buzz"}.items() if i % k == 0]) or str(i)) for i in range(1, num+1)]))
# one line asyncio.coroutine because asyncio.coroutine is depricated
[(lambda inp: [print("output:", [lambda re: "\n"+"".join([(match.groups()[1] if not match.groups()[1] == "​" else "\n")*int(match.groups()[0]) for match in re.finditer(r"([0-9]+)(.)", input("> "))]),lambda re:"".join(["".join([f"{a.span()[1]-a.span()[0]}{a.groups()[0]}" for a in re.finditer(r"(.)\1*", input("> "), re.DOTALL) if a.groups()[0] != "\n"])+"1​" for _ in range(int(input("how many lines is it?\n> ")))]),lambda _: quit()][inp-1](__import__("re")))])(int(input("1. rle to ascii art\n2. ascii art to rle\n3. quit\n> "))), input()]
@Zomatree
Zomatree / oneline.py
Last active December 1, 2019 00:24
fucking hell to make
(lambda:[globals().update(set_var=lambda k, v: globals().__setitem__(k, v)),set_var("_import", lambda module: set_var(module, __import__(module))),_import("config"),_import("discord"),_import("random"),_import("asyncio"),_import("youtube_dl"),_import("math"),_import("re"),_import("logging"),_import("sqlite3"),set_var("TOKEN", config.token),set_var("commands", __import__("discord.ext", globals(), locals(), ["commands"]).commands),set_var("regex", r"(-?\d+)x\^2([+-]\d+)x([+-]\d+)"),setattr(youtube_dl.utils, "bug_reports_message", lambda: ''),set_var("ytdl_format_options", {'format': 'bestaudio/best','outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s','restrictfilenames': True,'noplaylist': True,'nocheckcertificate': True,'ignoreerrors': False,'logtostderr': False,'quiet': True,'no_warnings': True,'default_search': 'auto','source_address': '0.0.0.0'}),set_var("ffmpeg_options", {'options': '-vn'}),set_var("ytdl", youtube_dl.YoutubeDL(ytdl_format_options)),set_var("CustomContext", type("LShiftContext", (commands.C
(lambda sqlite3, asyncio, token, commands, regex, bot:[ globals().update(set_var=lambda k, v: globals().__setitem__(k, v)), set_var("_import", lambda module: set_var(module, __import__(module))), _import("config"), _import("discord"), _import("random"), _import("math"), _import("re"), _import("logging"),logging.basicConfig(level=logging.INFO),bot.load_extension("jishaku"),bot.command(name="hello")(asyncio.coroutine(lambda ctx: ctx.send("hello world"))),set_var("mention", bot.command(name="mention")(asyncio.coroutine(lambda ctx, user: ()))), set_var("temp_command", lambda ctx, user:ctx.send(user.mention)), setattr(temp_command, "__annotations__", {"user": discord.Member}), setattr(temp_command, "_doc__", "mentions someone"), setattr(mention, "callback", temp_command),mention.error(asyncio.coroutine(lambda ctx, error: ctx.send("error" if not isinstance(error, commands.MissingRequiredArgument) else "no `user` arg, please pass one, thank u"))), bot.command(name="8ball")(asyncio.coroutine(lambda ctx, *, args:ctx.s
@Zomatree
Zomatree / gist:5840b33284e87645e43719284539d97c
Created October 25, 2019 23:47
actioneer command class example
class server:
def purge(self, amount: int):
"""Purges an amount of messages from the channel"""
class config:
"""All the config for the server"""
def staff(self, role):
"""All the config for the server"""
class raid: