Skip to content

Instantly share code, notes, and snippets.

View amityweb's full-sized avatar

Laurence Cope amityweb

View GitHub Profile
@amityweb
amityweb / GoogleSpreadsheet.html
Created March 1, 2024 11:30 — forked from terrywbrady/GoogleSpreadsheet.html
Sample HTML/JS to parse a Google Spreadsheet
<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var spData = null;
function doData(json) {
spData = json.feed.entry;
}
@amityweb
amityweb / send-test-email-from-to.sh
Last active March 4, 2024 13:10
Simple bash script to send a test email from and to someone
subject="Email Test"
body="Hello World. This is an email test and I am including this paragraph of content to gain extra points if there is a substantial body message included. Thank you."
from="$1"
to="$2"
echo -e "To: Test <$to>\nFrom: Test <$from>\nSubject: $subject\n\n$body\n" | sendmail -f $from -t $to
# USAGE #
# NOTE: Some servers may need BASH not SH
# Directly from this URL:
# curl -s https://gist.githubusercontent.com/amityweb/e0d1288a719e3ec2f028ec76b551cd86/raw/ | sh -s from@domain.com to@domain.com
#!/bin/bash
DATE=$(date +%Y-%m-%d.%I-%M-%S)
echo $DATE - $1
@amityweb
amityweb / rclone-backups
Last active April 16, 2024 00:52
Rclone command to run from Amity Servers
#!/bin/bash
ps_out=`ps -ef | grep "rclone sync\|bash rclone" | grep -v 'grep'`
result=$(echo $ps_out | grep "$1")
if [ "$result" = "" ];then
# DB Dumps First
#for i in $(mysql --batch --skip-column-names -e 'SHOW DATABASES' | egrep -v 'performance_schema|information_schema|mysql|eximstats|leechprotect|cphulkd|modsec|roundcube|logaholicDB_.'); do mysqldump --single-transaction -h localhost --opt $i | gzip -c > /home/_dbbackups/$i.sql.gz; done
# Home Folder Dump
DATE=$(date +%Y-%m-%d.%H:00)
<?php
// Replace variables with yours
// Run script with "php clone_wp.php"
// Requires All in One WP Migration Unlimited stored locally and path updated below - other backup plugins can be used with some teaks to WP CLI commands
// Requires All in One Backup file created source website and path and filename copied to that below
// iThemes securiy is used on source system to hide the admin URL
// WP Migrate DB is installed in source system to do find and replace of some settings, like a new Admin URL
// Check WP Config settings at bottom, you probably will want your own or none of these
@amityweb
amityweb / update_all_wp_sites.sh
Last active March 15, 2024 08:53
Bash script to iterate through all Wordpress sites on RunCloud and update the core, plugins and themes
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
@amityweb
amityweb / wp-cron.sh
Created May 27, 2021 13:11
Bash script to iterate through all Wordpress sites on RunCloud and run Wordpress Cron
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
/* HTML/PHP */
<div class="accordion">
<?php foreach($accordions AS $accordion) : ?>
<div class="accordion-row col sixcol">
<a href="#" class="accordion-title"><?php echo $accordion['question'];?></a>
<div class="accordion-text"><?php echo $accordion['answer'];?></div>
</div>
<?php endforeach;?>
</div>
@amityweb
amityweb / google-recaptcha-v2-php-code
Last active June 16, 2020 09:59
Google ReCaptcha v2 PHP Code
// Add in to HTML where you want the box to be
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
<div class="captcha_wrapper">
<div class="g-recaptcha" data-sitekey="YOUR_PUBLIC_KEY"></div>
</div>
// Add into PHP validation to check the submitted captcha response is a success or fail
/* Google ReCaptcha Verification */
@amityweb
amityweb / setHiveMaxTemp.php
Created November 17, 2019 16:45
Set Hive Heating Maximum Temperature using PHP
<?php
// Thanks to http://www.smartofthehome.com/2016/05/hive-rest-api-v6/
// Set maxTemp below
// Set your username and password
// To get the list of all devices to get the thermostat ID, run this script with deviceList as an argument after it
/* Set Your Variabes */
$maxTemp = 19.5; // Or 19 or 20 or whatever!
$username = 'your-hive-username';