New hardware, who dis?

New laptop provided by work. Time to install everything that makes me productive.

Using Kubuntu 21.10 as my base OS.

General utilities:

sudo apt install \
    openssh-server \
    net-tools \
    htop \
    curl \
    whois \
    ack \
    mysql-client \
    httpie \
    php-cli \
    freerdp2-x11 \
    meld \
    kcachegrind \
    vokoscreen-ng \
    autokey-qt \
    parlatype \
    thunderbird-locale-en-gb \
    libreoffice-calc \
    libreoffice-writer \
    libreoffice-draw

Slack:

sudo snap install slack --classic

PhpStorm:

sudo snap install phpstorm --classic

Microsoft Edge:

echo 'deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main' | sudo tee /etc/apt/sources.list.d/microsoft-edge.list

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EB3E94ADBE1229CF

sudo apt update && sudo apt install microsoft-edge-beta

VirtualBox:

echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/oracle-virtualbox.list

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

sudo apt update && sudo apt install virtualbox-6.1

Vagrant:

echo "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/vagrant.list

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

sudo apt-get update && sudo apt-get install vagrant

Spotify:

sudo snap install spotify

Skype:

sudo snap install skype

Postman:

sudo snap install postman

Docker:

echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo apt update && sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo usermod -a -G docker $USER

Docker Compose (v1):

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose

chmod +x /tmp/docker-compose

sudo mv /tmp/docker-compose /usr/local/bin/docker-compose

Insync:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ACCAF35C

echo "deb http://apt.insync.io/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) non-free contrib" | sudo tee /etc/apt/sources.list.d/insync.list

sudo apt update && sudo apt install insync

bash-git-prompt

git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1

tee -a ~/.bashrc <<EOF

if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
    GIT_PROMPT_ONLY_IN_REPO=1
    GIT_PROMPT_THEME=Default_Ubuntu
    source $HOME/.bash-git-prompt/gitprompt.sh
fi
EOF

vagrant plugin “hostmanager” sudo without password

sudo tee /etc/sudoers.d/vagrant_hostmanager <<EOF
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp $HOME/.vagrant.d/tmp/hosts.local /etc/hosts
%sudo ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
EOF

Ansible

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible

Additional monitor resolution

Help from: https://www.tecmint.com/set-display-screen-resolution-in-ubuntu/

sudo tee /etc/profile.d/aoc_monitor_2k.sh <<EOF
xrandr --newmode "2560x1440_60.00"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync
xrandr --addmode DP-3-2 "2560x1440_60.00"
EOF

old and busted: mysqldump, new hotness: mydumper

I’m late to the mydumper party – https://github.com/maxbube/mydumper

Multi-threaded, lightning quick, exports to files per table structure and data.

In the Ubuntu world (and likely Debian too) it’s available as a precompiled package: sudo apt update && sudo apt install mydumper

Backup everything in a database:

mydumper \
  --triggers \
  --routines \
  --events \
  --database name_of_source_database

It’ll create a date stamped directory with two files for each table. One for the schema, the other with the data.

If you want to import everything in one go, here’s a little bit of bash to help:

# 1st - import all of the schema files to create the
#   tables, triggers, routines, and events
for i in `ls *-schema.sql`; do
    echo -e "\nImporting schema file: ${i}"
    pv ${i} | mysql name_of_target_database
done

# 2nd - import all of the table data
for i in `ls *.sql | grep -v '\-schema.sql'`; do
    echo -e "\nImporting data file: ${i}"
    pv ${i} | mysql name_of_target_database
done

The above uses pv (pipe viewer – http://ivarch.com/programs/pv.shtml) to send the content of the files into mysql. This means that we get to see the progress of importing files into MySQL.

If you haven’t got pv I suggest you get it: sudo apt update && sudo apt install pv.