Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Trio+Asterisk-ARI

Matthias Urlichs smurfix

💭
Trio+Asterisk-ARI
View GitHub Profile
View gist:663b1004721d86aaf676bbe4c71ee303
diff --git a/src/Host.cpp b/src/Host.cpp
index 73df2d40..10103f95 100644
--- a/src/Host.cpp
+++ b/src/Host.cpp
@@ -2598,3 +2598,13 @@ void Host::setCompactInputLine(const bool state)
}
}
}
+
+QPointer<TConsole> Host::findConsole(QString name)
@smurfix
smurfix / result_taskgroup.py
Last active Jul 15, 2020
anyio ResultGatheringTaskgroup
View result_taskgroup.py
import anyio
from contextlib import asynccontextmanager
class NotYet(RuntimeError):
pass
class ResultGatheringTaskgroup:
def __init__(self):
self.result = []
@smurfix
smurfix / crash.logcat
Last active Feb 4, 2020
Fairphone 3. Reproducible by opening Settings and starting any app, basically. "Files" will do it.
View crash.logcat
02-04 18:45:04.978 21417 23932 E ChromeSync: [Sync,SyncAdapter] Failed to sync.
02-04 18:45:04.978 21417 23932 E ChromeSync: rfa: Error when calling the server (message: deadline exceeded after 9.997384271s. [buffered_nanos=9999504632, waiting_for_connection]).
02-04 18:45:04.978 21417 23932 E ChromeSync: at rjq.b(:com.google.android.gms@20104037@20.1.04 (120400-288960190):93)
02-04 18:45:04.978 21417 23932 E ChromeSync: at rjk.a(:com.google.android.gms@20104037@20.1.04 (120400-288960190):25)
02-04 18:45:04.978 21417 23932 E ChromeSync: at tcl.onPerformSync(:com.google.android.gms@20104037@20.1.04 (120400-288960190):9)
02-04 18:45:04.978 21417 23932 E ChromeSync: at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:334)
02-04 18:45:04.978 21417 23932 E ChromeSync: Caused by: ciwd: DEADLINE_EXCEEDED: deadline exceeded after 9.997384271s. [buffered_nanos=9999504632, waiting_for_connection]
02-04 18:45:04.978 21417 23932 E ChromeSync: at ciwc.c(:com.google.android.g
@smurfix
smurfix / mux.py
Last active Sep 7, 2021
example code for a multiplexing client/server protocol
View mux.py
#!/usr/bin/python3
"""
This is example code for a multiplexing client/server protocol.
Missing:
* server capacity management
* actual testcases for error propagation and cancellation
* handle badly-formatted messages without crashing the server
* sending more than one request or reply per interaction
View work queue
import trio
import random
from collections import deque
WORKER_COUNT = 10
tasks = range(103)
class WorkQueue:
def __init__(self, workers):
View res.bad.txt
5085 epoll_wait(4, [{EPOLLIN, {u32=2073779616, u64=94444109651360}}], 19, -1) = 1
5085 clock_gettime(CLOCK_REALTIME, {tv_sec=1536855916, tv_nsec=703944629}) = 0
5085 clock_gettime(CLOCK_MONOTONIC, {tv_sec=94121, tv_nsec=513469495}) = 0
5085 clock_gettime(CLOCK_BOOTTIME, {tv_sec=94121, tv_nsec=513573837}) = 0
5085 recvmsg(18, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\0\1(\0\0\0\2\0\0\0\271\0\0\0\1\1o\0\31\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 24
5085 recvmsg(18, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/resolve1\0\0\0\0\0\0\0\3\1s\0\17\0\0\0ResolveHostname\0\2\1s\0 \0\0\0org.freedesktop.resolve1.Manager\0\0\0\0\0\0\0\0\6\1s\0\30\0\0\0org.freedesktop.resolve1\0\0\0\0\0\0\0\0\10\1g\0\4isit\0\0\0\0\0\0\0\7\1s\0\10\0\0\0:1.16495\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\0api.tumblr.com\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=224}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DO
@smurfix
smurfix / trio_graceful_shutdown.py
Last active Jul 31, 2018 — forked from sorcio/trio_graceful_shutdown.py
graceful service shutdown with Trio
View trio_graceful_shutdown.py
from itertools import count
import signal
from async_generator import asynccontextmanager
import trio
async def monitor(self, task_status):
with trio.catch_signals({signal.SIGTERM}) as signal_aiter:
async with trio.open_nursery() as nursery:
task_status.started(nursery)
@smurfix
smurfix / compat.py
Last active Jul 27, 2018 — forked from vxgmichel/compat.py
Asyncio/Curio/Trio compatibility module
View compat.py
import asyncio
try:
import curio
except ImportError:
curio = None
try:
import trio
except ImportError:
@smurfix
smurfix / gist:65d7488aaab838f5b173af7cde7a3a9e
Created Feb 21, 2018
Single-step through trio without falling asleep
View gist:65d7488aaab838f5b173af7cde7a3a9e
--- Lib/pdb.py 2018-02-15 14:49:47.668435454 +0100
+++ ../pdb.py 2018-02-21 14:48:21.039713323 +0100
@@ -246,6 +246,10 @@
that we ever need to stop in this function."""
if self._wait_for_mainpyfile:
return
+ if self.force_step(frame):
+ self.onecmd("step")
+ self.forget()
+ return
View keybase.md

Keybase proof

I hereby claim:

  • I am smurfix on github.
  • I am matthiasu (https://keybase.io/matthiasu) on keybase.
  • I have a public key whose fingerprint is AFD7 9782 F3BA EC02 0B28 A19F 72CF 8E5E 25B4 C293

To claim this, I am signing this object: