Skip to content

Instantly share code, notes, and snippets.

Avatar

sterling

  • Qualtrics
  • Utah
View GitHub Profile
@sterling
sterling / 99-usb-serial.rules
Created Jul 15, 2017
Static ZWave Device (Aeotec USB stick Gen5)
View 99-usb-serial.rules
# /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="zwave"
@sterling
sterling / ddns-start
Last active May 1, 2019
ASUS Merlin Google DDNS script (/jffs/scripts/ddns-start)
View ddns-start
#!/bin/sh
host=
user=
pass=
wanip=$1
resolvedip=$(nslookup $host | grep $host -A1 | awk '/^Address / {print $3}')
if [ "$wanip" == "$resolvedip" ]; then
@sterling
sterling / go.sh
Last active Apr 29, 2017
Recursively find a child directory
View go.sh
go () {
GO=""
for dir in /webhome; do
for d in {1..3}; do
D="`find $dir -type d -maxdepth $d -iname "$1"|head -n1`"
if [ -n "$D" ]; then
GO=$D
break 2
fi
@sterling
sterling / ps1.sh
Last active Apr 29, 2017
My PS1 including git info
View ps1.sh
. ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=verbose
PS1="\[\033[0;30m\]\@ \[\033[0;30m\]\w\n\[\033[0;30m\]\u\[\033[0;32m\] [\W\[\033[01;38;5;022m\]\$(__git_ps1 \" %s\")\[\033[0;32m\]]\[\033[0;30m\] $ \[\033[0m\]"
@sterling
sterling / git-prompt.sh
Last active Apr 23, 2017
Personal git prompt. Modified from git/git-prompt
View git-prompt.sh
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@sterling
sterling / handbrake-recursive-encode.ps1
Last active Feb 8, 2017
Encode video files recursively while maintaining directory structure and file names on output. Uses Windows PowerShell and HandBrakeCLI.
View handbrake-recursive-encode.ps1
gci . *.mp4 -R |
foreach-object {
$saveBase = "D:\handbrake"
$curDir = (Get-Item -Path ".\" -Verbose).FullName
$inName = $_.BaseName + $_.Extension
$inFile = $_.DirectoryName + "\" + $inName
$outFile = $saveBase + $inFile.replace($curDir, "")
$outDir = $outFile.replace($inName, "")
New-Item -path "$outDir" -type directory -force
You can’t perform that action at this time.