diff --git a/bin/GoDaddyScript b/bin/GoDaddyScript new file mode 100644 index 00000000..9da732a8 --- /dev/null +++ b/bin/GoDaddyScript @@ -0,0 +1,46 @@ +#!/bin/bash + +# This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection. +# Special thanks to mfox for his ps script +# https://github.com/markafox/GoDaddy_Powershell_DDNS +# +# First go to GoDaddy developer site to create a developer account and get your key and secret +# +# https://developer.godaddy.com/getstarted +# Be aware that there are 2 types of key and secret - one for the test server and one for the production server +# Get a key and secret for the production server +# +#Update the first 4 variables with your information + +domain="########" # your domain +name="########" # name of A record to update +key="########" # key for godaddy developer API +secret="########" # secret for godaddy developer API + +headers="Authorization: sso-key $key:$secret" + +# echo $headers + +result=$(curl -s -X GET -H "$headers" "https://api.godaddy.com/v1/domains/$domain/records/A/$name") + +#echo "Current record: $result" + +dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") +echo "dnsIp:" $dnsIp + +# Get public ip address there are several websites that can do this. +ret=$(curl -s GET "http://ipinfo.io/json") +currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b") +echo "currentIp:" $currentIp + + if [ $dnsIp != $currentIp ]; + then + echo "Ips are not equal" + request='{"data":"'$currentIp'","ttl":1800}' + echo $request + nresult=$(curl -i -s -X PUT \ + -H "$headers" \ + -H "Content-Type: application/json" \ + -d $request "https://api.godaddy.com/v1/domains/$domain/records/A/$name") +# echo $nresult +fi diff --git a/bin/backup b/bin/backup new file mode 100755 index 00000000..a6b6caf5 --- /dev/null +++ b/bin/backup @@ -0,0 +1,29 @@ +#!/usr/bin/bash + +#Directory on the server to backup to +BACKUPDIR='/mnt/TimeMachine/Backup-JH/backups/' +LATEST=$(ssh officeServerJH find ${BACKUPDIR} -type d -depth 1 | sort | tail -n 1) +TODAY=$(date -I -d "today") +echo ${LATEST##*\/} +echo ${TODAY} + +#This can be tricked by having a folder with a date after the current date +if [[ ${LATEST##*\/} = ${TODAY} ]]; then + echo "There already seems to have been a backup today" + echo "If you want to rename the folder ${LATEST} then run again" + exit 0 +fi + +#Backup sites directory +rsync --archive --one-file-system --hard-links --human-readable --inplace\ + --exclude-from=./backupExcludes\ + --link-dest=${LATEST}\ + ~/Sites officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose + +#Backup Documents Directory +rsync --archive --one-file-system --hard-links --human-readable --inplace\ + --exclude-from=./backupExcludes\ + --link-dest=${LATEST}\ + ~/Documents officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose + +#At some point, add ability to delete old backups diff --git a/bin/backupExcludes b/bin/backupExcludes new file mode 100644 index 00000000..c8dbc491 --- /dev/null +++ b/bin/backupExcludes @@ -0,0 +1,2 @@ +.git/ +node_modules/ diff --git a/bin/git-initial-commit b/bin/git-initial-commit new file mode 100755 index 00000000..6d24d8a5 --- /dev/null +++ b/bin/git-initial-commit @@ -0,0 +1,30 @@ +#!/usr/bin/bash + +# What should the initial commit be for a repo? +# +# Idea came after reading this blog post: https://blog.no-panic.at/2014/10/20/funny-initial-git-commit-messages/ + +commits=( +"This is where it all begins..." +"Commit committed" +"Version control is awful" +"COMMIT ALL THE FILES!" +"The same thing we do every night, Pinky - try to take over the world!" +"Lock S-foils in attack position" +"This commit is a lie" +"I'll explain when you're older!" +"Here be Dragons" +"Reinventing the wheel. Again." +"This is not the commit message you are looking for" +"Batman! (this commit has no parents)" +"In the beginning, the code was without form and was void()…" +) + +# Seed random generator +RANDOM=$$$(date +%s) + +# Get random expression... +selectedexpression=${commits[$RANDOM % ${#commits[@]} ]} + +# Write to Shell +git commit --allow-empty -m "$selectedexpression" diff --git a/config/oh-my-zsh/aliases.zsh b/config/oh-my-zsh/aliases.zsh index 6b0a769e..8e1d3803 100644 --- a/config/oh-my-zsh/aliases.zsh +++ b/config/oh-my-zsh/aliases.zsh @@ -38,7 +38,7 @@ alias cls='clear; screenfetch' #An alias for my standard less configuration #I don't set it to lessc because sometimes I don't use this config and I always forget how to ignore an alias #alias myless='lessc --clean-css --source-map-basepath=/home/jonathan/Sites/charts/public_html --source-map --autoprefix="last 3 versions, ie >= 9" styles.less styles.min.css' -alias myless='lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 9" styles.less styles.min.css' +alias myless='lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 11" styles.less styles.min.css' # Git shortcuts alias status='git status ' diff --git a/config/oh-my-zsh/promptconfig.zsh b/config/oh-my-zsh/promptconfig.zsh index 5f4df738..c395124f 100644 --- a/config/oh-my-zsh/promptconfig.zsh +++ b/config/oh-my-zsh/promptconfig.zsh @@ -37,10 +37,11 @@ function my_dir(){ elif [[ -e "$ph/bin/magento" ]]; then #If magento icon=$magentoSiteIcon fi - current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$icon\1.local/") + current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$icon\1.local.jh/") fi + # Replace Dropbox with icon current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Dropbox/$dropboxIcon/") diff --git a/gitconfig b/gitconfig index 5f458d1c..7175bd0d 100644 --- a/gitconfig +++ b/gitconfig @@ -15,6 +15,8 @@ detach = "!git checkout $(git rev-parse HEAD)" undo = reset --soft HEAD^ + random-commit = "!git commit -m \"$(w3m whatthecommit.com | head -n 1)\"" + [filter "lfs"] process = git-lfs filter-process required = true