Skip to content

Instantly share code, notes, and snippets.

@baryluk
baryluk / rsync_full.sh.example
Last active August 26, 2025 15:39
Total recall - rsync full archive
rsync --archive --verbose --acls --xattrs --atimes --hard-links --atimes --open-noatime --one-file-system \
--progress --human-readable --info=name0,progress2 --stats --ipv6 example.com:/home/user/Foo/ /tank/Foo/ --dry-run
# --info=del0,remove0,misc1,name0,progress2
# --info=del1,remove1,misc1,name1,progress2 - show a bit more stuff as they happen on each file
# Quick overview:
#
# --archive == -a, archive mode is -rlptgoD (but no -A,-X,-U,-N,-H):
@baryluk
baryluk / 3da240b059b1710b47d8774b27dc84bd05fb409c.patch
Created November 30, 2022 01:57
Demangle D programming language symbol names in Valgrind
commit 3da240b059b1710b47d8774b27dc84bd05fb409c (HEAD -> master)
Author: Witold Baryluk <[email protected]>
Date: Wed Nov 30 02:56:29 2022 +0100
Demangle D programming language (dlang) symbol names
diff --git a/coregrind/m_demangle/demangle.c b/coregrind/m_demangle/demangle.c
index 3fd7cb75f..a4031dc8a 100644
--- a/coregrind/m_demangle/demangle.c
+++ b/coregrind/m_demangle/demangle.c
@baryluk
baryluk / plan9-run.sh
Last active July 28, 2025 15:52
Plan 9 in qemu / 9front in qemu
#!/bin/bash
wget -c https://9front.org/iso/9front-9442.0e66f87316e571f7edf5274369ec69a5905507aa.amd64.iso.gz
gunzip -k 9front-9442.0e66f87316e571f7edf5274369ec69a5905507aa.amd64.iso.gz
if ! [ -f plan9.raw ]; then
qemu-img create plan9.raw 10G
fi
exec qemu-system-x86_64 -enable-kvm \
-smp $(nproc) \
-m $((8*1024)) \
@baryluk
baryluk / dd_bcd.py
Last active March 27, 2023 18:55
Double dabble algorithm demo in Python
#!/usr/bin/env python3
# MIT License, Witold Baryluk, 2022
# double dabble algorithm for convering binary numbers to decimal notation.
# This is program is not for speed, but just for ilustration and education.
# It works, and could be starting point to trying to understand
# how it works, and implement it for example on a microcontroller without
# division.
@baryluk
baryluk / config.boot
Created September 23, 2022 22:14 — forked from fatred/config.boot
Fiber7-X VyOS Config
set firewall all-ping 'enable'
set firewall broadcast-ping 'disable'
set firewall config-trap 'disable'
set firewall group network-group inside-nets network '192.168.99.0/24'
set firewall group network-group inside-nets network '10.31.74.0/28'
set firewall ipv6-receive-redirects 'disable'
set firewall ipv6-src-route 'disable'
set firewall ip-src-route 'disable'
set firewall log-martians 'enable'
set firewall receive-redirects 'disable'
@baryluk
baryluk / ntdll-disable-working_set_ex.patch
Last active August 26, 2025 15:40
Remove support for NtQueryVirtualMemory(MemoryWorkingSetExInformation) to help with Apex Legends / EAC stutter every 30 seconds. wine 7.x
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 550d7f41dec..e9c2f974c1f 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdlib.h>
#include <signal.h>
+#include <time.h>
#include <sys/types.h>
@baryluk
baryluk / library_dependencies.py
Last active March 3, 2024 00:38
Graph binary / library / dynamic library / shared object / so / ELF files, dependencies as a graph
#!/usr/bin/env python3
# Copyright: Witold Baryluk, 2019-2024. MIT license
# This small program takes one parameter, a binary (or library), and outputs
# a dependency graph. This is done recursively for all subdependencies.
# Some common dependencies are ignored like this ones to glibc basic libraries.
# The ones related to stdc++ / gcc are not ignored (otherwise the graph would be very dense).
#
# To generate and render dependency graph in one go, use something like this:
@baryluk
baryluk / prefix_suffix_compress.py
Last active July 26, 2022 11:29
Common prefix, suffix and two-sided compression
def common_prefix(strings):
def _iter():
for z in zip(*strings):
if z.count(z[0]) == len(z): # check all elements in `z` are the same
yield z[0]
else:
return
return "".join(_iter())
@baryluk
baryluk / library_dependencies.sh
Last active September 4, 2022 17:39
Graph binary / library / dynamic library / shared object / so / ELF files, dependencies as a graph
#!/bin/bash
# NOTE: Deprecated. Use https://gist.github.com/baryluk/09cbabb215351117b32aee994e5619a0 instead
# This small program takes one parameter, a binary (or library), and outputs
# a dependency graph. This is done recursively for all subdependencies.
# Some common dependencies are ignored like this ones to glibc basic libraries.
# The ones related to stdc++ / gcc are not ignored.
# After script is done execute this command to generate dependency graph:
#
@baryluk
baryluk / amdvlk-build.sh
Last active October 29, 2023 18:20
amdvlk portable non-root
#!/bin/bash
set -e
set -x
# TODO(baryluk): Standard depencies required: cmake, ninja, repo, git, gcc/g++, wayland-client, libxcb, libxml2, python3, perl, llvm
# Optional: valgrind, go, ocaml.
# I think the llvm actually doesn't need to be installed, because it is a part of downloaded and patched repo.