Skip to content

Instantly share code, notes, and snippets.

@bs135
bs135 / build_mysql.sh
Created February 28, 2024 05:15 — forked from huangqiheng/build_mysql.sh
Build and install MySQL 5.1 from source on Ubuntu 18.04
#!/bin/bash
# Run as root
set -e
apt-get update
apt-get install -y build-essential
apt-get install -y libncurses5-dev
useradd mysql
@bs135
bs135 / CreateDebianVM.sh
Last active March 24, 2024 13:54 — forked from andreafortuna/CreateDebianVM.sh
Automatically create and start a Debian VM on VirtualBOX
#!/bin/bash
MACHINENAME=$1
# Download debian.iso
if [ ! -f ./debian.iso ]; then
wget https://cdimage.debian.org/mirror/cdimage/archive/11.2.0/amd64/iso-cd/debian-11.2.0-amd64-netinst.iso -O debian.iso
fi
#Create VM
VBoxManage createvm --name $MACHINENAME --ostype "Debian_64" --register --basefolder `pwd`
@bs135
bs135 / update-git.sh
Created November 4, 2021 01:37 — forked from YuMS/update-git.sh
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y

How to Do a Clean Restart of a Docker Instance

If you are using Docker-Machine, make sure your are talking to the right one. Execute the command docker-machine ls to find which one is currently active. It is also recommended to always redo the command:

eval "$(docker-machine env <docker machine name>)"

Note: Deleting volumes will wipe out their data. Back up any data that you need before deleting a container.

@bs135
bs135 / bash_strict_mode.md
Created September 21, 2021 01:20 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -x, -o pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u