Skip to content

Instantly share code, notes, and snippets.

View marklindhout's full-sized avatar

Mark Lindhout marklindhout

View GitHub Profile
#!/bin/bash
# Author: Mark P. Lindhout
# Date: 2013-02-10
# Remarks:
# This file can be used for backing up servers to an RSYNC server. It assumes:
# 1. The existence of the /var/mysqldumps/ and /var/installed-packages/ folders
# 2. An SSH key already exchanged with the $REMOTE_HOST
# 3. Existing folders on the $REMOTE_HOST for each daily, weekly and monthly backups.
# 4. The possibility to do mysql and mysqldump commands without needing a password.
@marklindhout
marklindhout / wp-db-migrate.sql
Created September 26, 2012 10:53
Migrate a WordPress installation to a different URL with this MySQL
UPDATE wp_options SET option_value = replace(option_value, 'http://old.url', 'http://new.url') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old.url','http://new.url');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old.url', 'http://new.url');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old.url','http://new.url');
@marklindhout
marklindhout / css.nanorc
Created September 25, 2012 09:59
NANO syntax highlighting for Cascading Style Sheets (CSS)
syntax "css" "\.css$"
color brightblue start="." end="$"
color brightyellow start="\{" end="\}"
color white start=":" end=";|$"
color yellow ":active|:focus|:hover|:link|:visited|:link|:after|:before"
color brightwhite "\'|\""
color brightred ";|:"
color red start="\[" end="\]"
color green start="/\*" end="\*/"
@marklindhout
marklindhout / functions.php
Created September 25, 2012 09:53
WordPress Theme Template: Create a Call to Action meta-box in the backend, and display it in your template.
/*
This code should be added to your 'functions.php'.
Please replace 'mytheme' with a unique name of your choosing.
*/
/* This function creates the meta box HTML */
function mytheme_create_cta_metabox() {
global $post;
@marklindhout
marklindhout / imap-over-ssh-tunnel.sh
Created September 25, 2012 09:29
Shell snippet for tunneling IMAP on ports 2143 and 2025 using SSH
ssh user@host.domain.tld -L 2143:localhost:143 -L 2025:localhost:25
@marklindhout
marklindhout / gist:2274861
Created April 1, 2012 11:45
Use xgettext to create default.pot from all PHP files in a directory (recursive), and place it in /languages/.
xgettext --from-code=utf-8 -k_e -k_x -k__ -o languages/default.pot $(find . -name "*.php")
@marklindhout
marklindhout / menu.html
Created March 3, 2012 16:41
A simple yet smooth full-fledged jQuery dropdown menu that works across all modern browsers.
<nav id="access">
<ul class="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Page 1</a>
<ul class="sub-menu">
<li><a href="#">Page 1.1</a></li>
<li><a href="#">Page 1.2</a></li>
<li><a href="#">Page 1.3</a></li>
<li><a href="#">Page 1.4</a></li>
<li><a href="#">Page 1.5</a></li>