N̷̪̞͈̓̀̒ͅi̵̩̺̋̊̀̆̿̂͊̇s̷͚͕͙͈̙̻̀̓͛̇͐͗̿̈̿͠ͅḧ̵͍̻́̑̽̆̇͂̈̈́a̴̧̡͈̥̜͑̄͆ͅń̶̨̧̹̤͍̹̙͛̓͘͜ͅt̵͖̳̣͎̦̰̱̖̬̐̐̓͂͆͠ͅh̴̢̨̛͇̘̪͖̼͚̋̌͂̀̅̍̀̕̚ͅͅ ̷̹͕̩̮̇̾̈̈̐͝ͅR̸͖̀͊̀̎͊́͛̒͘͘ę̴̟͍̣̻͈̮̝̫̞͘d̴͓̺̺̙͖̥̫̣͕̈́͛̅̍͑d̶̜̰̠͓̦̳̟̤̀̿̕y̵̩̮̿̎͐̍̃̃̚͝͠ remidinishanth-ntnx
🎯
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 | |
| from datetime import datetime, timezone | |
| import os | |
| def utc_now(): | |
| # utcnow returns a naive datetime, so we have to set the timezone manually <sigh> | |
| return datetime.utcnow().replace(tzinfo=timezone.utc) | |
| class Terminator: | |
| pass |
In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So ⌘ + D does not mean hold shift. ⌘ + Shift + D does of course.
| Function | Shortcut |
|---|---|
| New Tab | ⌘ + T |
| Close Tab or Window | ⌘ + W (same as many mac apps) |
| Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
| Go to Split Pane by Direction | ⌘ + Option + Arrow 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
| #!/usr/bin/env python2 | |
| from threading import Event, Thread | |
| class Periodic(object): | |
| """Periodically run a function with arguments asynchronously in the background | |
| Period is a float of seconds. | |
| Don't expect exact precision with timing. | |
| Threading is used instead of Multiprocessing because we need shared memory |
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 logging | |
| import threading | |
| class PeriodicThread(object): | |
| """ | |
| Python periodic Thread using Timer with instant cancellation | |
| """ | |
| def __init__(self, callback=None, period=1, name=None, *args, **kwargs): |