Skip to content

Instantly share code, notes, and snippets.

@wyliethomas
wyliethomas / backitup.sh
Created August 3, 2016 15:10
MySQL Backup to S3
#!/bin/bash
NOWDATE=`date +%Y-%m-%d`
BACKUPNAME="$NOWDATE.sql.gz"
echo "Creating backup of database finances to $BACKUPNAME"
mysqldump --user=[username] --password=[password] [database] | gzip -9 > $BACKUPNAME
echo "Succesfully created database backup"
echo "Uploading backup to Amazon S3 bucket…"
@wyliethomas
wyliethomas / remove svn
Created July 11, 2011 17:31
Command to remove .svn from project
find ./ -name ".svn" | xargs rm -Rf
@wyliethomas
wyliethomas / download_image.php
Created May 6, 2011 19:27
download image from remote
$image = 'http://some/path/to/a/image.jpg';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $image);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$file = curl_exec($ch);
curl_close($ch);
$newImg = imagecreatefromstring($file);
imagejpeg($newImg, "public/path/to/save/to.jpg",100);