Skip to content

Instantly share code, notes, and snippets.

View proxium's full-sized avatar
🍒
Picking some sweet cherries

Rateb BEN MOUSSA proxium

🍒
Picking some sweet cherries
View GitHub Profile
@proxium
proxium / Drop-all-tables-in-database
Last active August 29, 2015 14:25
Shell command to do the drop (of all tables) in one shot
# Drop all tables from YOUR_DBSCHEMA_NAME
mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD -BNe "show tables" YOUR_DBSCHEMA_NAME | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD YOUR_DBSCHEMA_NAME
Verifying I am +ratebbenmoussa on my passcard. https://onename.com/ratebbenmoussa
# Use those commands to check for duplicate lines in <file>
# The more verbose --count flag with the GNU version:
sort <file> | uniq -c
# The more verbose --count flag with the GNU version:
sort <file> | uniq --count
# Show only print duplicate lines
sort <file> | uniq -d
# search recursively showing filename and line
grep -Hrn --exclude-dir=.git 'search term' path/to/files
# with support color
grep -Hrn search . | less -r
# You should enable xDebug remotely then create the Tunnel
ssh -R <remote xDebug port>:127.0.0.1:<local xDebug configured port> username@remote_host -N -v -v
# * sudo netstat -lptu|grep -i <local xDebug configured port>
# Example output:
tcp 0 0 *:9001 *:* LISTEN 11902/java
@proxium
proxium / bumpversion.sh
Created December 1, 2015 11:41 — forked from pete-otaqui/bumpversion.sh
Bump a software project's VERSION, add the CHANGES, and tag with GIT
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.
@proxium
proxium / magento_dummy_simple_products_generation.php
Last active May 8, 2018 17:39
You need to put this script under shell/ directory in you Magento folder and adjust the constants to sweet your needs.
<?php
// env config
ini_set('display_errors', 1);
umask(0);
// mage setup
require_once dirname(__FILE__).'/../app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@proxium
proxium / Show_Product_Count_Per_Category.php
Last active October 27, 2020 17:49
Product Count Per Category in Magento
<?php
/**
* @param $category
* @return int
*/
public function getProductCount($category)
{
$productTable = Mage::getSingleton('core/resource')->getTableName('catalog/category_product');
@proxium
proxium / layout_xml_via_event.php
Created March 2, 2016 11:31
Magento: add layout xml via event to add the layout file direct before local.xml
<?php
/*
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Loewenstark_Layout>
<version>1.0.0.0</version>
</Loewenstark_Layout>
</modules>
@proxium
proxium / export_commit_files.sh
Created March 9, 2016 17:56
export files form a specific commit
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT <commit ID ex:b9e0245> | tar -czf file.tgz -T -