Skip to content

Instantly share code, notes, and snippets.

View nixonmorillo's full-sized avatar

nixon morillo nixonmorillo

View GitHub Profile
@nixonmorillo
nixonmorillo / gist:8cd0d16167788b0003b78a001ac6021e
Created September 16, 2018 16:13 — forked from markjaquith/gist:6225805
WordPress multi-tenant directory structure sharing core files for opcode awesomeness, fast deployments, and low disk usage. With inspiration from @weskoop. "=>" indicates a symlink.
sites
|__ ms.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
| |__ wp-config.php
|__ one.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
@nixonmorillo
nixonmorillo / Setup WordPress Multi-tenant infrastructure
Created September 16, 2018 16:12 — forked from BjornW/Setup WordPress Multi-tenant infrastructure
A short description of how I've setup a WordPress Multi-Tenant architecture. This is based on the excellent post by Jason McCreary http://jason.pureconcepts.net/2013/04/updated-wordpress-multitenancy/ and the great ascii art explanations by Wes Koop (https://gist.github.com/weskoop/3796570) & Mark Jaquith (https://gist.github.com/markjaquith/622…
I'm using Ubuntu 12.04 and I'm following the Debian/Ubuntu way of dealing with config files. I presume you know how to work with sudo and such
- Install last stable version of WordPress (in my case 3.6) with Subversion into /opt/wordpress/3.6
- create a symlink /opt/wordpress/stable ==> /opt/wordpress/3.6
- create a directory sites in /var/www/sites
- create a directory specific for your site using the domain name e.g. /var/www/sites/example.com
- create a directory wp-content in /var/www/sites/example.com
- create a directory wordpress in /etc
- create a directory named as you site's domain name, e.g. in /etc/wordpress
- copy from /opt/wordpress/stable/wp-config-sample.php to /etc/wordpress/example.com/wp-config.php
@nixonmorillo
nixonmorillo / debian-jessie-kubernetes-1.3-manual-install-guide.md
Created January 27, 2017 06:59 — forked from apokalyptik/debian-jessie-kubernetes-1.3-manual-install-guide.md
Set up Kubernetes on 3 Debian Jessie virtual machines -- No magic

The Goal

Set up Kubernetes on 3 Debian Jessie virtual machines: One master. Two nodes. Additionally do this without any "magic" so that what is required to be running to make everything work is plain and obvious.

We will be using flannel for the inter-machine networking layer. Mainly because it is useful and it seems to be pretty popular.

The Setup

@nixonmorillo
nixonmorillo / install-composer.sh
Created October 29, 2016 19:32 — forked from matthewpizza/install-composer.sh
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@nixonmorillo
nixonmorillo / email_sender.py
Created May 31, 2016 01:32
Email sender, from a list in a database, with confirmations and other table fields
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
import pyzmail
DSN = "host=127.0.0.1 dbname=database user=postgres password=dbpass"
def leer_datos():
con = psycopg2.connect(DSN)
@nixonmorillo
nixonmorillo / Backup_Postgres.py
Created May 30, 2016 23:14
Make a Backup to the PostgreSql Server(and databases) and send it to a SFTP Server
#!/usr/bin/env python
import os
import time
import pysftp
import sys
#BD Config
username = 'postgres_username'
defaultdb = 'postgres'
port = '5432'
@nixonmorillo
nixonmorillo / Backup_mysql.py
Last active May 30, 2016 21:11
Make a Backup to the mysql server(and databases) and send it to a sftp Server
#!/usr/bin/env python
import os
import time
import pysftp
import sys
import MySQLdb
#BD Config
DB_HOST = 'host'
DB_USER = 'user'
@nixonmorillo
nixonmorillo / upgrade_pg.sh
Last active May 31, 2016 01:34 — forked from ibussieres/upgrade_pg.sh
PostgreSql Upgrader 9.1 to 9.3
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'