Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧
Whilefalse

Colten Krauter coltenkrauter

🎧
Whilefalse
  • Stevensville, MT
View GitHub Profile
@coltenkrauter
coltenkrauter / ssh-config.sh
Created Oct 4, 2022
Git SSH config and adding secret key to Apple Keychain for use with Sublime Merge
View ssh-config.sh
Host github.com
Hostname github.com
User coltenkrauter
Port 22
IdentityFile /users/coltenkrauter/.ssh/id_ed25519_github
# ssh-add --apple-use-keychain ~/.ssh/id_ed25519_github
@coltenkrauter
coltenkrauter / internet-speed-test.sh
Last active Sep 23, 2022
Internet speed test via terminal (Linux/ubuntu/bash/sh/zsh)
View internet-speed-test.sh
# 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 Sep 15, 2022
One liner to get public IP address of server on bash/sh/zsh Linux Ubunutu
View get-my-public-ip-address.sh
dig @resolver4.opendns.com myip.opendns.com +short
@coltenkrauter
coltenkrauter / automount-drive-in-ubuntu.sh
Created Sep 12, 2022
Permanently mount HDD to Ubuntu / Automount partition in Linux / How to mount a drive in Linux bash/sh/zsh
View automount-drive-in-ubuntu.sh
# 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
# 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 Sep 11, 2022
Bash/sh/zsh one liners, append to a file with sudo
View one-liners-append-to-file.sh
# 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 Sep 11, 2022
Docker compose file for setting up Plex
View docker-compose-plex.yml
# 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=
# echo "export BOOTSTRAP_PLEX_CLAIM=$BOOTSTRAP_PLEX_CLAIM" >> $HOME/.bashrc
@coltenkrauter
coltenkrauter / docker-compose-home-assistant.yml
Last active Sep 11, 2022
Docker compose file for setting up Home Assistant with ZWAVEJS in order to support Aeotec Z-Stick Gen5 Z-Wave Plus USB Gateway
View docker-compose-home-assistant.yml
# 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 Jan 23, 2021
Nginx configuration for SPAs (Single page applications) such as React or Angular
View nginx.conf
# 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 Jun 27, 2022
Traefik V2 Docker Compose file with LetsEncrypt and HTTPS redirect - Traefik dashboard and simple whoami service
View docker-compose.yaml
# 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 Feb 28, 2020
Sublime Terminus key bindings
View terminus.sublime-keymap
[
{
"keys": ["ctrl+t"], "command": "toggle_terminus_panel",
"args": {
"config_name": "Default",
"panel_name": "output",
}
},
{
"keys": ["ctrl+w"], "command": "terminus_close", "context": [{ "key": "terminus_view"}]