Skip to content

Instantly share code, notes, and snippets.

@HomeFlix
HomeFlix / bellchange.sh
Last active May 8, 2026 14:47
Auto replace of default chime.wav with custom.wav for Unifi G4 Doorbell Pro
#!/bin/bash
clear
if [ "$1" = "" ]
then
echo "Usage: $0 <Custom wav filename in current dir to use>"
ls *.wav
exit 1
fi
echo "Step 1 ..."
sshpass -p<Unifi-Protect-Password> ssh root@<Unifi-Protect-IP> << EOF
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then