by Cristian Balan | Oct 24, 2016 | WordPress
Weather Underground
<?php echo do_shortcode('[wunderground location="zmw:00000.1.16059" iconset="Incredibile" class="meteo" layout="current" measurement="c" language="IT" hidedata="search,conditions"]'); ?>
https://github.com/katzwebservices/Wunderground
by Cristian Balan | Oct 21, 2016 | DB
The following command exports a MySQL database allowing to import the result in a second DB without dropping the existing tables.
mysqldump --single-transaction --no-create-info --insert-ignore DB TABLE --where="EXISTS(SELECT 1 FROM TABLE_NAME WHERE COLLUMN_NAME__datetime > now() - interval 6 month)" | pv | gzip > DUMPDB.sql.gz
pv DUMP.sql.gz | gunzip | mysql --force dbname
by Cristian Balan | Oct 19, 2016 | Backup, Linux
The following is a simple example of using rsync to backup remote data in a cron scheduled fashion.
*/5 * * * * rsync -vrupogtzh -e "ssh -p 22" --exclude ".git" root@IP:/path/from/ /path/to/ > /dev/null
by Cristian Balan | Oct 14, 2016 | Linux
I’ve always wondered what it should be the default file and folders permissions for a web app. Well, there are multiple factors including config server config, app configuration files, cache and tmp folders, etc.
In any case, this is my prefered default permissions to start working with, kind of “reset/restore”:
find /FOLDER/* -type d -exec chmod 755 {} \;
find /FOLDER/* -type f -exec chmod 644 {} \;
If you’re on shared hosting and this does not work just change hosting… pardon, try using 775 for directories and 664 for files.
If neither these are working then you do have a problem and most likely is not permissions. Apache/NGINX/PHP or your app logs are a good place to start.
Some try to fix their problems by using 777. Be my guest but please don’t blame me.