This file contains hidden or 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 hidden or 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 ctypes | |
| import enum | |
| import logging | |
| import os | |
| import socket | |
| import struct | |
| import sys | |
| try: | |
| import tenacity.retry |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| <profiles version="1"> | |
| <profile kind="CodeFormatterProfile" name="Linux Kernel" version="1"> | |
| <setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> | |
| <setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> | |
| <setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> | |
| <setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/> | |
| <setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/> | |
| <setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/> | |
| <setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/> |
This file contains hidden or 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
| root@3c0f8c6a25c9:/srv/attitude_adjustment# make menuconfig V=s | |
| make[1]: Entering directory `/srv/attitude_adjustment/scripts/config' | |
| zconf.tab.o: In function `zconflex': | |
| zconf.tab.c:(.text+0x21c1): undefined reference to `kconf_id_lookup' | |
| zconf.tab.c:(.text+0x2313): undefined reference to `kconf_id_lookup' | |
| collect2: ld returned 1 exit status | |
| make[1]: *** [conf] Error 1 | |
| make[1]: Leaving directory `/srv/attitude_adjustment/scripts/config' | |
| make: *** [scripts/config/mconf] Error 2 |
This file contains hidden or 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 hidden or 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 hidden or 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() |
NewerOlder