Skip to content

Instantly share code, notes, and snippets.

@oterox
oterox / px_wp_cpt.sublime-snippet
Created September 25, 2012 19:55
Sublime Text Custom Post Type Snippet
<snippet>
<content><![CDATA[
add_action( 'init', 'register_cpt_${1:test}' );
function register_cpt_${1:test}() {
\$labels = array(
'name' => _x( '${2:Tests}', '${1:test}' ),
'singular_name' => _x( '${3:Test}', '${1:test}' ),
@oterox
oterox / wp_bck.sh
Last active December 12, 2015 02:58
bash script to backup WP It generates 3 files: - sql dump - theme folder backup - wp-content folder backup
#!/bin/bash
echo $*
CURRENT_DATE=`date '+%Y%m%d-%Hh%M'`
WP_DATABASE=database_name
WP_FOLDER=wpfolder
WP_THEME=themefoldername
WP_CONTENT_PATH=/var/www/"$WP_FOLDER"/
WP_THEME_PATH=/var/www/"$WP_FOLDER"/wp-content/themes/
#Backup database
@oterox
oterox / px_helper.php
Last active December 14, 2015 04:39
Worpdress extra functions
<?php
/**
* PXHelper by Javier Otero
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*/
// ---------------------------------------------------
@oterox
oterox / wp_bck.py
Last active December 14, 2015 10:18
simple python script for WP backups It generates 3 files: - sql dump - theme folder backup - wp-content folder backup
#!/usr/bin/python
import time
import os
username="db_username"
password="db_pass"
hostname="db_host"
filestamp=time.strftime('%Y%m%d-%H%M')
rootfolder="/var/www/www.pixellarylabs.com/public_html/clients/"
@oterox
oterox / package.json
Created October 9, 2014 09:50
package.json for wordpress
{
"name": "package-name",
"version": "1.0.0",
"description": "...",
"main": "filename.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
@oterox
oterox / Gruntfile.js
Created October 9, 2014 09:52
Gruntfile.js for wordpress
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
dist: {
src: 'readme.txt',
dest: 'README.md'
}
},
@oterox
oterox / mirrorWP.sh
Created February 1, 2015 16:46
Mirrors a WordPress Installation to another host
#!/bin/bash
#
# Description:
# Mirrors a WordPress Installation to another host, accessible through a mirror subdomain
#
#
# Assumptions:
# mysql and ssh usernames are the same
# databases are on the same server and accessible
@oterox
oterox / wpinstall.sh
Last active October 9, 2018 05:11
Wordpress install script
#!/bin/sh
#
# Instant Wordpress!
# ------------------
# Script for installing the latest version of WordPress plus a number of useful plugins.
# Source : https://github.com/snaptortoise/wordpress-quick-install
#
#
# Latest version of WP
scp -v -r 20141102_v2_file.tar.gz usuario@176.66.251.188:/home/usuario
@oterox
oterox / gist:9b6cc85aa1a3c497074f
Last active August 29, 2015 14:16
Mysql backup all databases to single files
#!/bin/bash
WP_DBUSER=root
WP_DBPASS=password
BCK_FILE_DB=/path/to/backups/
DBS=`mysql -u$WP_DBUSER -h localhost -p$WP_DBPASS -Bse 'show databases'`
for db in $DBS
do
echo 'database:' $db
mysqldump --add-drop-table -h localhost -u $WP_DBUSER -p $db --password=$WP_DBPASS | gzip > $BCK_FILE_DB$db.tar.gz