Skip to content

Instantly share code, notes, and snippets.

@webspectyler
webspectyler / cp.sh
Created October 9, 2013 12:22
Copy all files including hidden directories
cp -a /mnt/sda8/john/. /mnt/sdb2/JOHN103
@webspectyler
webspectyler / import_utf8.sh
Created October 8, 2013 15:31
Specify file encoding in a mysql import
mysql -h host -u username -p password --default_character_set utf8 database < file.sql
@webspectyler
webspectyler / gist:4980186
Last active December 13, 2015 21:49
Use Yii Models in custom PHP code
<?php
/**** Initialize Yii */
require_once($_SERVER['DOCUMENT_ROOT'].'/path/to/yii/framework/yii.php');
Yii::createWebApplication($_SERVER['DOCUMENT_ROOT'] . '/path/to/config/main.php');
// ...
$product = Product::model()->findByPk(3);
@webspectyler
webspectyler / gist:4348716
Last active December 10, 2015 00:08
Bash script to upload last committed files in git to FTP
for i in `git diff-tree -r --name-only HEAD^ HEAD`; do curl -T "$i" ftp://example.com/$i --user username:password --ftp-create-dirs; done
@webspectyler
webspectyler / post-commit
Last active October 11, 2015 05:08 — forked from brunohq/post-commit
git post-commit hook to update referenced task status in Asana amd FreshBooks with commit message
#!/bin/sh
apikey=$(git config user.asana-key)
if [ $apikey == '' ] ; then exit 0; fi
comment=$(git log --pretty=oneline -n1)
taskid_pattern='.*#([0-9]*).*'
if [[ $comment = ~$taskid_pattern ]]; then
taskid=${BASH_REMATCH[1]}
else