Dan Pastusek's Blog | Home


Default Fixes (Windows, Vim, etc)

Published 2022-01-13 Updated: 2025-11-19

Mac

  1. LinearMouse
  2. BentoBox
    1. Launch at Login
    2. Restore window size at unsnap: off
  3. Maacy - clipboard history
  4. defaults write -g KeyRepeat -int 1
  5. defaults write -g InitialKeyRepeat -int 12
  6. Remap Home / End Keybindings:
    1. Download Karabiner Elements
    2. Import this rule: https://ke-complex-modifications.pqrs.org/#pc_shortcuts
    3. Add one more custom one:
{
    "description": "DAN: Hybrid PC-Style Quit Application (Ctrl+Q to Command+Q)",
    "manipulators": [
        {
            "from": {
                "key_code": "q",
                "modifiers": { "mandatory": ["control"] }
            },
            "to": [
                {
                    "key_code": "q",
                    "modifiers": ["left_command"]
                }
            ],
            "type": "basic"
        }
    ]
}

Windows

Shift + F10, then:

Remove windows store: Get-AppxPackage *Microsoft.WindowsStore* | Remove-AppxPackage

REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Search /v BingSearchEnabled /t REG_DWORD /d 0
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Search /v CortanaConsent /t REG_DWORD /d 0
tskill searchui

Vim Default, Common Utils, and Node

# tmux
setw -g mouse on

# add to ~/.tmux.conf
# Install vim, git, jq, tmux
apt-get update
apt-get install -y ca-certificates curl gnupg vim curl git jq tmux sudo

# Load all my keys
mkdir -p ~/.ssh
curl https://github.com/pastudan.keys >> ~/.ssh/authorized_keys

#    Disable vim automatic visual mode on mouse select. For preserving global defaults and only changing one option:
cat <<EOF > ~/.vimrc
source \$VIMRUNTIME/defaults.vim
set mouse=""
set cursorline
set expandtab
set shiftwidth=2
set softtabstop=2
set autoindent
EOF
# Install node
NODE_MAJOR=24
curl -fsSL https://deb.nodesource.com/setup_$NODE_MAJOR.x | sudo -E bash -
sudo apt-get install -y nodejs
# Bash defaults
apt install tmux
cat <<EOF >> ~/.bashrc
dmux() {
  if tmux attach-session -t "\$1" 2>/dev/null; then
    # Success: existing session found and attached to it
    return 0
  fi

  # Failure: no existing session found, create a new one
  tmux new-session -s "\$1"
}

# If this is an xterm set the title to user@host:dir
PS1='\n\${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \\$\[\033[00m\] '

export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
export HISTFILE=~/.bash_eternal_history
PROMPT_COMMAND="history -a; \$PROMPT_COMMAND"
EOF

And .zshrc if on mac

# Play a sound if a command takes more than 5 seconds to execute

COMMAND_START_TIME=0

# Function to run before a command executes

preexec() {

# Save the current time as the start time of the command

COMMAND_START_TIME=$(date +%s)

}

# Function to run before the prompt is displayed (after a command finishes)

precmd() {

# Check if a command has been executed

EXIT_CODE=$?

if [[ $COMMAND_START_TIME -ne 0 ]]; then

# Calculate the end time and runtime

local end_time=$(date +%s)

local runtime=$((end_time - COMMAND_START_TIME))

  

# Reset COMMAND_START_TIME for the next command

COMMAND_START_TIME=0

  

# Determine if the runtime exceeds 4 seconds

if ((runtime > 4)); then

# Check the exit status of the last command

if ((EXIT_CODE == 0)); then

# Command succeeded, play success sound

afplay /System/Library/Sounds/Funk.aiff

else

# Command failed, play failure sound

afplay /System/Library/Sounds/Bottle.aiff

fi

fi

fi

}

Shairport Sync (AirPlay 2 for Raspi)

# Install docker
curl -fsSL https://get.docker.com | get-docker.sh

# Run image (without a DAC)
docker run -d --restart unless-stopped --net host --device /dev/snd mikebrady/shairport-sync:latest -a Floor2

# Run image (With HiFi Berry DAC)
docker run -d --restart unless-stopped --net host --device /dev/snd mikebrady/shairport-sync:latest -a Floor1 -- -d hw:1 -c PCM

This will send audio to alsa hardware device hw:0 and make use of the that device's mixer control called PCM. The service will be visible as DenSystem on the network.

Postgres

apt install postgresql
sudo su postgres
psql
CREATE DATABASE root;
ALTER USER root SUPERUSER;
ALTER USER root WITH PASSWORD 'root';

vim /etc/postgresql/15/main/postgresql.conf, uncomment and add tailscale interface ip

listen_addresses = 'localhost,100.x.y.z'

vim /etc/postgresql/15/main/pg_hba.conf

# IPv4 local connections:
host    all             all             100.x.y.z/32         scram-sha-256 
# or 100.64.0.0/10 for everything

Obsidian CSS Fixes

.HyperMD-codeblock,
.cm-inline-code {
  white-space: pre;
}

.cm-line:has(> .HyperMD-codeblock),
.cm-line:has(> .cm-inline-code) {
  white-space: pre;
}

Docker

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh