Category Archives: Linux

Code Handover

If you are handing over the code for an Android Studio project here are the kind of commands you might want to execute:

export ANDROID_HOME=/Development/android-sdk-macosx
export RELEASE_STORE_PASSWORD=store_password
export RELEASE_KEY_ALIAS=release_key
export RELEASE_KEY_ALIAS_PASSWORD=alias_password
git clone ssh:// myproject
cd myproject/
git checkout -b release origin/release
rm -rf .git git README .gitignore .arclint .arcconfig
./gradlew assembleProd
rm -rf */build

Android Action Bar Overlay

To enable overlay mode for the action bar, you need to create a custom theme that extends an existing action bar theme and set the android:windowActionBarOverlay property to true.

    <!-- the theme applied to the application or activity -->
    <style name="AppTheme" parent="@android:style/Theme.Holo">
        <item name="android:windowActionBarOverlay">true</item>

If you’re using the Support Library

    <!-- the theme applied to the application or activity -->
    <style name="AppTheme" parent="@android:style/Theme.AppCompat">
        <item name="android:windowActionBarOverlay">true</item>
        <!-- Support library compatibility -->
        <item name="windowActionBarOverlay">true</item>

When the action bar is in overlay mode, it might obscure some of your layout that should remain visible. To ensure that such items remain below the action bar at all times, add either margin or padding to the top of the view(s) using the height specified by actionBarSize. For example:

<RelativeLayout xmlns:android=""

If you’re using the Support Library for the action bar, you need to remove the android: prefix. For example:

<!-- Support library compatibility -->
<RelativeLayout xmlns:android=""

In this case, the ?attr/actionBarSize value without the prefix works on all versions, including Android 3.0 and higher.



Git – Quick Tips

Amend Last Commit Message

git commit --amend -m "New commit message"

Clean up any untracked files

Preview what’s to be deleted
git clean -n
Remove the untracked files from your workspace
git clean -f

Revert the workspace to the last committed state

git reset --hard

Writing to NTFS in OS X Yosemeti/El Capitan

If you have brewed osxfuse installed, you have to uninstall it.

brew cask uninstall osxfuse

Run the following to install Homebrew ntfs-3g which depends on osxfuse

brew update
#Install Homebrew Cask
brew install caskroom/cask/brew-cask
#Install a binary osxfuse package from Homebrew Cask
brew cask install osxfuse
#Install ntfs-3g
brew install homebrew/fuse/ntfs-3g
[El Capitan Only] [reboot by holding CMD+R to get in recovery mode]
[El Capitan Only] csrutil disable
[El Capitan Only] [reboot normally]
#Create a symlink for mount_ntfs, to make drives mount automatically
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs
[El Capitan] [reboot by holding CMD+R to get in recovery mode]
[El Capitan] csrutil enable
[El Capitan] [reboot normally]

Mac OS X – Extra Listening port for SSH

Firstly make SSH listen on an extra port, say 2222:


Reload the file by executing:

launchctl unload /System/Library/LaunchDaemons/ssh.plist
launchctl load /System/Library/LaunchDaemons/ssh.plist

Cron Job : Logrotate MySQL Error

Receiving cron-daily emails with this error:

error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

It was fixed by making sure the password in the /etc/mysql/debian.cnf is the same as the one in the MySQL database.

Try running this command:


Replace XXXXXX with the password in the /etc/mysql/debian.cnf.