Skip to content

Instantly share code, notes, and snippets.


Colten Krauter coltenkrauter

  • Stevensville, MT
View GitHub Profile
coltenkrauter / .profile
Last active Mar 2, 2021
WSL2 .profile
View .profile
# ~/.profile
cd ~/Repositories
# Useful aliases
alias subl="/mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe"
alias chrome="/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe"
alias github="chrome"
alias downloads="echo /mnt/c/Users/Colten/Downloads/"
alias clo="git clone"
coltenkrauter / docker-pip3-cryptography-dependency
Last active Sep 29, 2020
Resolve issues where docker pip install fails due to a cryptography dependency.
View docker-pip3-cryptography-dependency
# For APT
apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
# For APK
apk add python3-dev libffi-dev libressl-dev openldap-dev
# Example alpine docker file
FROM python:3.7-alpine
coltenkrauter /
Last active Nov 29, 2019
Remount NTSF drive in WSL2 with the metadata option so chmod will work.
# Remount NTSF drive in WSL2 with the metadata option so chmod will work.
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata
# If you get an error "target is busy" then try to cd / before running the above commands. You may also have to exit other terminals that are using WSL2.
coltenkrauter / git-automatic-commit-signing
Last active Dec 27, 2019
Quickly start signing GitHub git commits - GPG Key Generation, global automatic commit signing
View git-automatic-commit-signing
# I am using WSL2 on Windows 10
# Generate GPG key
gpg --full-generate-key
# List keys, find the one you just made and grab the key id
gpg --list-secret-keys --keyid-format LONG
# sec rsa4096/1124F0AFF0B78C69 2019-10-16 [SC] # LONG key id in this case is 1124F0AFF0B78C69
coltenkrauter / fix-wsl2-dns-resolution
Last active Sep 30, 2022
Fix DNS resolution in WSL2
View fix-wsl2-dns-resolution
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
coltenkrauter /
Created Oct 24, 2019
Python code for normalizing audio files.
# Credit:
# pip install pydub
from pydub import AudioSegment
def match_target_amplitude(sound, target_dBFS):
change_in_dBFS = target_dBFS - sound.dBFS
return sound.apply_gain(change_in_dBFS)
sound = AudioSegment.from_file("yourAudio.m4a", "m4a")
coltenkrauter / html-input-remove-chrome-autofill-background.css
Last active Sep 27, 2022
Remove Chrome's autofill background color on HTML inputs. This unique solution makes the background color to transparent rather then a solid color.
View html-input-remove-chrome-autofill-background.css
// Remove chrome autofill color from inputs
input:-webkit-autofill:active {
transition: background-color 5000000s ease-in-out 0s;
# Credit:
coltenkrauter /
Last active Nov 15, 2019
A simple helper function for formatting/indenting a Python object as JSON.
import json
# Example usage: print(pretty_json(some_dict))
def pretty_json(object):
return json.dumps(object, indent=4)
except Exception as exception:
print("---> Unable to parse object as JSON")
return str(object)
coltenkrauter / .zprofile
Last active May 1, 2020
Zsh startup script: make some aliases, install some packages, export some certs from keychain and set environment variables.
View .zprofile
# Setup subl
ln -s /Applications/Sublime\ /usr/local/bin/subl > /dev/null 2>&1
# Helper functions
commit() {
echo '\nCommit message: '
local temp
vared temp
echo ''
coltenkrauter /
Last active May 19, 2022
Toggle Airport: Disable Wi-Fi when connected to ethernet


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 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)