Download password protected file over shell

Therefore we use wget:

If you let -O param out the output will be stored under its original name.

VI / VIM Delete all text

To delete all content from current position to the end of file on bash, you can take the following steps: Open file in vi or vim

Switch to visual block mode

Press G (Shift+g) Mark text to delete with arrow keys top and down or just press END to mark everything to the end of […]

Find and replace malware code blocks in php files via shell

Today I was attacked by an unknown bot or something like that. It placed the following code in many hundred index.php files on one of my servers, because the FTP-Password was cracked.

The solution was the following little Python script that walks through the filesystem tree and searches for index.php’s. In every matched file it […]

Use column alias in conditions

With the use of HAVING you can use a result columns of a database query in itself:

Here the alias result (see AS ‘result’) for the only column is used as a condition with HAVING. That is by now the only way to compare a result column with another value in a query under […]

Debug database queries with parameters

Sometimes you have to query the database directly in your module. In these situations you can use the placeholder feature of the Zend_Db_Statement component. :placeholder will be replaced by the respective value when calling fetch on a Zend_Db_Adapter_Mysqli instance with an array of replacements for example. If you need to debug the query with all parameters in it, […]

Get MAC address from file system

On Debian based Linux distributions you can get the MAC address of the respective network adapter from the filesystem like shown below:

As you can see, all adapters have their own folder under  /sys/class/net/ that contains  a address file with the corresponding MAC address. If the system is not booted (offline edit). You can have a look into […]

Cherry picking

Sometimes it is necessary to merge partial changes from one branch into another. Therefor you can use cherry-picking and merge a chosen commit into the actual branch:


Change config during runtime

Sometimes you need to change the Magento configuration during runtime. For example this is the way to temporarily disable the category flat tables

Attention: You have to reindex categories afterwards!!!