Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / ftpd-osx-lion
Created August 17, 2013 09:10
Turn on OSX Lion FTP daemon #osx #ftp
//http://www.r0k.org/enabling-ftpd-in-osx-lion
sudo /usr/libexec/ftpd -D
//to turn off again
sudo killall ftpd
@jasperf
jasperf / remove-locked-svn
Last active December 21, 2015 18:39
Remove Lock after working copy WP theme update causing a "this is not a working copy" error. This occured to me with the production server being a working copy and svn.domain being the local copy. I did not want to checkout the entire working copy as the working copy was more up tot date than the local copy. #find #svn
//In site root
find . -name 'lock' -exec rm -v {} \;
@jasperf
jasperf / mysql-backup-db.sh
Last active September 27, 2023 00:47
Backup your site's files using tar and gzip from the command line. #tar #gzip #backup
# backup database
mysqldump --opt --user=user --password=password --host=host.com database > file-dd-mm-yy.sql
@jasperf
jasperf / untar-gzipped-tar-archive.sh
Last active February 12, 2020 06:06
Untar a tarred and gzipped file, for example a backup of a site made. #tar #gzip #unix
## -z, --gzip, --gunzip --ungzip
## -x extract
tar -zxvf filename.tar.gz
@jasperf
jasperf / wget-download-site.sh
Last active April 20, 2024 04:42
Use wget to get a local copy of a site with all files and folders . This an ideal way to clone a (static html/css/javascript based ) site from the command line. #copy #clone #wget #download
#http://stackoverflow.com/questions/6348289/download-a-working-local-copy-of-a-webpage
#http://stackoverflow.com/questions/8755229/how-to-download-all-file-from-website-using-wget
#http://stackoverflow.com/questions/4272770/wget-with-authentication?rq=1
#add browser headers:
#--header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/30.0"
#add .htaccess authentication details:
#--password=password --user=user
wget -m -p -E -k -K -np http://site/path/
wget -p -k http://ExampleSite.com
# and another via Quora https://www.quora.com/How-do-you-export-a-WordPress-site-to-a-static-HTML
@jasperf
jasperf / bash-backup-script
Last active June 10, 2023 23:25
Bash back script to backup site and database on a (Dreamhost) Server, keep a certain amount of backups and delete some of the oldest ones after a certain time. The cron job you use is up to you, just make sure the Bash file is executable. #bash #backup #unix
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H%M")
BACKUP_DIR_PREFIX="/home/user/backups/backup";
DAYS_TO_LIVE=1 #File should be removed after this period
DB_USER="database-user"
DB_PASS="database-password"
DB_NAME="database-name"
@jasperf
jasperf / magento-error-reporting
Created September 7, 2013 06:18
Show Magento Errors on the frontend #magento #debugging
//http://www.magentocommerce.com/boards/viewthread/84053/
//Renamed the errors/local.xml.sample file to local.xml
// Add to .htaccess
SetEnv MAGE_IS_DEVELOPER_MODE "true"
@jasperf
jasperf / hacked-magento-files
Last active December 22, 2015 12:38
Files Hacked on a Magento Site
/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php
/app/code/core/Mage/Catalog/Model/Resource/Helper/Mysql4.php
/app/code/core/Mage/Core/Controller/Varien/Router/Default.php
/app/code/core/Mage/Core/Helper/File/Storage/Database.php
/app/code/core/Mage/Core/Model/Config.php
/app/code/core/Mage/Core/Model/Config/Base.php
/app/code/core/Mage/Core/Model/Resource/Config.php
/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php
/app/code/core/Mage/Eav/Model/Config.php
/app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php
@jasperf
jasperf / search-for-hacked-files
Created September 8, 2013 05:28
Find files sorted by modification date to look for hacked or adjusted files inside a directory. #sort #unix #security
// http://unix.stackexchange.com/questions/9247/how-to-list-files-sorted-by-modification-date-recursively-no-stat-command-avail?rq=1
find . -printf '%T@ %c %p\n' | sort -k 1n,1 -k 7 | cut -d' ' -f2-
@jasperf
jasperf / diff-files
Last active December 29, 2015 05:39
Compare two directories or files and only output files changed in alphabetical order #diff #compare #unix
diff -qr firstupdate/ secondupdate/ | sort
diff -a --suppress-common-lines -y #neat to compare them side by side and remove common lines