Skip to content

Instantly share code, notes, and snippets.

View rmi1974's full-sized avatar

Robert Michelsen rmi1974

  • Germany
View GitHub Profile
@rmi1974
rmi1974 / debug_sysvinit.md
Last active July 27, 2021 22:27
How to debug SysVinit #debug

How to debug SysVinit

Add init=/bin/bash to Linux kernel command line (via bootloader). After booting to bash shell prompt:

mount -t proc proc /proc

The shell will have PID 1, use strace to attach while putting it into background.

@rmi1974
rmi1974 / how_to_enhance_shell_with_powerline.md
Last active March 29, 2020 14:55
How to enhance Shell with Powerline #shell #commandlinefu

Add power to your terminal with powerline

For the shell

sudo dnf install powerline powerline-fonts

Next, configure your bash shell to use powerline by default. Add the following snippet to your ~/.bashrc file:

@rmi1974
rmi1974 / using_inotify_command_line_tools.md
Last active March 29, 2020 14:52
Using inotify command line tools #commandlinefu

Using inotify command line tools

Courtesy of [Wine Bugzilla #44691][1].

Installation

sudo dnf install inotify-tools
@rmi1974
rmi1974 / wine_debugging_of_managed_code_using_windbg_cordbg.md
Last active March 30, 2024 23:09
Debugging of managed code using WinDBG/CorDbg in Wine #wine #debug #dotnet #commandlinefu

Debugging of managed code using WinDBG/CorDbg in Wine

Courtesy of [Wine Bugzilla #46842][1].

Prerequisites

  • Microsoft .NET Framework 4.x installed in WINEPREFIX (use 'winetricks' to install it)
  • Microsoft Debugging Tools for Windows installed in WINEPREFIX. Get them [here (64-bit)][2] and [here (32-bit)][3].

Set native overrides:

@rmi1974
rmi1974 / show_rpm_builtin_macros.md
Last active March 29, 2020 14:43
Show built-in macros in of RPM / rpmbuild #rpmbuild #rpm #commandlinefu

Show built-in macros of RPM / rpmbuild

The show the compiler flags used for building 64-bit host

$ rpmbuild --eval '%{optflags}'
-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

For 32-bit host:

@rmi1974
rmi1974 / wine_identify_stub_functions_from_dllimports_using_winedump_and_sedgrep_only.md
Last active March 29, 2020 14:42
Identify dll imports that are stubs using Winedump and sed/grep only #wine #debug #commandlinefu

Identify dll imports that are stubs using Winedump and sed/grep only

Dump all imports for specific dll

To show the output format for later regex.

$ pwd
/home/focht/.wine/drive_c/Program Files/Common Files/Siemens/Automation/Simatic OAM/Drivers
@rmi1974
rmi1974 / winedbg_noninteractive_usage_scripting.md
Last active November 29, 2020 15:56
How to non-interactively use winedbg #wine #debug #commandlinefu

How to non-interactively use winedbg

Using 'command'

From [How to list all Wine window handles which belong to the selected window PID? (archive.org)][1]:

winedbg --command "info wnd" | \
    grep -wf <(winedbg --command "info threads" | \
 ex +"/terminal.exe\n\zs/;,/^\S/-p" -scq! /dev/stdin | \
@rmi1974
rmi1974 / wine_android_notes.md
Last active March 5, 2022 12:59
Wine in Android target environment notes #wine #android #debug #commandlinefu

Wine in Android target environment notes

export PATH=$PATH:/data/data/org.winehq.wine/files/x86/bin
export WINEPREFIX=/data/data/org.winehq.wine/files/prefix/
export LD_LIBRARY_PATH=/data/user/0/org.winehq.wine/files/x86/lib:/data/app/org.winehq.wine-1/lib/x86
$ ps
@rmi1974
rmi1974 / libfaketime_usage.md
Last active February 2, 2025 02:12
Using libfaketime to manipulate the system time for applications #faketime #wine #debug #commandlinefu

Using libfaketime to manipulate the system time for applications

See [libfaketime on github][1] for upstream project site general overview.

Build in multilib environment

#!/usr/bin/env bash

set -Eeuo pipefail
@rmi1974
rmi1974 / usb_device_descriptor_patching.md
Last active November 19, 2023 04:24
Modify USB device descriptors/properties by patching firmware #firmware #debug