Skip to content

Instantly share code, notes, and snippets.

@AtomicSmash
AtomicSmash / image_replace
Created October 15, 2013 20:07
Bash script to replace underscores
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
@AtomicSmash
AtomicSmash / wp-xml-import.php
Last active December 30, 2015 20:29
Start of Wordpress import script
<?php
/*
___ __ _ __
/ | / /_____ ____ ___ (_______________ ___ ____ ______/ /_
/ /| |/ __/ __ \/ __ `__ \/ / ___/ ___/ __ `__ \/ __ `/ ___/ __ \
/ ___ / /_/ /_/ / / / / / / / /__(__ / / / / / / /_/ (__ / / / /
/_/ |_\__/\____/_/ /_/ /_/_/\___/____/_/ /_/ /_/\__,_/____/_/ /_/
Wordpress XML importer - with Advanced Custom Fields Support
*/
@AtomicSmash
AtomicSmash / post-receive
Created February 16, 2014 17:10
This is an example of a GIT "post-receive" hook that check the branch name before deploying
#!/bin/bash
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
git --work-tree=/var/www/domain.com --git-dir=/home/git/repositories/root/testproject.git checkout -f
fi
done