Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
@dharma017
dharma017 / download-live-site.sh
Created March 3, 2016 10:25
Bash: Download MySQL database & files to from live to development server
#!/bin/bash
#===============================================================================
# This is a template for a script I use on a lot of sites to copy the database
# (MySQL) and any uploaded files to the development site, and modify the
# database as required.
#
# The script should be on the development server. The live site can either be on
# the same server, or a remote server connected via SSH.
#
@dharma017
dharma017 / download-cpanel-database.sh
Created March 1, 2016 11:42
Bash: Download MySQL database from cPanel to development server
#!/bin/bash
# This is a script I used to download my live site database onto my development
# server when I used a web host that used cPanel, but didn't give me access to
# mysqldump over SSH (because they had Jailshell enabled).
# Note: The database name (DBNAME) excludes the account name prefix - i.e.
# "dbname" not "sitename_dbname".
curl http://USERNAME:PASSWORD@HOSTNAME:2082/getsqlbackup/DBNAME.sql.gz \
@dharma017
dharma017 / Easy Download Media Counter
Created February 10, 2016 07:06 — forked from corsonr/Easy Download Media Counter
Add counter to WP media
<?php
/*
Plugin Name: Easy Download Media Counter
Plugin URL: http://remicorson.com
Description: This plugin allows you to easily count downloads for a wordpress media and display it
Version: 1.0
Author: Rémi Corson
Author URI: http://remicorson.com
*/
@dharma017
dharma017 / create-mysql-db.sh
Last active February 4, 2016 09:09 — forked from hilja/create-mysql-db.sh
Shell script to create MySQL database and user
#!/bin/bash
#Usage:
#Name it something like mysql-db-create.sh
#Make it executable $ sudo chmod 755 mysql-db-create.sh
#Run it sudo ./mysql-db-create.sh dbname dbuser password
# Functions
ok() { echo -e '\e[32m'$1'\e[m'; } # Green
@dharma017
dharma017 / percona-xtrabackup.md
Created September 30, 2015 07:13 — forked from bengarrett/percona-xtrabackup.md
Installing and using Percona XtraBackup on Ubuntu 14.04 for MySQL backups.

Installing and using Percona XtraBackup

For MySQL/MariaDB database servers on Ubuntu.

Set-up and Install

Add Percona to your repository.

Backup your sources.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Edit your sources.
@dharma017
dharma017 / backup-cleanup.sh
Created September 30, 2015 07:09
Ubuntu Server CRON Scripts: Restart Server, Backup Databases, Backup Wordpress Site Files, Backup Cleanup, Ubuntu Server Log Rotation Schedule
#!/bin/bash
#start
#-----------------------------------------------------------------------
find /srv/backup/daily/databases/ -name '*.gz' -mtime +7 | xargs rm -f;
find /srv/backup/daily/websites/ -name '*.gz' -mtime +7 | xargs rm -f;
# Are Weekly Backups Implemented?
# find /srv/backup/weekly/ -name '*.gz' -mtime +30 | xargs rm -f;
#-----------------------------------------------------------------------
#end
@dharma017
dharma017 / finally.slim
Last active September 14, 2015 06:38 — forked from wesbos/finally.slim
Slim IE Conditional Tags
/[if IE 8]
| <html class="ie8 lt-ie9" lang="en">
/[if IE 9]
| <html class="ie9" lang="en">
/! [if (gte IE 9)|!(IE)]<!--> <html lang="en"> <!--<![endif]
@dharma017
dharma017 / .gitignore
Last active September 13, 2015 12:16 — forked from octocat/.gitignore
Some common global .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@dharma017
dharma017 / .bash_profile
Last active August 29, 2015 14:26 — forked from JeffreyWay/.bash_profile
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@dharma017
dharma017 / using-git.md
Last active January 6, 2016 06:42 — forked from hofmannsven/README.md
Using Git