Skip to content

Instantly share code, notes, and snippets.

View rob-watts's full-sized avatar

Rob Watts rob-watts

View GitHub Profile
@rob-watts
rob-watts / array_to_xml
Created November 26, 2018 20:08
PHP Array To XML
// this function takes an array (or MD array) and returns properly formatted XML without numeric element names.
// based on array_to_xml from https://stackoverflow.com/questions/1397036/how-to-convert-array-to-simplexml
function array_to_xml( $data, &$xml_data, $element = "") {
foreach( $data as $key => $value ) {
if(! is_numeric($key) ){
$element = $key;
//print $element . "<br>";
} else {
$element = rtrim($element,'s');
@rob-watts
rob-watts / callfiresms.sh
Created July 11, 2018 16:24
A shell script to send an sms message via callfire api
#!/usr/bin/env bash
function usage {
programName=$0
echo "description: use this program to send an email using the SendGrid API"
echo "usage: $programName [-p \"to phone\"] [-m \"message\"]"
echo " -p The recipient phone"
echo " -m The message"
exit 1
}
@rob-watts
rob-watts / backup_mysql.sh
Last active July 11, 2018 16:26
MySQL Backup with remote logging (longly) and sms notifications (callfire)
#!/bin/bash
# Script Description: this script backs up the database defined in $DB_NAME to $DB_PATH and offloads the product to S3
# Requirements: Amazon S3 account & credentials, s3 command line tools, mysql credentials, loggly account, call fire account
# Note: This script reveals tokens and credentials for mysql, amazon, loggly and callfire.
# Run: via cron or ./
# Rob Watts
# Version 1.1
# Modified: July 11th 2018
@rob-watts
rob-watts / pb.sh
Created September 5, 2017 22:55
PushBullet Shell Script
#!/bin/sh
function usage {
programName=$0
echo "description: A simple shell script to send PushBullet notices"
echo "usage: $programName [-t \"type\"] [-s \"subject\"] [-m \"messagel\"]"
echo " -t The type (note, file or link) this script only supports 'note'"
echo " -s The subject"
echo " -m The message"
exit 1