Skip to content

Instantly share code, notes, and snippets.

coverage
@ntpeters
ntpeters / dotstat.sh
Last active January 2, 2020 09:12
Dotfile Status Script
#!/usr/bin/env/bash
# This is a simple script to check the current local/remote status of your
# dotfiles, and prompt to update them if needed.
#
# Update the contents of the 'sync_dotfiles' function below to change the
# method for performing dotfile updates.
#
# You must set the 'LOCAL_DOTFILES_REPOSITORY' environment variable
# to point to the path of your local dotfiles repo prior to executing this script.
@ntpeters
ntpeters / make-extensions
Last active August 29, 2015 14:17
Executes wildcard make targets based on file extension
for file in $(find . -iregex '.*\(wav\|scss\|svg\)' -printf '%f\0'); do
extension=$(cut -d '.' -f 2)
case "$extension" in
wav)
make "${file}.mp3"
make "${file}.ogg"
;;
scss)
make "${file}.css"
;;
@ntpeters
ntpeters / bluset.sh
Last active August 29, 2015 14:16
Configures bluetooth headphones with PulseAudio
#!/usr/bin/env bash
# A simple script to enable A2DP mode on bluetooth headphones with PulseAudio
# MAC address of the target bluetooth device
device_mac="57:D3:98:0A:26:05"
echo "Setting up bluetooth headphones. You will be prompted for password if required."
echo "Restarting bluetooth service..."
sudo systemctl restart bluetooth
@ntpeters
ntpeters / sudo_bang.sh
Last active November 10, 2017 17:16
ZSH Compatible Sudo Bang Bang
# Add to your '.zshrc' file to create an alias to 'sudo !!'
# Elevates the last run command using sudo
function elevate_last_command() {
# Check if running with ZSH history verification
if [ -z ${HIST_VERIFY+x} ]; then
setopt no_histverify
sudo `fc -ln -1`
setopt histverify
else