Skip to content

Instantly share code, notes, and snippets.

View duckinator's full-sized avatar

Ellen Marie Dash duckinator

View GitHub Profile
@duckinator
duckinator / Error.gd
Last active April 15, 2020 15:23
Godot script to allow getting (more) friendly messages for errors.
# Generated by generate_error.sh
extends Node
func print_info(err):
printerr(info(err))
print_stack()
func name(err):
var error_names = {}
~/test$ printf " a\n b\n c\n"
a
b
c
~/test$ printf " a\n b\n c\n" | python3 -m textwrap-tool dedent
a
b
c
~/test$ printf " a\n b\n c\n" | python3 -m textwrap-tool indent '....'
#!/usr/bin/env python3
from pathlib import Path
import pep517.build
import sys
import textwrap
# quick-and-dirty pep517 wrapper that handles projects without a pyproject.toml.
# Released under public domain, CC0, or MIT license, whichever you prefer.
@duckinator
duckinator / webkit2gtk-testcase.c
Created January 24, 2019 02:12
Running this `bash ./webkit2gtk-testcase.c` results in 80GB+ VIRT memory reported in htop.
#//\
rm -f webkit-testcase && \
cc main.c -std=c11 -DWEBVIEW_GTK=1 `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -o webkit-testcase && \
./webkit-testcase; \
exit
// Run `bash ./webkit2gtk-testcase.c` to run this.
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
link-manager> import file_of_urls.txt
3 URLs found. Continue? [Y/n] y
----
NAME: Example Domain
LINK: https://example.com
TAGS: (None)
Example Domain
-- Logs begin at Fri 2018-03-02 08:45:56 EST, end at Sun 2018-05-20 08:45:52 EDT. --
May 20 04:34:54 eternal-pickle systemd[1]: Starting Network Manager...
May 20 04:34:54 eternal-pickle NetworkManager[933]: <info> [1526805294.9550] NetworkManager (version 1.8.6-1.fc27) is starting... (for the first time)
May 20 04:34:54 eternal-pickle NetworkManager[933]: <info> [1526805294.9555] Read config: /etc/NetworkManager/NetworkManager.conf
May 20 04:34:54 eternal-pickle NetworkManager[933]: <info> [1526805294.9643] manager[0x555fbb49c140]: monitoring kernel firmware directory '/lib/firmware'.
May 20 04:34:54 eternal-pickle NetworkManager[933]: <info> [1526805294.9655] policy: hostname management mode: default
May 20 04:34:54 eternal-pickle NetworkManager[933]: <info> [1526805294.9658] dns-mgr[0x555fbb4a6940]: init: dns=default, rc-manager=symlink
May 20 04:34:54 eternal-pickle systemd[1]: Started Network Manager.
May 20 04:34:55 eternal-pickle NetworkManager[933]: <info> [1526805295.2333] settings: loaded plug
-- Logs begin at Fri 2018-03-02 08:45:56 EST, end at Sun 2018-05-20 08:12:38 EDT. --
May 20 03:44:59 eternal-pickle chronyd[871]: System clock TAI offset set to 37 seconds
May 20 03:44:59 eternal-pickle chronyd[871]: System clock wrong by 14421.145839 seconds, adjustment started
May 20 07:45:20 eternal-pickle chronyd[871]: System clock was stepped by 14421.145839 seconds
May 20 07:45:22 eternal-pickle chronyd[871]: Selected source 50.22.155.163
May 20 07:45:26 eternal-pickle audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
May 20 07:45:33 eternal-pickle audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
May 20 07:45:33 eternal-pickle kernel: usb 1-8: USB disconnect, device numb
[ 157.654]
X.Org X Server 1.18.4
Release Date: 2016-07-19
[ 157.655] X Protocol Version 11, Revision 0
[ 157.655] Build Operating System: FreeBSD 11.1-RELEASE-p6 amd64
[ 157.655] Current Operating System: FreeBSD eternal-pickle 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
[ 157.655] Build Date: 03 February 2018 05:48:03AM
[ 157.655]
[ 157.655] Current version of pixman: 0.34.0
[ 157.655] Before reporting problems, check http://wiki.x.org
diff --git a/include/awoo/modifiers.h b/include/awoo/modifiers.h
index 6a29b89..68a3980 100644
--- a/include/awoo/modifiers.h
+++ b/include/awoo/modifiers.h
@@ -15,7 +15,7 @@
#define noreturn __attribute__((noreturn)) void
// Specify that a function should be automatically ran during boot.
-#define autorun(fn) __attribute__((section (".autorun") )) void (* TOKENPASTE2(auto_run_, __LINE__) )(void) = &(fn)
+#define autorun(fn) __attribute__((constructor)) void (* TOKENPASTE2(auto_run_, __LINE__) )(void) = &(fn)
awooOS i386 08e3e4-test
Compiled with Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
auto_run_22 = 1060928
autorun_ptr = 1116630
autorun_ptr = 1116631
autorun_ptr = 1116632
autorun_ptr = 1116633
autorun_ptr = 1116634
autorun_ptr = 1116635