Skip to content

Instantly share code, notes, and snippets.

@alirezaarzehgar
alirezaarzehgar / gcc-cross-compiler.sh
Last active May 7, 2022 02:46
Download and install gcc for other targets and versions
#!/usr/bin/env bash
GCC="gcc-8.2.0"
BINUTILS="binutils-2.31.1"
GDB="gdb-9.1"
PREFIX=$(pwd)/cross
COMPILEFLAGS=--disable-multilib
mkdir $GCC-elf-objs
mkdir ${GDB}-build
@depau
depau / README.md
Created January 9, 2021 15:14
Strace indent and colorize

Strace indent and colorize

Parses strace's output and indents filesystem access calls, colorizing and indenting equally all access to the same file descriptor.

screenshot

@mtds
mtds / lvn.md
Last active June 26, 2024 17:07
Linux Virtual Networking

Virtual Networking on Linux

In the Linux Kernel, support for networking hardware and the methods to interact with these devices is standardized by the socket API:

                +----------------+
                |   Socket API   |
                +-------+--------+
                        |
User space              |
@TaipanRex
TaipanRex / Windows-app-Ranger.md
Last active May 13, 2024 06:38
How to launch Windows applications from Ranger in Windows Subsystem for Linux (WSL)

Make sure you have WSL with the Windows 10 Fall Creators Update installed. Ranger uses rifle as a file handler and you need its config file, rifle.conf. If you dont have it (should be in ~/.config/ranger/rifle.conf), run the command ranger --copy-config=rifle, then edit the resulting file.

To run Windows applications from Ranger, we will use cmd.exe /C start "" <file>, which works after the Fall Creators Update. The problem is that Ranger will feed in file paths using Unix pathing, but start expects Windows pathing. We will solve this by using sed to translate the path.

Add below code to your rifle.conf and you will be able to run Windows applications for the chosen file extensions.

@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active June 10, 2024 19:30
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@samoshkin
samoshkin / toggle_keybindings.tmux.conf
Last active June 8, 2024 23:04
tmux.conf excerpt to toggle on/off session keybindings and prefix handling
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
@7rin0
7rin0 / gist:8c1c88a92216d13619c6b4a77f3643c9
Created May 26, 2017 17:22
git config merge.renameLimit 999999
git config merge.renameLimit 999999
git config --unset merge.renameLimit
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active June 17, 2024 12:05
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@ctechols
ctechols / compinit.zsh
Last active June 15, 2024 19:43
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit