Skip to content

Instantly share code, notes, and snippets.

karlgray / wp-xml-to-html
Last active March 31, 2016 03:00
Quick hack to extract wordpress posts from xml to separate html files.
#!/usr/bin/php -q
/* Really nasty, really fast hack to extract all wordpress articles to .html files.
* Please test before using. It worked for a particular site to save time copy and pasting.
* There is no garantee it will work for you.
* Note this a php CLI script don't run from browser.
* I then used this to convert them to markdown files.
* find ./ -iname "*.html" -type f -exec sh -c 'pandoc "${0}" -o "./markdown/$(basename ${0%.html}.md)"' {} \;
karlgray /
Last active April 29, 2016 17:14
Prepare a Centos 6.7 Server
yum -y update
yum -y install vim wget curl
yum -y install
yum -y install Percona-Server-server-56
yum -y install
yum -y install
yum -y install php56w php56w-opcache php56w-fpm php56w-mysql mlocate vim redis php56w-pecl-redis memcached
yum -y install
yum -y install monit
karlgray / gray.repo
Last active April 27, 2016 14:26
Repo for custom rpms for clients.
name=Gray Repos
karlgray /
Created April 27, 2016 15:06
Install letsencrypt on Centos 6.7
yum -y install
yum --enablerepo=ius install git python27 python27-devel python27-pip python27-setuptools python27-virtualenv -y
yum install git
cd /root/
git clone
cd letsencrypt/
./letsencrypt-auto certonly -d
karlgray / MY_Model.php
Created October 27, 2018 17:10 — forked from codersatx/MY_Model.php
My base model class for my CodeIgniter-based cms.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
* My Model
* Used as a base class for all admin or app related model functions.
* @author Alex Garcia
* @since 0.1
* @version 1
karlgray / gist:d0388051d3f21dd6871344b3c10d7ff9
Created July 2, 2021 20:18 — forked from bryhal/gist:4129042
MYSQL: Generate Calendar Table
DROP TABLE IF EXISTS time_dimension;
CREATE TABLE time_dimension (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
db_date DATE NOT NULL,
month INTEGER NOT NULL, -- 1 to 12
day INTEGER NOT NULL, -- 1 to 31
quarter INTEGER NOT NULL, -- 1 to 4
week INTEGER NOT NULL, -- 1 to 52/53
day_name VARCHAR(9) NOT NULL, -- 'Monday', 'Tuesday'...