Skip to content

Instantly share code, notes, and snippets.

View coltenkrauter's full-sized avatar
👩‍🌾
Husband, father of four, full-stack developer

Colten Krauter coltenkrauter

👩‍🌾
Husband, father of four, full-stack developer
  • Stevensville, MT
View GitHub Profile
@coltenkrauter
coltenkrauter / internet-speed-test.sh
Last active September 23, 2022 16:47
Internet speed test via terminal (Linux/ubuntu/bash/sh/zsh)
# Do a speed test
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -
# Add speedtest alias to your Z Profile
echo 'alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -"' >> ~/.zshrc
# Add speedtest alias to your Bash Profile
echo 'alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -"' >> ~/.bashrc
@coltenkrauter
coltenkrauter / get-my-public-ip-address.sh
Created September 15, 2022 16:51
One liner to get public IP address of server on bash/sh/zsh Linux Ubunutu
dig @resolver4.opendns.com myip.opendns.com +short
@coltenkrauter
coltenkrauter / automount-drive-in-ubuntu.sh
Last active March 14, 2023 20:44
Permanently mount HDD to Ubuntu / Automount partition in Linux / How to mount a drive in Linux bash/sh/zsh
# Make a directory to mount the drive to
sudo mkdir /mnt/drive1
# First step of getting the UUID of the drive is to get the device path (ex: /dev/sdb2)
lsblk -e7 -e11 # e7 to hide loop devices and e11 to hide cdrom drives
# This is the way to mount in a non-permanent way (goes away after reboot)
# sudo mount /dev/sdb2 /mnt/drive1
# Get the UUID of the drive to mount
@coltenkrauter
coltenkrauter / one-liners-append-to-file.sh
Created September 11, 2022 20:11
Bash/sh/zsh one liners, append to a file with sudo
# 1. One liner, append to a file
echo "A new line at the end of the file" >> file.txt
# 2. One liner, append to a file including newlines
echo -e "\n\nA new line at the end of the file that is preceeded by some new lines" >> file.txt
# 3. One liner, append to a file the requires sudo
echo "A new line at the end of the file that requires sudo" | sudo tee -a /etc/fstab
---
@coltenkrauter
coltenkrauter / docker-compose-plex.yml
Last active January 3, 2023 02:57
Docker compose file for setting up Plex
# docker-compose-plex.yml or docker-compose.yml
# https://github.com/linuxserver/docker-plex
# Before running 'docker-compose up -d', ensure that all directories exist and bash variables are set
# Here is an example of how you could create the dirs and set the vars needed in this file:
# BOOTSTRAP_PLEX_CLAIM= # Fill this with the code found here: https://www.plex.tv/claim/
# BOOTSTRAP_PLEX_TV=
# BOOTSTRAP_PLEX_MOVIES=
# BOOTSTRAP_PLEX_MUSIC=
@coltenkrauter
coltenkrauter / docker-compose-home-assistant.yml
Last active September 11, 2022 16:47
Docker compose file for setting up Home Assistant with ZWAVEJS in order to support Aeotec Z-Stick Gen5 Z-Wave Plus USB Gateway
# docker-compose-home-assistant.yml or docker-compose.yml
# Before running 'docker-compose up -d', ensure that all directories exist and bash variables are set
# Here is an example of how you could create the dirs and set the vars needed in this file:
# Resource: https://zwave-js.github.io/zwavejs2mqtt/#/getting-started/docker?id=installation
# BOOTSTRAP_Z_STICK_USB_ID="$(l /dev/serial/by-id/ | head -c -2)"
# BOOTSTRAP_ZWAVEJS_SESSION_SECRET="$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
# echo "export BOOTSTRAP_Z_STICK=$BOOTSTRAP_Z_STICK" >> $HOME/.bashrc
# echo "export BOOTSTRAP_ZWAVEJS_SESSION_SECRET=$BOOTSTRAP_ZWAVEJS_SESSION_SECRET" >> $HOME/.bashrc
@coltenkrauter
coltenkrauter / nginx.conf
Created January 23, 2021 21:36
Nginx configuration for SPAs (Single page applications) such as React or Angular
# https://www.zeolearn.com/magazine/setting-caching-headers-for-a-spa-in-nginx-cache
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options SAMEORIGIN;
@coltenkrauter
coltenkrauter / docker-compose.yaml
Last active January 25, 2024 19:46
Traefik V2 Docker Compose file with LetsEncrypt and HTTPS redirect - Traefik dashboard and simple whoami service
# Tutorial: https://blog.creekorful.com/2020/01/how-to-expose-traefik-2-dashboard-securely-docker-swarm/
version: '3'
services:
reverse-proxy:
image: traefik:2.3
command:
# - '--log.level=DEBUG'
- '--api=true'
- '--api.dashboard=true'
@coltenkrauter
coltenkrauter / terminus.sublime-keymap
Created February 28, 2020 17:26
Sublime Terminus key bindings
[
{
"keys": ["ctrl+t"], "command": "toggle_terminus_panel",
"args": {
"config_name": "Default",
"panel_name": "output",
}
},
{
"keys": ["ctrl+w"], "command": "terminus_close", "context": [{ "key": "terminus_view"}]
@coltenkrauter
coltenkrauter / README.md
Last active April 3, 2024 12:04
Toggle Airport: Disable Wi-Fi when connected to ethernet

toggle-airport

Code for disabling Wi-Fi when docking (connecting an ethernet adapter) and enabling Wi-Fi when disconnecting from ethernet.

I am using MacBook Pro 15'' with macOS Catalina.

Quick start

  1. Put toggleAirport.sh in the correct location with the right permissions (see comment at the top of the file)
  2. Put com.mine.toggleairport.plist in the correct location with the right permissions (see comment at the top of the file)