Skip to content

Instantly share code, notes, and snippets.

View LogIN-'s full-sized avatar
:electron:
Working from space

LogIN-

:electron:
Working from space
  • WWW
View GitHub Profile
@LogIN-
LogIN- / hex_color_mapping.js
Created October 28, 2016 10:30
Color hex values to names mapping
[
["000000", "black"],
["000080", "navy-blue"],
["0000c8", "dark-blue"],
["0000ff", "blue"],
["000741", "stratos"],
["001b1c", "swamp"],
["002387", "resolution-blue"],
["002900", "deep-fir"],
["002e20", "burnham"],
@LogIN-
LogIN- / super_price_configurable_update.php
Last active October 26, 2016 09:23
Magento - Update Super product attributes of Configurable Product in multistore configuration from prices of simple products
<?php
require_once './abstract.php';
/**
* Update Super product attributes of Configurable Product in multistore configuration from prices of simple product
* For Example in this example we want to have Configurable Super Pricing of Attribute "Size"
*
* @category Mage
* @package Mage_Shell
*/
@LogIN-
LogIN- / flushMagentoCache.php
Created September 29, 2016 07:19
Flush Magento Cache Programmatically by cache Type
<?php
public function flushMagentoCache(){
$flushCacheStart = microtime(true);
$cacheTypes = array();
$cacheTypes[] = 'config';
$cacheTypes[] = 'layout';
$cacheTypes[] = 'block_html';
@LogIN-
LogIN- / cleanMagentoLogs.php
Created September 29, 2016 07:16
Clean Magento Logs Programmatically
<?php
function cleanMagentoLogs(){
// Number Of days to keep Logs
$days = 15;
\Mage::app()->getStore()->setConfig(\Mage_Log_Model_Log::XML_LOG_CLEAN_DAYS, $days);
\Mage::getModel('log/log')->clean();
}
@LogIN-
LogIN- / deleteMagentoAttributes.php
Created September 29, 2016 07:15
Delete Magneto attribute by Attribute-Code
<?php
/**
* Attribute codes to delete
*/
$attribute_codes = array('color', 'size', 'filter_color');
foreach ($attribute_codes as $attribute_code) {
$attribute = \Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code);
$options = $attribute->getSource()->getAllOptions();
$optionsDelete = array();
@LogIN-
LogIN- / clothing_sizes.js
Created September 20, 2016 13:18
Clothing Sizes Conversion Rates
/* Women's Clothing Sizes Conversion */
var groups = ["U.S.","U.S. (named sizes)","Australia","France","Germany","Italy","Japan","U.K."];
var data = [['2','4','6','8','10','12','14','16','18','20','22','24'],['X-Small','X-Small/Small','Small','Medium','Medium','Large','Large/X-Large','X-Large/1X','1X/2X','2X','3X','3X'],['6','8','10','12','14','16','18','20','22','24','26','28'],['32','34','36','38','40','42','44','46','50','52','54','56'],['30','32','34','36','38','40','42','44','46','48','50','52'],['36','38','40','42','44','46','48','50','52','54','56','58'],['5','7','9','11','13','15','17','19','21','23','25','27'],['4','6','8','10','12','14','16','18','20','22','24','26']];
/* Women's Dresses and Suits Sizes Conversion */
var groups = ["U.S.","France","Italy","U.K."];
var data = [['0','2','4','6','8','10','12','14','16','18','20','22','24'],['32','34','36','38','40','42','44','46','48','50','52','54','56'],['36','38','40','42','44','46','48','50','52','54','56','58','60'],['4','6','8','10','12','14','
@LogIN-
LogIN- / locales.json
Created September 20, 2016 12:59
Countries with locales, date, time & money formats
{
"af":{
"country":"Afrikaans",
"money_format":"\u00a4#,##0.00",
"datetime_format":"y-MM-dd h:mm a"
},
"af_NA":{
"country":"Namibia",
"money_format":"\u00a4\u00a0#,##0.00",
"datetime_format":"y-MM-dd h:mm a"
@LogIN-
LogIN- / sync_mysql.sh
Created June 20, 2016 13:57
Bash script to synchronize remote mysql database with local one..
#!/bin/bash
start=`date +%s`
LOCAL_USER="root"
LOCAL_PASS="xxxxxx"
REMOTE_HOST="[email protected]"
LOCAL_DB="xxxxxx"
REMOTE_DB="xxxxxx"
@LogIN-
LogIN- / xenbackup.py
Created June 20, 2016 13:46
Simple Backup of XEN Hosts - xm linux
# cfg.py START
""" Configuration File """
xenConfigBackupDir = '/etc/xen/vds/backup'
xenConfigDir = '/etc/xen/vds/'
xenImageDir = '/srv/xen/domains/'
backupTmpTarget = '/opt/scripts/xenbackup/backup/'
backupFinTarget = '/srv/xen/backup_xen'
backupDiskTarget = '/mnt/usbdisk'
# cfg.py END
@LogIN-
LogIN- / find_mac_files.py
Created June 20, 2016 13:41
Analyze disk space usage of some common hidden/auto-generated files
import fnmatch, os
def bytesto(bytes, to, bsize=1024):
"""convert bytes to megabytes, etc.
sample code:
print('mb= ' + str(bytesto(314575262000000, 'm')))
sample output:
mb= 300002347.946
"""