Grayscale Android Quick Setting

While latest versions of Android added a Comfort View quick settings tile, sometimes while browsing reddit at night I find that still makes my eyes hurt a little bit. Digging around a little bit, I’ve found that you can make your screen grayscale by accessing a hidden setting. First you need to Configure on-device developer options, then go to: Settings -> System -> Developer Options -> Simulate color space -> Monochromacy.

This is fine, but it would be much nicer if you could enable/disable this feature from the quick settings panel. After a bit of digging, I’ve stumbled  upon the grayscale quick settings tile app which allows do you do just that:

PHP wordpress

Add categories and tags support to custom post types in WordPress

Adding a custom post type in WordPress is pretty easy and while it can be done and managed via external plugins, it’s pretty easy to do it by adding a little code in the functions.php file of your theme. All we need to do is take advantage of the “register_post_type” method that’s provided by wp. You can see more details and all the params on the Codex.

Here is a simple example that creates a custom post type named “project”:

By default, this new custom post type doesn’t has the ability to use taxonomies (categories, tags, or any other custom taxonomies you might need), but that can be easily added. Simply add ‘taxonomies’ => array(‘category’, ‘post_tag’) to the $args variable then initialize the new taxonomies. The code will look like so:

If anyone knows an easier way (without using a plugin) of achieving this, please use the comments section below!


How To: Mac OS X and Midnight Commander “Insert” Key fix

After moving from Linux (Ubuntu) to OS X, one of the most annoying things i’ve ran into, was not having the Insert Key work as it was intended inside Midnight Commander. In Linux, while in mc, you can hit the Ins key to select or tag an individual file or folder. This is very useful when you want to cleanup and folder or move/copy stuff around. While there is the Ctrl + T shortcut (i’ve found that via:, it’s pretty annoying to use it when the muscle memory keeps going to the Ins key.

I was using BetterTouchTool to get the back/forward mouse buttons working on Yosemite, so i’ve looked around if i can setup a keyboard shortcut. And you can: I’ve setup under “Keyboard” options, an entry for iTerm (my Terminal app of choice on the mac), if the Ins key is pressed to trigger the Ctrl + T shortcut. Works like a charm in mc 🙂
Screen Shot 2015-01-27 at 5.41.10 PM

Wine Cellar

How to: Create a new wine prefix or bottle

When running Windows apps under Linux via wine, it’s always a good idea to have each app in it’s own sandbox or wine bottle if you will. After you get an app running with wine, you can store the bottle and grab it from the cellar when you need it.

A wine bottle, is similar to a clean windows install. When creating it, you can specify if the architecture should be 32 or 64bit, which basically emulates a 32 or 64bit machine with windows. You can also keep for each bottle individual settings via winecfg.

Here is how you can create one:

winearch=win32 WINEPREFIX="/opt/cellar/civ5" winecfg

This will create a clean 32bit wine prefix, stores everything in the “/opt/cellar/civ5” folder and opens the winecfg app for that prefix. Note that in order to use that prefix, you must always make sure you specify it:

winearch=win32 WINEPREFIX="/opt/cellar/civ5" wine notepad

I keep all my wine bottles on an external HDD mounted under /opt/cellar. As long as the correct wine version is installed on each machine for that bottle, i can take the HDD and use the apps on any Linux machine.

Wine Cellar

How to: Install latest wine in Ubuntu

The wine version that comes with Ubuntu by default is often old so a good idea is to add the official wine repo to the apt sources and install from there:

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.7
linux ubuntu

How To: Delete ALL older kernels

If you are using Ubuntu, there is a good chance you get kernel upgrades once in a while. There is no reason, after you’ve booted the new kernel and verified that everything is working properly, why you should not delete all older kernels. This will free up a bit of that root partition. If you are like me and mount / on a small SSD partition, every MB counts. For me the modules for each kernel version are around 160MB.

Here is a CLI one-liner to delete all order kernels, leaving only the latest on the system:

sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
linux ubuntu

Fix VMware Workstation Module compile error on Ubuntu/Debian Linux

# Become root
sudo -i

# Do a couple of pre-requisites
apt-get install build-essential
ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

# Extract each of the VMware module packages

cd /usr/lib/vmware/modules/source
for file in *
tar xvf $file

# Fetch and apply patches required for this release...
patch -p0 < vmci.linux-3-8.patch

# Put the VMware module source packages back together again
for file in *-only
tar cvf `basename $file -only`.tar $file
rm -rf *-only

# Tell VMware to rebuild the modules - can also just run the command "vmware" as root
vmware-modconfig --console --install-all

MySQL select duplicates

FROM table_name a

FROM table_name b
LIMIT 1 , 1
linux ubuntu

Mount a Mac formatted HDD in Ubuntu

You can make it possible to mount HFS+ as Read and Write in Ubuntu Linux.

sudo apt-get install hfsplus

Then, use the -o force option to force the drive to mount:

sudo mount -o remount, force /dev/sdX /your/mount/point


Magento tip : Image Upload HTTP error

There are a few possible causes including problems with mod_security.. however, if you are working behind a .htaccess/.htpasswd files to protect your site, you need to allow POST calls to go through; they’re being blocked b/c the AJAX call doesn’t know to use your cookie.


Require valid-user

to your .htaccess and you should be good to go.