Skip to content

Instantly share code, notes, and snippets.

View zaiddabaeen's full-sized avatar

Zaid Daba'een zaiddabaeen

View GitHub Profile
@zaiddabaeen
zaiddabaeen / exportMySQLUsersPDO.php
Created February 23, 2016 11:47
Exports MySQL Users and Privileges using PDO
* Feel free to improve it.
* Original by Janich: https://gist.github.com/janich/6121771
*
* @requires PHP 5.3+
* @package ExportMySQLUsers
* @author Zaid Daba'een
* @license http://www.dbad-license.org/ DBAD license
*/
// Set up database root credentials
$host = 'localhost';
@zaiddabaeen
zaiddabaeen / Automate Code Backup
Created January 12, 2016 11:28
Automate the backup of your projects locally and remove old backups.
#!/bin/bash
# Automate the backup of your projects locally and remove old backups.
# Run a daily cronjob such as:
# 0 1 * * * bash /etc/cron.daily/code_backup.sh >/dev/null 2>&1
# Author: Zaid Daba'een
projects=( project1 project2 project3 )
for i in "${projects[@]}"
do
@zaiddabaeen
zaiddabaeen / Automate EC2 Backups
Last active January 12, 2016 11:15
This script uses aws-missing-tools to create daily backups (purged after three days) and monthly backups (purged after a month).
#!/bin/sh
# This script uses aws-missing-tools to create daily backups (purged after three days) and monthly backups (purged after a month).
# Run a cronjob daily such as:
# 0 4 * * * sh /etc/cron.daily/server-backup.sh >> /var/log/ec2.log 2>&1
# Where server-backup.sh is this script.
# Author: Zaid Dabain
DATE=`date +"%d"`
VOLUME="vol-abc vol-def vol-qwe"
@zaiddabaeen
zaiddabaeen / tutorial.js
Created September 29, 2015 13:09
Simple javascript function to draw rectangles around an element to focus on it
var allrect, lrect, rrect, urect, brect, previousOverflow;
//Dividing divs. Left and right are biggest
//||--||
//||oo||
//||oo||
//||--||
function bound(id, margin){
@zaiddabaeen
zaiddabaeen / README.md
Last active August 29, 2015 14:28
forever Ghost init.d script for CentOS 7.0

Copy the above file to /etc/init.d/.

Change the NODE_PATH variable to your index.js path. Change PATH variable to your which node

Usage: service ghost start service ghost stop service ghost restart

To set to run at boot: