Skip to content

Instantly share code, notes, and snippets.

View matheusmoreira's full-sized avatar

Matheus Moreira matheusmoreira

View GitHub Profile
export ASAN_OPTIONS=abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1
sway --debug 2> /run/user/1000/sway.debug.log
# SIGSEGV
cat /run/user/1000/sway.debug.log
00:00:00.000 [INFO] [sway/main.c:295] Sway version 1.10
00:00:00.000 [INFO] [sway/main.c:296] wlroots version 0.18.1
00:00:00.001 [INFO] [sway/main.c:81] Linux sinanju 6.11.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 22 Oct 2024 18:31:38 +0000 x86_64 GNU/Linux
@matheusmoreira
matheusmoreira / product-prices-and-quantities.ledger
Last active October 6, 2024 04:07
Embedded Python script to validate product price and quantity metadata against posting amount
python
def price_and_quantity(price, quantity, amount):
if not quantity:
quantity = 1
if not price:
price = amount / quantity
return amount == price * quantity
account Market
assert price_and_quantity(tag('Price'), tag('Units'), amount)
@matheusmoreira
matheusmoreira / sway.debug.log
Last active September 3, 2024 01:37
Sway crash reproduction with debug logging enabled and default settings
00:00:00.000 [INFO] [sway/main.c:338] Sway version 1.9
00:00:00.000 [INFO] [sway/main.c:339] wlroots version 0.17.4
00:00:00.001 [INFO] [sway/main.c:120] Linux sinanju 6.10.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 29 Aug 2024 16:48:57 +0000 x86_64 GNU/Linux
00:00:00.001 [INFO] [sway/main.c:136] Contents of /etc/os-release:
00:00:00.001 [INFO] [sway/main.c:120] NAME="Arch Linux"
00:00:00.001 [INFO] [sway/main.c:120] PRETTY_NAME="Arch Linux"
00:00:00.001 [INFO] [sway/main.c:120] ID=arch
00:00:00.001 [INFO] [sway/main.c:120] BUILD_ID=rolling
00:00:00.001 [INFO] [sway/main.c:120] ANSI_COLOR="38;2;23;147;209"
00:00:00.001 [INFO] [sway/main.c:120] HOME_URL="https://archlinux.org/"
(gdb) bt full
#0 0x000074a4b0a500a0 in wl_event_loop_dispatch (loop=0x5fbee443c0d0,
timeout=<optimized out>, timeout@entry=-1) at ../wayland-1.23.0/src/event-loop.c:1105
ep = {{
events = 1,
data = {
ptr = 0x5fbee5549350,
fd = -447442096,
u32 = 3847525200,
u64 = 105273495950160
@matheusmoreira
matheusmoreira / I18n.java
Created February 22, 2011 00:13
jar.getNextJarEntry() never seems to return anything other than null
// I18n.java
// Excerpt for question on StackOverflow
// http://stackoverflow.com/questions/5061554/how-do-i-access-the-content-of-folders-inside-a-jar-file
/**
* Private implementation method.
* @return a list containing the locales implemented by the resource bundles
*/
private static List<Locale> getLocaleListFromJar() {
List<Locale> locales = new ArrayList<Locale>();