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
| #!/usr/bin/python3 | |
| import random | |
| import itertools | |
| rand = random.SystemRandom() | |
| def roll(num, *, reroll=False, explosions=False): | |
| dice = [rand.randint(1, 10) for _ in range(num)] |
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
| ### Keybase proof | |
| I hereby claim: | |
| * I am astronouth7303 on github. | |
| * I am astronouth7303 (https://keybase.io/astronouth7303) on keybase. | |
| * I have a public key ASDEQCONquDJhr5_YYK4Qf-mWqC1B7XxJcspUTIzW0lecQo | |
| To claim this, I am signing this object: |
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 time | |
| import requests | |
| def _stream_raw_sse(*pargs, _last_event_id=None, headers=None, **kwargs): | |
| """ | |
| Streams Server-Sent Events, each event produced as a sequence of | |
| (field, value) pairs. | |
| Does not handle reconnection, etc. | |
| """ |
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
| 2017-07-19 17:12:49,055 [salt.minion ][INFO ][29846] Starting a new job with PID 29846 | |
| 2017-07-19 17:12:49,713 [salt.state ][INFO ][29846] Loading fresh modules for state activity | |
| 2017-07-19 17:12:49,974 [salt.fileclient ][INFO ][29846] Fetching file from saltenv 'base', ** done ** 'test_state.sls' | |
| 2017-07-19 17:12:49,980 [salt.loaded.int.module.logmod ][ERROR ][29846] Start pillar | |
| 2017-07-19 17:12:49,980 [salt.loaded.int.module.logmod ][ERROR ][29846] {} | |
| 2017-07-19 17:12:49,981 [salt.loaded.int.module.logmod ][ERROR ][29846] End pillar |
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
| $XONSH_SHOW_TRACEBACK = True | |
| $PROJECT_DIRS = g`~/code` + g`~/src` | |
| xontrib load vox prompt_ret_code avox z | |
| xontrib load schedule salt | |
| $PATH = g`~/.conda/bin` + g`~/.local/bin` + list($PATH) | |
| ${...}.pop('COLUMNS', None) | |
| ${...}.pop('ROWS', None) |
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
| class Top: | |
| @property | |
| def foo(self): | |
| ... | |
| @foo.setter | |
| def set_foo(self, value): | |
| ... | |
| class Spam(Top): | |
| @property |
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 time | |
| import os | |
| import ctypes | |
| import ctypes.wintypes | |
| PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe | |
| PeekNamedPipe.restype = ctypes.wintypes.BOOL | |
| def try_peek(pipe, desc=''): | |
| lpTotalBytesAvail = ctypes.wintypes.DWORD(0) |
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 abc import ABC | |
| from collections.abc import Set, Iterable | |
| from itertools import count | |
| class Base(Iterable, ABC): | |
| def __iter__(self): | |
| yield from [] | |
| def mk(klass): | |
| return type('x', (klass,), {})() |
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 django import forms | |
| from localflavor.us.forms import USPSSelect | |
| class NoDefaultSelect(forms.Select): | |
| def render_options(self, selected_choices): | |
| opts = super().render_options(selected_choices) | |
| if selected_choices: | |
| opts = "<option disabled selected value style='display:none;'></option>\n" + opts | |
| return opts |
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
| class ErrorCounter(collections.Counter): | |
| """ | |
| Repeatable context manager. Counts the types of errors when exiting. | |
| Note that expected exceptions are surpressed. | |
| Generally, replaces constructs like: | |
| for egg in spam(): | |
| try: |