Skip to content

Instantly share code, notes, and snippets.

@Yamakaky
Yamakaky / rust-unmangle
Last active September 1, 2021 02:06
Script to unmangle Rust symbols
#!/usr/bin/sed -rf
# Unmangle Rust symbols
# See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=cae15db74999edb96dd9f5bbd4d55849391dd92b
# Example, with [FlameGraph](https://github.com/brendangregg/FlameGraph):
# perf record -g target/debug/bin
# perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg
# Remove hash and address offset
s/::h[0-9a-f]{16}//g
s/\+0x[0-9a-f]+//g
thread 'main' panicked at 'oh no!', t.rs:3
stack backtrace:
0: 0x56475d4a5b58 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hf65740f571b3b062
at /home/yamakaky/dev/rust/rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: 0x56475d4d586e - std::sys_common::backtrace::_print::h49fe0d471b73c20e
at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:71
2: 0x56475d4d4a7e - std::sys_common::backtrace::print::hd65a646efeb9e475
at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:60
3: 0x56475d4a85ae - std::panicking::default_hook::{{closure}}::h25191b25fd3a12b5
at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:355
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set +e
ffmpeg -version > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "ffmpeg must be installed"
exit 1
fi
@Yamakaky
Yamakaky / Dockerfile
Last active May 25, 2019 14:16
Dockerfile for Liquidsoap
from ocaml/opam2:alpine-3.9 as builder
copy deps deps
run sed -i '/#/d' deps
run wget http://downloads.sourceforge.net/liblo/liblo-0.30.tar.gz
run tar xf liblo*
run cd liblo-0.30 && ./configure && make && sudo make install
run opam depext $(cat deps)
sb_available = ref [0, 1, 2, 3]
def sb_name(idx)
"soundboard#{idx}"
end
def mk_sb_track(idx)
def on_e(_, _)
log.debug(label = "soundboard", "Reusing id #{idx}")
sb_available := list.add(idx, !sb_available)
end
from ocaml/opam2:alpine-3.10 as builder
copy deps deps
run sed -i '/#/d' deps
run wget http://downloads.sourceforge.net/liblo/liblo-0.30.tar.gz && \
tar xf liblo* && \
cd liblo-0.30 && \
./configure && \
make && \