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 time | |
from rdpy.protocol.rdp import rdp | |
from twisted.internet import reactor | |
class MyRDPFactory(rdp.ClientFactory): | |
def clientConnectionLost(self, connector, reason): | |
reactor.stop() |
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
""" | |
Sample Application | |
Usage: | |
sample [options] | |
Options: | |
-h --help Show this screen. | |
""" | |
import aumbry |
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
# See also: | |
# | |
# * https://asgi.readthedocs.io/en/latest/specs/www.html#websocket | |
# * https://developer.mozilla.org/en-US/docs/Web/API/Websockets_API | |
# | |
import falcon.asgi | |
import falcon.media | |
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
def enable_echo(enable): | |
fd = sys.stdin.fileno() | |
new = termios.tcgetattr(fd) | |
if enable: | |
new[3] |= termios.ECHO | |
else: | |
new[3] &= ~termios.ECHO | |
termios.tcsetattr(fd, termios.TCSANOW, new) |
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 json | |
import simdjson | |
import libpy_simdjson | |
decoder_std = json.JSONDecoder() | |
encoder_std = json.JSONEncoder(ensure_ascii=False) | |
p = simdjson.Parser() | |
p2 = libpy_simdjson.Parser() |
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 httpx | |
import time | |
async def do_work_async(): | |
http = httpx.AsyncClient() | |
while True: | |
resp = await http.get('https://httpbin.org/status/202') |
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 aiobotocore.session | |
import aiobotocore.config | |
async def example(): | |
# Equivalent to boto3.client('s3', config=botocore.client.Config(**kwargs)) | |
# See also for available options: | |
# * https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html |
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 functools | |
import signal | |
import sys | |
import time | |
async def worker(shutdown_event): | |
try: | |
while True: |
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
redis-server --save "" --appendonly no |
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
# https://stackoverflow.com/a/30029855/21784 | |
listening() { | |
if [ $# -eq 0 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | |
elif [ $# -eq 1 ]; then | |
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1 | |
else | |
echo "Usage: listening [pattern]" | |
fi | |
} |