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
/* | |
* Available context bindings: | |
* COLUMNS List<DataColumn> | |
* ROWS Iterable<DataRow> | |
* OUT { append() } | |
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); } | |
* TRANSPOSED Boolean | |
* plus ALL_COLUMNS, TABLE, DIALECT | |
* | |
* where: |
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
import sys, traceback | |
def exception_hook(e, value, tb): | |
for line in traceback.TracebackException( | |
type(value), value, tb, capture_locals=True | |
).format(chain=True): | |
print(line, end="") | |
sys.excepthook = exception_hook |
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
- name: Make sure only three files exist in /myfolder | |
declarative: | |
items: | |
- a | |
- b | |
- c | |
state: | |
command: find /myfolder/ | tail -n +2 | basename | |
extra_item: | |
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
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
import string | |
from weakref import WeakKeyDictionary | |
class SafeDict(dict): | |
def __missing__(self, key): | |
return '{' + key + '}' |
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
import asyncio | |
import collections | |
async def ratelimit(*, max_request, in_interval): | |
slots = collections.deque() | |
while True: | |
slots.append(time() + in_interval) | |
yield | |
while len(slots) >= max_request: | |
left = slots[0] - time() |
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
from contextvars import ContextVar | |
import asyncio | |
import random | |
cv = ContextVar('cv') | |
async def waiting_func(name): | |
print(f'{name} Before sleep: {cv.get() == name}') |
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
async def message_handler(message: DubtrackMessage): | |
print(f'Received {message.text}') | |
# await message.channel.say('Bot speaking here') | |
def run_bot(): | |
# Setup | |
bot = Bot() | |
dubtrack_backend = DubtrackBotBackend() | |
dubtrack_backend.configure() |
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
WARNING:abot.bot:No message handler for <DubtrackUserUpdate <DubtrackEntity None#560b135c7ae1ea0300869b20 379/1680 0(S) ##0> skip#0 played#1680 queue#0 dubs#379> | |
WARNING:abot.bot:No message handler for <DubtrackDub#updub <DubtrackEntity txomon#560b135c7ae1ea0300869b20 379/1680 0(S) ##0> +1-0> |
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
INFO:dubtrack.layer3:User updated 5628edc08d7d6a5600335d3d, skip 0, played 23898, queue 30, dubs 25899 | |
INFO:dubtrack.layer3:Chat txomon: so I have been able to more or less finish the bindings | |
INFO:dubtrack:Now playing youtube#8-wIg90lagk: Batman Begins Soundtrack - Corynorhinus | |
INFO:dubtrack.layer3:Chat txomon: and I need to generate some actions more to be able to map all the possible ones | |
INFO:dubtrack.layer3:Chat txomon: so if you see I do strange stuff, it's true xD | |
INFO:dubtrack.layer3:Chat txomon: I am just testing | |
INFO:dubtrack.layer3:Chat eva_MoS: Short version:beware, he´s watching all of us | |
INFO:dubtrack.layer3:Chat eva_MoS: ;-P | |
INFO:dubtrack.layer3:User updated 562e462b888e6f1900ff20bc, skip 0, played 28988, queue 42, dubs 30136 | |
INFO:dubtrack.layer3:Song updub by eva_MoS#562e462b888e6f1900ff20bc, total 1U/0D |
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
DEBUG:root:Sending ping | |
DEBUG:root:Sending message 2 | |
DEBUG:root:Received pong | |
DEBUG:root:Received message: 4{"action":15,"channel":"room:561b1e59c90a9c0e00df610b","message":{"name":"user-join","type":"json","data":"{\"roomUser\":{\"_id\":\"5628db0a3883a45600b7e68f\",\"updated\":1518739898666,\"skippedCount\":0,\"playedCount\":1677,\"songsInQueue\":0,\"active\":false,\"dubs\":364,\"order\":999999999,\"roomid\":\"561b1e59c90a9c0e00df610b\",\"userid\":\"560b135c7ae1ea0300869b20\",\"_user\":\"560b135c7ae1ea0300869b20\",\"__v\":0,\"ot_token\":null,\"authorized\":true,\"queuePaused\":null,\"waitLine\":0,\"roleid\":{\"_id\":\"52d1ce33c38a06510c000001\",\"type\":\"mod\",\"label\":\"Moderator\",\"rights\":[\"skip\",\"queue-order\",\"kick\",\"ban\",\"mute\",\"set-dj\",\"lock-queue\",\"delete-chat\",\"chat-mention\"],\"__v\":0}},\"user\":{\"_force_updated\":1516971162191,\"userInfo\":{\"_id\":\"560b135c7ae1ea0300869b21\",\"userid\":\"560b135c7ae1ea0300869b20\",\"__v\":0},\"_id\":\"560b135c7ae1ea0300869b20\",\"username\" |
NewerOlder