Skip to content

Instantly share code, notes, and snippets.

View indrisepos's full-sized avatar

Sipos András indrisepos

View GitHub Profile
#!/bin/bash
# based on: http://stackoverflow.com/a/35115651
git status | grep modified | cut -d' ' -f 4 | while read x; do
x1="$(git show HEAD:$x | dos2unix | md5sum | cut -d' ' -f 1 )"
x2="$(cat $x | dos2unix | md5sum | cut -d' ' -f 1 )"
if [ "$x1" != "$x2" ]; then
echo "$x NOT IDENTICAL"
fi
#!/bin/bash
#
# @see http://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
#
# Installation: Download this file and move it to the /usr/local/bin directory
#
if [ ! -x "$(find /usr/bin -maxdepth 1 -name 'php5*' -print -quit)" ]; then
echo "PHP 5 not exist!"
exit 1
<?php
/**
* @see http://www.phpbuilder.com/articles/databases/mysql/handling-hierarchical-data-in-mysql-and-php.html
*/
/**
* @param $category_id
* @return array
* @return void
*/
@indrisepos
indrisepos / gist:8e9f4db8b819000700e0
Created May 28, 2015 21:40
Remove Magento attribute
<?php
error_reporting(E_ALL | E_STRICT);
require_once './app/Mage.php';
umask(0);
Mage::app();
$attr = 'product_type'; //attribute code to remove
./git-copy.sh aabb37fc243675de1194e38f75a554695ed3c111 7b6efc6a0731d0da7ce0d13b19098db2f7da224b ../uploads
@indrisepos
indrisepos / gist:1d3b5bf34bee6c988cc8
Created April 8, 2015 18:54
mysqldump all databases into separate files
#! /bin/bash
#origin: http://dev.mensfeld.pl/2013/04/backup-mysql-dump-all-your-mysql-databases-in-separate-files/
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/mnt/backup/mysql/$TIMESTAMP"
MYSQL_USER="backup"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQLDUMP=/usr/bin/mysqldump