Skip to content

Instantly share code, notes, and snippets.

@luser
luser / output.txt
Created June 1, 2023 18:11
ldd audify
$ ldd ../node_modules/audify/build/Release/audify.node
linux-vdso.so.1 (0x00007ffc0a9de000)
libopus.so.0 => /build/audify/../node_modules/audify/build/Release/libopus.so.0 (0x00007f9795a81000)
librtaudio.so.6 => /build/audify/../node_modules/audify/build/Release/librtaudio.so.6 (0x00007f9795a5f000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9795811000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f979572a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f979570a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f97954e0000)
libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007f97953dd000)
libpulse.so.0 => /lib/x86_64-linux-gnu/libpulse.so.0 (0x00007f9795388000)
@luser
luser / bloaty.txt
Created April 4, 2022 12:11
Bloaty functions
FILE SIZE
--------------
+31% +225Ki .text
+36% +148Ki [4603 Others]
[NEW] +9.58Ki url::host::Host::parse
[NEW] +9.21Ki fancy_regex::compile::compile_inner
[NEW] +9.00Ki flatbuffers::get_root::root
+45% +6.50Ki _$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$::fmt
+28e2% +5.38Ki shared_core::events::eventlist::EventList::push_fb_event
[NEW] +4.89Ki fancy_regex::parse::Parser::parse_branch
@luser
luser / bloaty.txt
Created April 4, 2022 12:09
Bloaty output
FILE SIZE
--------------
+31% +225Ki .text
+52e2% +68.4Ki /Users/ted/src/fsdev-mac/tools/cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.25/src/lib.rs
[NEW] +39.6Ki /Users/ted/src/fsdev-mac/tools/cargo/git/checkouts/fancy-regex-4335b6f768c3ddb8/be6ba8f/src/lib.rs
+12e3% +36.2Ki /Users/ted/src/fsdev-mac/tools/cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/lib.rs
+11% +31.6Ki shared-core/src/lib.rs
+22e3% +29.5Ki /Users/ted/src/fsdev-mac/tools/cargo/registry/src/github.com-1ecc6299db9ec823/url-2.2.2/src/lib.rs
+25e2% +8.63Ki /Users/ted/src/fsdev-mac/tools/cargo/registry/src/github.com-1ecc6299db9ec823/idna-0.2.3/src/lib.rs
+7.6% +8.55Ki library/std/src/lib.rs
/*
* This script is intended to be used as an Apps Script attached to a Google Sheet formatted like:
* https://docs.google.com/spreadsheets/d/1oiHQopo6KsdJIyRnPDBPNmWx2RVMtpiN6XoZItjmneo/edit?usp=sharing
*/
var WEDNESDAY = 3;
function startup() {
checkCalendarEvents();
};
@luser
luser / output
Created April 21, 2021 19:03
firefox macos unwind info
$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-objdump -arch x86_64 --macho --unwind-info /Applications/Firefox.app/Contents/MacOS/firefox
Contents of __unwind_info section:
Version: 0x1
Common encodings array section offset: 0x1c
Number of common encodings in array: 0x1
Personality function array section offset: 0x20
Number of personality functions in array: 0x0
Index array section offset: 0x20
Number of indices in array: 0x2
Common encodings: (count = 1)
@luser
luser / output
Created April 21, 2021 19:02
firefox macos eh_frame contents
$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-objdump -arch x86_64 --macho --dwarf=frames /Applications/Firefox.app/Contents/MacOS/firefox
.debug_frame contents:
.eh_frame contents:
00000000 00000014 ffffffff CIE
Version: 1
Augmentation: "zR"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/XUL.sig</key>
<data>
Y0SEPxyC6hCQ+rl4LTRmXy7F9DQ=
</data>
2021-03-03 12:37:40:741 [HTTP] --> POST /wd/hub/session/c3491ff0-a516-4c53-b508-d79a55777fc9/appium/device/push_file
2021-03-03 12:37:40:741 [HTTP] {"path":"@com.fullstory.reftest/shared_prefs/com.fullstory.reftest.FS_PREFS.xml","data":"..."}
2021-03-03 12:37:40:741 [W3C (c3491ff0)] Calling AppiumDriver.pushFile() with args: ["@com.fullstory.reftest/shared_prefs/com.fullstory.reftest.FS_PREFS.xml","...","c3491ff0-a516-4c53-b508-d79a55777fc9"]
2021-03-03 12:37:40:742 [AndroidDriver] Parsed package identifier 'com.fullstory.reftest' from '@com.fullstory.reftest/shared_prefs/com.fullstory.reftest.FS_PREFS.xml'. Will put the data into '/data/data/com.fullstory.reftest/shared_prefs/com.fullstory.reftest.FS_PREFS.xml'
2021-03-03 12:37:40:742 [ADB] Running '/Users/ted/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell run-as com.fullstory.reftest "mkdir -p '/data/data/com.fullstory.reftest/shared_prefs'"'
2021-03-03 12:37:40:766 [ADB] Running '/Users/ted/Library/Android/sdk/platform-tools/adb -P 5
@luser
luser / canonicalpath.py
Created February 1, 2021 17:03
Canonicalize filename case in system Python 2.7 on macOS
#!/usr/bin/python
from __future__ import print_function
from Carbon.File import FSPathMakeRef
import os
import sys
import unicodedata
def actual_path(path):
@luser
luser / README.md
Created January 14, 2021 16:05
Illustration of a potential issue with subprocesses in Go

I ran into this issue at work in a test runner we have that is written in Go and runs a test suite which is a node module, which itself spawns several subprocesses. The issue was that one of the subprocesses inherited its parents' stdout file descriptor, but would outlive the parent process being killed. If you use Go's exec.Cmd to run a process and set its Stdout or Stderr to something that is not a File, a goroutine will be spawned to drive that I/O when calling Cmd.Start, and all such goroutines will be run to completion as part of Cmd.Wait. In this situation, because the grandchild process stays alive, it keeps the stdout pipe open, thus Cmd.Wait blocks until it exits.

subprocess.go is a minimal testcase to display the issue. It spawns itself as a child process with piped stdout, then waits one second before killing the subprocess and waiting on it. The child process spawns itself as a grandchild with inherited stdout and sleeps for 5 seconds before exiting. The grandchild process simply