Skip to content

Instantly share code, notes, and snippets.

View CalebBarnes's full-sized avatar

Caleb Barnes CalebBarnes

View GitHub Profile
@CalebBarnes
CalebBarnes / watch.zsh
Created January 23, 2024 00:35
Zsh ~ watch log files with bat + tail
# you can add this to your .zshrc, .zprofile, or source your own file like source ~/custom-commands.zsh
# Uses `bat` to display the files contents and watches for changes with `tail -f`
# very useful for watching log files
watch() {
if [ -z "$1" ]; then
echo "Usage: watch <filename>"
return 1
fi
@CalebBarnes
CalebBarnes / .zshrc
Last active January 31, 2024 22:22
swpm tab completion for scripts in package.json (works with command alias)
# optionally add custom command alias for swpm
alias p="swpm"
# define completion after your command alias
autoload -Uz compinit && compinit # omit this if it is included above^ in your zshrc
_swpm_scripts() {
local package_file="package.json"
if [[ -f $package_file ]]; then
local -a scripts
@CalebBarnes
CalebBarnes / setup-docker-one-command.sh
Last active January 22, 2024 06:46
One command to Setup Docker on Ubuntu Server
/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/CalebBarnes/1cebffedda280138e6c4e6a5911310ab/raw/45251744edd379ce43fde75a6bec62e23b1e67b2/setup-docker.sh)"
@CalebBarnes
CalebBarnes / setup-docker.sh
Created December 6, 2023 22:43
Setup Docker on Ubuntu Server
echo -e '\u001B[32m'Setting up Docker!'\033[0m'
# 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 | sudo tee /etc/apt/keyrings/docker.gpg > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo Adding the docker repository to Apt sources:
# Add the repository to Apt sources: