Skip to content

Instantly share code, notes, and snippets.

@labbots
labbots / Ubuntu 18.04 setup.md
Created June 10, 2019 11:12
Ubuntu 18.04 Manual partitioning setup with LUKS encryption and LVM - https://labbots.com/ubuntu-18-04-installation-with-luks-and-lvm

Ubuntu 18.04 installation with LUKS and LVM

Installation Process

Pre-installation from live OS

This setup of Ubuntu with LUKS and LVM is tested on Ubuntu 18.04.

Boot Ubuntu from a Live OS and select the option to try Ubuntu without installing. Follow the steps I've outlined below. Let's assume you're installing to /dev/nvme0n1.

  1. Partition the drive with your tool of choice: I used gparted to set mine up.
@labbots
labbots / zipper.vbs
Last active September 4, 2024 07:28
VBS script to create zip for file or folder in Windows using ONLY Windows' built-in capabilities
Set Args = Wscript.Arguments
source = Args(0)
target = Args(1)
tempDir = Empty
Function GetFullPath(path)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetFullPath = fso.GetAbsolutePathName( path )
End Function
@labbots
labbots / SwitchPhp.sh
Last active April 5, 2023 18:01
Bash script to switch between available PHP versions in Ubuntu. (Tested in Ubuntu 16.04)
#!/bin/bash
# Check if ran with root permissions
if [ `id -u` -ne 0 ]; then
printf "The script must be run as root! (you can use sudo)\n"
exit 1
fi
function arrayContains {
local e match="$1"
@labbots
labbots / ovpn_config_merge_split.sh
Last active May 28, 2022 07:04
Open VPN Config file with inline certificate and keys does not load in network-manager. So here is a simple script to automate the config creation. The script can be used to both merge and split ovpn config files. https://labbots.com/open-vpn-config-file-split-and-merge-bash/
#!/bin/bash
#https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/606365
#http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu
#!/bin/bashset -e
function usage(){
echo -e "\nThe script can be used to split or merge ovpn file."
@labbots
labbots / pi-temp-measure.sh
Last active September 11, 2020 20:43
Script to measure CPU and GPU temperature of Raspberry PI Model 2/3/3B+ (https://labbots.com/rpi-measure-cpu-gpu-temperature/)
#!/usr/bin/env bash
# Script: pi-temp-measure.sh
# Display the ARM CPU and GPU temperature of Raspberry Pi 2/3B/3B+
# -------------------------------------------------------
echo "-------------------------------------------"
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
gpu="$(/opt/vc/bin/vcgencmd measure_temp)"
echo "GPU => ${gpu##*=}"
@labbots
labbots / color_script.sh
Last active May 6, 2020 13:50
Test script to understand bash script ANSII colour codes
#!/usr/bin/env bash
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 9) # red
bldblu=${txtbld}$(tput setaf 14) # blue
bldwht=${txtbld}$(tput setaf 10) # white
txtrst=$(tput sgr0) # Reset
info=${bldwht}*${txtrst} # Feedback
pass=${bldblu}*${txtrst}
@labbots
labbots / gitconfig
Created February 2, 2018 10:32
Git config
[user]
name = you name
email = you_email_address
[alias]
# nice log output
lg = log --graph --pretty=oneline --abbrev-commit --decorate
# start git-sh
sh = !git-sh
[color]
# turn on color
#lists contents of current directory with file permisions
alias ll='ls --color -l -sort'
#list all directories in current directories
alias ldir='ls -l | grep ^d'
# List directory and pipe output to less. Makes viewing of large directory easy
alias lsl="ls -lhFA --color | less -r"
#Find files in current directory
@labbots
labbots / replicate_db.sh
Created December 23, 2016 13:25
Script to replicate Mysql databases for local development
#!/bin/bash
source=${1}
destination=${2}
user=${3:-root}
pass=${4}
# Help menu
print_help() {
echo -e "
@labbots
labbots / mime_type.sh
Created December 23, 2016 13:20
Get mime-type of a file based on extension if exists or by using file command
#!/bin/bash
FILE=$(basename $1)
FILENAME="${FILE%.*}"
EXTENSION="${FILE##*.}"
echo "$FILE"
echo "$FILENAME"
echo "$EXTENSION"