From cfc77fc119295e1fe66ebe206b658c03ced9008b Mon Sep 17 00:00:00 2001 From: Benjamyn Date: Sat, 10 Feb 2018 16:27:53 -0500 Subject: [PATCH] Initial commit --- README.md | 3 +++ email-tools/README.md | 1 + email-tools/example.imapsync | 3 +++ email-tools/imapsync.py | 4 ++++ email-tools/imapsync.sh | 25 +++++++++++++++++++++++++ website-tools/README.md | 1 + website-tools/htaccess-rename-back.sh | 7 +++++++ website-tools/htaccess-rename.sh | 8 ++++++++ website-tools/htaccess-test.sh | 10 ++++++++++ 9 files changed, 62 insertions(+) create mode 100644 README.md create mode 100644 email-tools/README.md create mode 100644 email-tools/example.imapsync create mode 100644 email-tools/imapsync.py create mode 100644 email-tools/imapsync.sh create mode 100644 website-tools/README.md create mode 100755 website-tools/htaccess-rename-back.sh create mode 100755 website-tools/htaccess-rename.sh create mode 100755 website-tools/htaccess-test.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ca753b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +This is a collection of work related scripts that I am writing + +NOTE: Due to certain events that are going on things may be incomprehensible diff --git a/email-tools/README.md b/email-tools/README.md new file mode 100644 index 0000000..ef5d449 --- /dev/null +++ b/email-tools/README.md @@ -0,0 +1 @@ +Not sure if I want to use Python or Bash just yet, So i'll write it in both diff --git a/email-tools/example.imapsync b/email-tools/example.imapsync new file mode 100644 index 0000000..587a08b --- /dev/null +++ b/email-tools/example.imapsync @@ -0,0 +1,3 @@ +mail.benjamyn-testing.com mail2.benjamyn-testing.com +test@benjamyn-testing.com pass123 test2@benjamyn-testing.com pass123,' +test3@benjamyn-testing.com pas#42$ test4@benjamyn-testing.com pa$$89* diff --git a/email-tools/imapsync.py b/email-tools/imapsync.py new file mode 100644 index 0000000..6a6a980 --- /dev/null +++ b/email-tools/imapsync.py @@ -0,0 +1,4 @@ +#!/usr/bin/python3 +# Benjamyn Love 2017 +# I cannot concerntrate at the moment :( + diff --git a/email-tools/imapsync.sh b/email-tools/imapsync.sh new file mode 100644 index 0000000..21de8fa --- /dev/null +++ b/email-tools/imapsync.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#Benjamyn Love 2017 +#this script will generate imapsync commmands from email account information that we supply (hopefully) + + +## Usage for imapsync in its most basic form +# imapsync --host1 [Domain name or the IP of the source server] --user1 [Username of the source account (Usally the email address iteself, it depends on how the server auths)] --pass1 [The password for the source account] --host2 [Domain name or the IP of the destination server] [Other --*1 params] --user2 [Username of the destination account (Usally the email address iteself, it depends on how the server auths)] --pass1 [The password for the detination account] [Other --*2 params] +# Using my email account as a baseline test@benjamyn-testing.com will be moved to test2@benjamyn-testing.com[Other --*2 params] +# The command will look like: +# Using my email account as a baseline test@benjamyn-testing.com will be moved to test2@benjamyn-testing.com +# imapsync --host1 benjamny-testing.com --user1 "test@benjamyn-testing.com" --pass1 '"password1"' --user2 "test2@benjamyn-testing.com" --pass2 '"pas$w0rd*("' +# Note the ' followed by the " this makes sure the shell will not glob any of the special chars in the password + +# Ideas for usage of this script +# Add server IP/Domain to a file followed by usernames and passwords +# i.e +# mail.benjamyn-testing.com +# test@benjamyn.testing.com,password1,test2@benjamyn-testing.com,password2 +# +# The aboce will not work... fucking passwords +# Will need to use tab delimiters ' ' +# + +## TODO Stop being a basic bitch and change it to just use awk +cat $1 | while read a; do echo $a | awk '{print $1 $2 $3 $4}'; done diff --git a/website-tools/README.md b/website-tools/README.md new file mode 100644 index 0000000..c1f1d1f --- /dev/null +++ b/website-tools/README.md @@ -0,0 +1 @@ +NOTE: These are meant to be run pasted into the terminal so these will mainly be oneliners, the .sh files are for easy reading and storing diff --git a/website-tools/htaccess-rename-back.sh b/website-tools/htaccess-rename-back.sh new file mode 100755 index 0000000..4610114 --- /dev/null +++ b/website-tools/htaccess-rename-back.sh @@ -0,0 +1,7 @@ +#!/bin/bash +#Benjamyn Love 2017 +#renames the .htaccess.vipback to .htacces +# + +#find . -name ".htaccess.vipback" -printf %h\\n | while read a; do mv -v $a/.htaccess.vipback $a/.htaccess; done +if [[ "$PWD" == "/home/"?* ]]; then find . -name ".htaccess.vipback" -printf %h\\n | while read a; do mv -v $a/.htaccess.vipback $a/.htaccess; done; else echo "Not in a users home directory"; fi diff --git a/website-tools/htaccess-rename.sh b/website-tools/htaccess-rename.sh new file mode 100755 index 0000000..55c1fbb --- /dev/null +++ b/website-tools/htaccess-rename.sh @@ -0,0 +1,8 @@ +#!/bin/bash +#Benjamyn Love 2017 +#finds and renames all .htaccess files to .htaccess.vipback (This name is to avoid clobbering client .htaccess backups) +#run in users home directory not anywhere else + +#TODO add the homedir check if [[ "$PWD" == *"home/"?* ]]; then; echo 1; else echo 0; fi + +if [[ "$PWD" == "/home"?* ]];then find . -name ".htaccess" -exec mv -v {} {}.vipback \;;else echo "Not in users home directory";fi diff --git a/website-tools/htaccess-test.sh b/website-tools/htaccess-test.sh new file mode 100755 index 0000000..620749f --- /dev/null +++ b/website-tools/htaccess-test.sh @@ -0,0 +1,10 @@ +#!/bin/bash +#Benjamyn Love 2017 +#this script will setup a test environment to test the .htaccess scripts/commands on + +#make directories to simulate client guff +mkdir blog shop dev staging +mkdir blog/images shop/products + +#create the .htaccess files +touch .htaccess blog/.htaccess blog/images/.htaccess shop/.htaccess shop/products/.htaccess dev/.htaccess staging/.htaccess