Skip to content

Instantly share code, notes, and snippets.

View markshust's full-sized avatar
🤓
Working on educational & training material for Magento 2

Mark Shust markshust

🤓
Working on educational & training material for Magento 2
View GitHub Profile
@markshust
markshust / mailqueuecleaner
Created January 27, 2012 15:25
Delete email messages from certain domain in certain month out of mail queue
# run directly in terminal. domain is domain name, month = three letter month code (Jan = January)
for i in $(mailq | grep DOMAIN | grep MONTH | awk '{ print $1 }') ; do postsuper -d $i; done
@markshust
markshust / gist:1725418
Created February 2, 2012 19:58
push repo up to bitbucket account, replace username and repo with your own
git push --mirror git@bitbucket.org:username/repo.git
@markshust
markshust / gist:1839182
Created February 15, 2012 21:42
Remove a specific commit id knowing only the commit id you would like to remove
git rebase --onto commit-id^ commit-id HEAD
@markshust
markshust / gist:1903625
Created February 24, 2012 20:43
Magento: Better way to require files in controllers
require_once Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'OnepageController.php';
@markshust
markshust / gist:1995901
Created March 7, 2012 20:30
Recursively change filesystem permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
@markshust
markshust / local.xml
Created March 21, 2012 17:02
Magento apply one template to multiple layout handles
<?xml version="1.0"?>
<layout>
<my_updated_template>
<reference name="root">
<tpl>page/2columns-left.phtml</tpl>
</reference>
<my_updated_template>
<catalog_category_layered>
<update handle="my_updated_template" />
@markshust
markshust / gist:2343871
Created April 9, 2012 14:33
Magento mobile theme expression
iPhone|iPod|BlackBerry|Pre|Palm|Googlebot-Mobile|mobi|Safari Mobile|Windows Mobile|Android|Mini|mobile
@markshust
markshust / gist:2364346
Created April 12, 2012 02:45
Duplicating a hard disk
# If you have two IDE drives that are of identical size, provided that you are sure that they contain no bad sectors, you can execute this command to copy the entire disk and avoid having to install an operating system from scratch. It doesn't matter what is on the original (Windows, LINUX or whatever) since each sector is identically duplicated, the new system will work perfectly.
dd if=/dev/hdc of=/dev/hdd
@markshust
markshust / gist:2561990
Last active March 27, 2024 16:52
Reset permissions on .ssh directory
chmod 700 ~/.ssh
&& chmod 600 ~/.ssh/id_*
&& chmod 644 ~/.ssh/id_rsa.pub
&& chmod 644 ~/.ssh/known_hosts
&& chmod 600 ~/.ssh/authorized_keys
&& chmod 600 ~/.ssh/authorized_keys2
@markshust
markshust / strPad.js
Created May 7, 2012 02:47
jquery str_pad
$.strPad = function(input, pad_length, pad_string, pad_type){
var output = input.toString();
if (pad_string === undefined) { pad_string = ' '; }
if (pad_type === undefined) { pad_type = 'STR_PAD_RIGHT'; }
if (pad_type == 'STR_PAD_RIGHT') {
while (output.length < pad_length) {
output = output + pad_string;
}
} else if (pad_type == 'STR_PAD_LEFT') {
while (output.length < pad_length) {