Skip to content

Instantly share code, notes, and snippets.

@Phaiax
Phaiax / example_dgram.py
Last active January 5, 2024 08:29
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
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 / 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
@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
<html>
<head>
<style>
canvas {
margin: 10 auto;
border: 1px solid gray;
display:block;
}
div#info {
position: absolute;
@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.

@Phaiax
Phaiax / propchangesback.py
Created May 23, 2019 19:35
propchangesback
from sqlalchemy.orm import sessionmaker, relationship
class User(Base, HtmlEditable):
__tablename__ = 'user'
id = MyColumn(Integer, primary_key=True)
name = MyColumn(String, inputtype="text")
fullname = MyColumn(String, inputtype="text")
nickname = MyColumn(String)
large_enough = MyColumn(Boolean, inputtype="checkbox")
address_id = MyColumn(Integer, ForeignKey("address.id"))
@Phaiax
Phaiax / END GCODE
Last active March 28, 2020 16:43
My 3d printer start/end gcode (6.7.2018)
M104 S0 ; Set hotend temperature to 0
M140 S0 ; Set bed temperature to 0
G92 E0 ; Reset absolute Extruder position
G1 E-2 F300 ;Retract the filament
G28 R X Y ; Raise Z then home X,Y
M18 X Y Z E ; Disable all motors
M82 ;absolute extrusion mode (needed?)
M107 ; Print fan off
M81 ; ATX off
#[macro_use] extern crate error_chain;
// All errors that can occour everywhere in the crate
pub mod errors {
error_chain!{
errors {
Pig { description("Pig-Descr") display("Pig-Display")}
Bat {}
Uhu {}
_XGetRequest API was backported to libx11-1.4.4 in:
http://git.openembedded.org/openembedded-core/commit/?id=e08604800fe1cb8f240f53c147ceb4ee08a29b91
This breaks e.g. libsdl-image build with:
| /OE/shr-core/tmp-eglibc/sysroots/qemux86-64/usr/lib/libSDL.so: undefined reference to `_XGetRequest'
For details see: https://bugzilla.redhat.com/show_bug.cgi?id=782251
Upstrea-Status: Accepted