Linux

FFMPEG

Speed up audio of a file

NOTE: ACCELERATION can be a value from “0.5” (1/2 speed) to “2.0” (double speed)

ffmpeg -i INPUT_FILE -filter:a "atempo=ACCELERATION" -vn OUTPUT_FILE

GZip

Compress a File Without Removing It

gzip < file > file.gz

Systemd

Setting OS Limits with systemd

  1. Edit /etc/systemd/user.conf and /etc/systemd/systemd.conf, add the following line to each file:
    DefaultLimitNOFILE=NEW_LIMIT
    
  2. Edit /etc/security/limits.conf and set the usual limit details:
    USER soft nofile NEW_LIMIT
    USER hard nofile NEW_LIMIT
    
  3. Restart your system for the changes to take effect.

Command Line Tricks

Recursively Set +x for Only Directories

Set the executable bit for directories (and not files) using +X (upper case) instead of +x (lower case).

chmod g+rX *

Prevent sudo Password Prompts

If you don’t have NOPASSWD set in sudoers, you can still bypass the password prompt by setting SUDO_ASKPASS to a binary that echos your password.

echo "echo mypassword" > ~/.local/bin/sudopass.sh
chmod 755 ~/.local/bin/sudopass.sh
export SUDO_ASKPASS=${HOME}/.local/bin/sudopass.sh

SELinux

Set Context for Container to Access Path

semanage fcontext -a -t container_file_t '<path_root>(/.*)?'
restorecon -R <path_root>

macOS

Locking macOS Dock Content

defaults write com.apple.Dock position-immutable -bool yes; killall Dock

Locking macOS Dock Size

defaults write com.apple.Dock size-immutable -bool yes; killall Dock

Show CMD-TAB App Switcher On All Monitors

defaults write com.apple.Dock appswitcher-all-displays -bool true; killall Dock

Prevent sudo Password Prompts

See Linux - Prevent sudo Password Prompts

Disabling auto-hide scroll bars

System Preferences -> General -> Show scroll bars = Always

Disable Touchpad Swipe Back

# Chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
# FireFox
defaults write org.mozilla.firefox AppleEnableSwipeNavigateWithScrolls -bool FALSE
# Brave
defaults write com.brave.Browser AppleEnableSwipeNavigateWithScrolls -bool FALSE
# Safari
defaults write com.apple.Safari AppleEnableSwipeNavigateWithScrolls -bool FALSE

Disable Dock Bouncing Icons

defaults write com.apple.dock no-bouncing -bool TRUE; killall Dock