Proof of Concept of using Python+Async to connect to a server over SSH.
Requires:
- Python >= 3.6
msgpack
tornado<5
Run client.py
, assumes you're running ssh-server on localhost and that you can log in to it.
import collections.abc | |
import pathlib | |
__all__ = ('root',) | |
class AttrsView(collections.abc.KeysView): | |
def __init__(self, root): | |
self._root = pathlib.Path(root) |
import functools | |
from gi.repository import GObject | |
from gi.repository import Gio | |
from gi.repository import GLib | |
def runloop(func): | |
@functools.wraps(func) | |
def wrapped(*pargs, **kwargs): | |
func(None) |
Proof of Concept of using Python+Async to connect to a server over SSH.
Requires:
msgpack
tornado<5
Run client.py
, assumes you're running ssh-server on localhost and that you can log in to it.
#!/usr/bin/env python3 | |
""" | |
A little script to make minimal pyz packages for zipsafe programs. | |
NOTE: zip safe means: | |
* No package expects to be able to use open() to access data it shipped with | |
* No compiled modules | |
""" | |
import argparse | |
import os |
I hereby claim:
To claim this, I am signing this object:
import asyncio | |
async def say(what, when): | |
await asyncio.sleep(when) | |
print(what) | |
# print() is already buffered by Python, IPC Pipes, etc | |
# You should still async it, but it's only going to bite | |
# when other things go wrong. |
#!/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)] |
### 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: |
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. | |
""" |
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 |