Skip to content

Instantly share code, notes, and snippets.

@mullnerz
mullnerz / Sticky footer.md
Last active August 29, 2015 14:05
Sticky Footer
@mullnerz
mullnerz / migrate_data.md
Last active August 29, 2015 14:06
Copy entire filesystem hierarchy from one hard drive to another (migrating data volumes)
rsync -avxHAXh --safe-links --numeric-ids /source /dest/

The options are:

  • -a : all files, with permissions, etc...
    archive mode; equals -rlptgoD (no -H,-A,-X)
  • -v : verbose, mention files
  • -x : stay on one file system

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
# Recursively add a .gitignore file to all directories
# in the working directory which are empty and don't
# start with a dot. Helpful for tracking empty dirs
# in a git repository.
find . -type d -regex ``./[^.].*'' -empty -exec touch {}"/.gitignore" \;
sudo chgrp -R www-data /var/www/sitename.com
sudo chmod -R g+w /var/www/sitename.com
find /var/www/sitename.com -type d -exec chmod g+s {} \;
@mullnerz
mullnerz / Vagrantfile
Created January 11, 2015 22:50
Simple Ubuntu 14.04 server vagrant template
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "uec-images.ubuntu.com/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.provider "virtualbox" do |vb|
create database if not exists `${DB_NAME}`;
grant all privileges on `${DB_NAME}`.* TO `${DB_USERNAME}`@`localhost` identified by '123';
grant all privileges on `${DB_NAME}`.* TO `${DB_USERNAME}`@`%` identified by '123';
mysql --force --user ${DB_USERNAME} --password ${DB_PASSWORD} ${DB_NAME} < ${DB_NAME}.sql
@mullnerz
mullnerz / new_gist_file_0
Last active August 29, 2015 14:17
WordPress CLI install
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
wp core download
#export DB_NAME=awesome ; export DB_USERNAME=awesome ; export DB_PASSWORD=123
@mullnerz
mullnerz / convert-avi.ps1
Created April 21, 2015 21:02
mass converting video files using powershell and handbrake
# originated from:
# https://perfp.wordpress.com/2010/08/25/mass-converting-video-files-using-powershell-and-handbrake/
$outdir = "C:\Temp\convert-avi"
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$files = Get-Childitem -Recurse -Include "*.avi"
foreach ($file in $files) {
$subpath = $file.DirectoryName.Replace((Get-Location -PSProvider FileSystem).ProviderPath , "")
$destdir = $outdir + $subpath