Merge branch 'master' of github.com:Jab2870/dotfiles

master
Jonathan Hodgson 6 years ago
commit 41c8cb76fa
  1. 46
      bin/GoDaddyScript
  2. 29
      bin/backup
  3. 2
      bin/backupExcludes
  4. 30
      bin/git-initial-commit
  5. 2
      config/oh-my-zsh/aliases.zsh
  6. 3
      config/oh-my-zsh/promptconfig.zsh
  7. 2
      gitconfig

@ -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

@ -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

@ -0,0 +1,2 @@
.git/
node_modules/

@ -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"

@ -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 '

@ -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/")

@ -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

Loading…
Cancel
Save