Dan Pastusek's Blog | Home


Default Fixes (Windows, Vim, etc)

Published 2022-01-13 Updated: 2023-11-23

Windows

Shift + F10, then OOBE\BYPASSNRO

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

# 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-=a
set cursorline
set expandtab
set shiftwidth=2
set softtabstop=2
set autoindent
EOF
# Install node
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y
npm i -g yarn

# Bash defaults
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

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 (Ubuntu Specific)

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin