Skip to content

Instantly share code, notes, and snippets.

@devinberry
devinberry / keyboardEmailLogin.scpt
Created August 27, 2016 04:47
Applescript keyboard emulation with web email login form
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
(*
Proof of concept to automate web based email login
Using keyboard emulation on a web form
*)
tell application "Google Chrome"
-- Uncommnet the below and enter in the web address of your email login page
@devinberry
devinberry / unmountSmbDrives.scpt
Last active August 27, 2016 04:49
AppleScript - Needed a simple way to simple unmount all the SMB mounted drives
##################################################################
# #
# First basic script to unmount smb shares #
# #
# Feature: #
# Will only umount non busy filesystems #
# #
##################################################################
property myDisks : {"/Volumes/Gigantor", "/Volumes/ExtraMovies", "/Volumes/StorageDisk", "/Volumes/Music_Compressed", "/Volumes/My_Book", "/Volumes/Music", "/Volumes/MoreMovieS", "/Volumes/Blank", "/Volumes/MacOsX_SoftWare", "/Volumes/miniStorage", "/Volumes/Movies", "/Volumes/My_Book_2", "/Volumes/XtraLarge"}
@devinberry
devinberry / mountSmbDrives.scpt
Last active August 27, 2016 04:50
AppleScript - Needed a simple way to mount all my SMB Drives without the Finder opening a window for each one, enjoy ;)
##########################################################################
# #
# Needed a simple way to mount SMB drives with no Finder window #
# #
# Native OSX SMB mount construct #
# #
# try #
# mount volume "smb://workgroup;userid:password@ipaddress/drive$" #
# end try #
# #
@devinberry
devinberry / launchITerm.sh
Created July 13, 2016 18:58
MacOSx only Utility to help launch iTerm window from current directory with custom commands credit goes to http://www.entropy.ch
#!/usr/bin/env bash
#
# Open a new iTerm session with the command given
# as argument.
#
# - If there are no arguments, the new iTerm window will
# be opened in the current directory, i.e. as if the command
# would be "cd `pwd`".
# - If the first argument is a directory, the new iTerm will
# "cd" into that directory before executing the remaining
@devinberry
devinberry / findCorruptMovieFiles.sh
Created July 13, 2016 18:55
Utility script to help aid in testing if movie files are corrupt enjoy ;)
#!/usr/bin/env bash
movieFileLocation="/Volumes/networkDriveLocation"
filecount=$(find "$movieFileLocation" -depth 0 -type f | wc -l)
find "$movieFileLocation" -depth 0 -type f -iname \*.avi -o -iname \*.mp4 -o -iname \*.mkv -o -iname \*.m4v -o -iname \*.wmv -o -iname \*.mov -o -iname \*.mpg -o -iname \*.mpeg -o -iname \*.wma -o -iname \*.asf -o -iname \*.asx -o -iname \*.rm -o -iname \*.3gp -o -iname \*.0gm | {
processed=0
corrupt=0
while read -r pathname
do
if ! ffprobe -v quiet -show_error -i "$pathname"
@devinberry
devinberry / createSslCerts.sh
Created July 13, 2016 18:53
Utility script to help aid with creation of local dev ssl certs, dont remember where i found this, thought I would share ;)
#!/usr/bin/env bash
which openssl >/dev/null 2>&1
if [ $? -eq 1 ]
then
echo -e "Installing openssl package...\n"
sudo apt-get install -yqq openssl
fi
which openssl >/dev/null 2>&1
@devinberry
devinberry / debug.sh
Last active April 6, 2022 03:43
Bash Deubg Script Cant take credit for this, http://wiki.bash-hackers.org/scripting/debuggingtips thought I would share very useful
#!/usr/bin/env bash
#useage: sh debug.sh mybashscripttodebug.sh
# Very useful bash script debugger produces the funtion name the actual
# call with variable|value subsitution and line number
color_def="~/.colorrc"
if [[ -f $color_def ]]; then
. $color_def
@devinberry
devinberry / movieFileExpander.sh
Created July 13, 2016 18:40
beta version still some bugs and issues to work out thought I would share current efforts enjoy ;)
#!/usr/bin/env bash
#######################################################################################
## ##
## movieFileExpander.sh ##
## ##
## A utility script to help in the decompression extraction file renaming ##
## and finally moving to a final destination for viewing purposes ##
## Created out of the need to be lazy and to automate all this manual work ##
## Gathered from other various articles blogs and scripts, tweaked to personal ##
find . -name "file_extension" -print|awk '{f=$0;sub("filename_string_to_replace","");print "mv "f" "$0}'|sh