Skip to content

Instantly share code, notes, and snippets.

@Phaiax
Phaiax / how-does-async-work-in-async-std.md
Last active July 17, 2023 10:56
Blog article: How does async work in async-std?

How does async work in async-std?

(Phaiax - 2019/12/1 - CC_BY_SA 4.0)

Lately I was porting a software from tokio/futures-1.0 to async-await. I somehow thought async-std was the successor of tokio and ported everything to async-std. 80% in, I noticed that my hyper dependency requires tokio and that it's not possible to replace tokio with async-std without also replacing hyper. Also, tokio and async-std try to solve the same problem. So I started a journey into the inners of the rust async story to find out if it is possible to use both tokio and async-std at the same time. (tl;dr: it is). I had heard of reactors and executors before, but there was much new stuff to discover.

<html>
<head>
<style>
canvas {
margin: 10 auto;
border: 1px solid gray;
display:block;
}
div#info {
position: absolute;
@Phaiax
Phaiax / webdavtest.log
Created January 7, 2020 15:29
Webdav curl tests
curl -X HEAD -v --user 'myuser:mypw' 'http://192.168.0.12:5005/ExistingFolder/' --basic
Warning: Setting custom HTTP method to HEAD with -X/--request may not work the
Warning: way you want. Consider using -I/--head instead.
* Trying 192.168.0.12...
* TCP_NODELAY set
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 192.168.0.12 (192.168.0.12) port 5005 (#0)
* Server auth using Basic with user 'myuser'
> HEAD /ExistingFolder/ HTTP/1.1
@Phaiax
Phaiax / 1 jhbuild of gcr before failure
Last active June 11, 2021 22:44
Gnome-Shell jhbuild (gcr)
[60/62] Generating GcrUi-3.gir with a custom command.
g-ir-scanner: link: gcc -pthread -o /home/daniel/.cache/jhbuild/build/gcr/tmp-introspect5owsnojp/GcrUi-3 /home/daniel/.cache/jhbuild/build/gcr/tmp-introspect5owsnojp/GcrUi-3.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/home/daniel/.cache/jhbuild/build/gcr/ui -Wl,-rpath,/home/daniel/.cache/jhbuild/build/gcr/ui -L/home/daniel/.cache/jhbuild/build/gcr/egg -Wl,-rpath,/home/daniel/.cache/jhbuild/build/gcr/egg -L/home/daniel/.cache/jhbuild/build/gcr/gck -Wl,-rpath,/home/daniel/.cache/jhbuild/build/gcr/gck -L/home/daniel/.cache/jhbuild/build/gcr/gcr -Wl,-rpath,/home/daniel/.cache/jhbuild/build/gcr/gcr -L/home/daniel/jhbuild/install/lib -Wl,-rpath,/home/daniel/jhbuild/install/lib -L/home/daniel/jhbuild/install/lib -Wl,-rpath,/home/daniel/jhbuild/install/lib -lgcr-ui-3 -lglib-2.0 -lgmodule-2.0 -lgthread-2.0 -lgobject-2.0 -lgio-2.0 -lp11-kit -lgcrypt -ldl -lgpg-error -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixb
GISCAN HarfBuzz-0.0.gir
/home/jhbuild/jhbuild/checkout/harfbuzz/src/hb-aat-layout.h:36: syntax error, unexpected identifier in 'HB_BEGIN_DECLS' at 'HB_BEGIN_DECLS'
/home/jhbuild/jhbuild/checkout/harfbuzz/src/hb-aat-layout.h:431: syntax error, unexpected '*', expecting ')' or ',' in 'hb_aat_layout_get_feature_types (hb_face_t *face,' at '*'
/home/jhbuild/jhbuild/checkout/harfbuzz/src/hb-aat-layout.h:433: syntax error, unexpected UNSIGNED, expecting identifier or '(' or '*' in ' unsigned int *feature_count, /* IN/OUT. May be NULL. */' at 'unsigned'
/home/jhbuild/jhbuild/checkout/harfbuzz/src/hb-aat-layout.h:434: syntax error, unexpected typedef-name, expecting identifier or '(' or '*' in ' hb_aat_layout_feature_type_t *features /* OUT. May be NULL. */);' at 'hb_aat_layout_feature_type_t'
/home/jhbuild/jhbuild/checkout/harfbuzz/src/hb-aat-layout.h:434: syntax error, unexpected ')', expecting ',' or ';' in ' hb_aat_layout_feature_type_t *features /* OUT. May be NULL. */);' at ')'
/home/jh
@Phaiax
Phaiax / example_dgram.py
Last active February 4, 2025 15:26
Python AF_UNIX socket / socketserver example (datagram and streaming mode)
"""
LICENSE: MIT
Example of using unix socket in SOCK_DGRAM mode.
"""
import socket
import socketserver
import time