Skip to content

Instantly share code, notes, and snippets.

@mullnerz
mullnerz / .gitattributes
Last active November 7, 2015 19:58
git quick references
# Set default behaviour, in case users don't have core.autocrlf set.
* text
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.html text
*.css text
*.js text
# Declare files that will always have LF line endings on checkout.
@mullnerz
mullnerz / Sticky footer.md
Last active August 29, 2015 14:05
Sticky Footer
@mullnerz
mullnerz / archive-website.md
Last active May 14, 2024 20:06
Archiving a website with wget

The command I use to archive a single website

wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P . www.foo.com

Explanation of the parameters used

  • -m (Mirror) Turns on mirror-friendly settings like infinite recursion depth, timestamps, etc.
@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