Skip to content

Instantly share code, notes, and snippets.

@nikolazic
nikolazic / upgrate_to_subversion_1.8
Created March 19, 2014 18:32
Upgrade to Subversion 1.8
# sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu precise svn18" >> /etc/apt/sources.list.d/subversion18.list'
# sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
# sudo apt-get update
# sudo apt-cache show subversion | grep '^Version:'
Version: 1.8.8-1+WANdisco
Version: 1.7.5-1ubuntu2.1
Version: 1.7.5-1ubuntu2
# sudo apt-get install subversion
@nikolazic
nikolazic / display_line_number_of_file.sh
Created March 11, 2014 17:51
Display Line # of File
sed -n '18638'p file
sed -n '18638,18645'p file
sed -n '320123,$'p filename
@nikolazic
nikolazic / tar_magento_media_exclude.sh
Last active September 9, 2021 14:38
Tar Magento Media directory excluding cache files
tar -cvf ~/media-`date +%Y%m%d`.tar --exclude-vcs --exclude='*.htaccess' --exclude='*/cache/*' --exclude='*/cache' --exclude='*/.thumbs/*' --exclude='*/.thumbs' --exclude='*/tmp/*' --exclude='*/tmp' --exclude='*/js/*' --exclude='*/js' --exclude='*/css/*' --exclude='*/css' --exclude='*/captcha/*' --exclude='*/captcha' --exclude='*/css_secure/*' --exclude='*/css_secure' --exclude='*/customer/*' --exclude='*/customer' --exclude='*/dhl/*' --exclude='*/dhl' --exclude='*/downloadable/*' --exclude='*/downloadable' --exclude='*/xmlconnect/*' --exclude='*/xmlconnect' media
@nikolazic
nikolazic / trigger_definer_fix
Created March 4, 2014 22:54
Fix issue with trigger definers in magento
mysqldump --single-transaction -u guest -ppassword riot | sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' | mysql -u guest -ppassword riot2
@nikolazic
nikolazic / magento_join_alias.php
Created February 7, 2014 18:08
Magento Join Alias
// NO Alias
$collection
->join('color', 'color.color_id = main_table.rug_color_id', 'color.name as rug_color_name')
->join('color', 'color.color_id = main_table.binding_color_id', 'color.name as binding_color_name')
->join('binding', 'binding.binding_id = main_table.binding_id', 'binding.name as binding_name');
//ALIAS
$collection->getSelect()->join(
array('binding_color' => $collection->getTable('color')),
'binding_color.color_id = main_table.binding_color_id',
@nikolazic
nikolazic / svn_parent_branch.sh
Created January 31, 2014 17:37
SVN Find parent branches
svn log -v --stop-on-copy
@nikolazic
nikolazic / find_string_in_files.sh
Created January 24, 2014 20:39
Find a string in files
http://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-in-linux
grep -rnw 'directory' -e "pattern"
@nikolazic
nikolazic / free_nx_missing_ppa.sh
Created January 20, 2014 15:16
Fix FreeNX Missing PPA
sudo sed -i 's/quantal/precise/g' /etc/apt/sources.list.d/freenx-team-ppa-quantal.list
https://help.ubuntu.com/community/FreeNX
@nikolazic
nikolazic / screen.sh
Created January 17, 2014 21:35
Screen
screen -S sessionname
To create a new interactive shell, press Control-a c
To switch between shells, press Control-a # where # is the number of the shell. For example, to switch to shell number 1, press Control-a 1
screen -d -R sessionname will resume a session that you started in a different location.
Control-a ? will give help inside of screen.
@nikolazic
nikolazic / mysql_replication_show_slave_satatus.mysql
Created January 15, 2014 20:58
Magento Replication Show Slave Status
mysql> show slave status \G;