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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / README.md
Created May 8, 2016 06:43 — forked from magnetikonline/README.md
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
<?php
// Published under GPL
// tutorial here: https://codeable.io/community/how-to-import-json-into-wordpress/
class Developer_Import {
public function __construct() {
add_action( 'wp_ajax_import_developer', array( $this, 'import_developer' ) );
@dharma017
dharma017 / README.md
Created June 1, 2016 12:52 — forked from rowanmanning/README.md
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/