Skip to content

Instantly share code, notes, and snippets.

Avatar

Zaid Daba'een zaiddabaeen

View GitHub Profile
@zaiddabaeen
zaiddabaeen / exportMySQLUsersPDO.php
Created Feb 23, 2016
Exports MySQL Users and Privileges using PDO
View exportMySQLUsersPDO.php
* 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 Jan 12, 2016
Automate the backup of your projects locally and remove old backups.
View Automate Code Backup
#!/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 Jan 12, 2016
This script uses aws-missing-tools to create daily backups (purged after three days) and monthly backups (purged after a month).
View Automate EC2 Backups
#!/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 Sep 29, 2015
Simple javascript function to draw rectangles around an element to focus on it
View tutorial.js
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 Aug 29, 2015
forever Ghost init.d script for CentOS 7.0
View README.md

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: