Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
<?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 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.
@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 / install-phalcon-on-live-server.md
Last active November 6, 2015 09:20
Install phalcon on live server Ubuntu 14.04

Ubuntu Missing add-apt-repository command

sudo apt-get install software-properties-common python-software-properties

To install Phalcon on Ubuntu you need to follow these steps:

sudo apt-add-repository ppa:phalcon/stable
sudo apt-get update
sudo apt-get install php5-phalcon
@dharma017
dharma017 / clone-all-branches-with-git.sh
Last active October 15, 2015 09:55
Clone all remote branches with Git - one liner bash command
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
@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