Wednesday, February 21, 2018

Mac Screenshots

To change the default saving location of Mac Screenshots (Desktop) you run the following in the Terminal, I also added the first command to ~/.bash_profile:

$ defaults write location ~/Screenshots

$ killall SystemUIServer

Tuesday, February 13, 2018

repo reset

Sometimes you have to get back to the pristine sync with your repo, I created a function in my ~/.bash_profile for that.

# REPO HEAD updated: February 13, 2018
function repo_reset()
source activate py27
cd ~/REPO/my-repo-name
#repo sync
repo forall -vc "git clean -xdf"
repo forall -vc "git reset --hard HEAD"
ls -alt

The "ls" command with sorting

The Mac/Unix "ls" command does not include sorting by file name. 

To get it done I added a new function in Bash to my ~/.bash_profile

# ls with sort - updated: February 13, 2018
function list()
    if [ "$1" != "" ]; then
        ls -a $1 | sort
    ls -a | sort

Monday, January 22, 2018

Building AOSP on Mac

To build Android on MacBookPro High Sierra, I had to overcome few obstacles.
I looked up the MacOS SDK version, I am currently running:
$ ls /Applications/
MacOSX.sdk  MacOSX10.13.sdk
Then changed build/soong/cc/config/x86_darwin_host.go to:
darwinSupportedSdkVersions = []string{
I also had to get a case-sensitive file system USB-C SSD disk.
build/core/ warning: 
Please move your source tree to a case-sensitive filesystem.


Wednesday, January 3, 2018

Why developers should use Google Nexus / Pixel devices

It is January 2018. I sitting in front of two 2017 FLAGSHIP phones from Huawei and Samsung and the sample code app that I am trying will not run on neither of them (Android 7, API 24), but it does run on the Google Pixel C tablet that is 3 years old and discontinued but has been already updated to Android 8, API 26.

This really teaches me a lesson, get Pixel phone as a next phone.

Thursday, December 21, 2017

Missing xcrun on macOS High Sierra


xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

error: "" unsupported


  • Re-install XCode from App Store (~20 minutes)
    • Open XCode and agree to lice agreement
    • Allow it to "Instal components..."
This resolved my problem, but optionally you can try the following:
  • xcode-select --install
  • sudo xcodebuild -license
  • xcode-select --reset

Thursday, September 21, 2017

sed command line tool

The sed command line tool allows you to pipe a string of text and substitute part of it.

Note that it does for the first occurrence only:

$ echo "my, this is my sentence" | sed 's/my/My/'
My, this is my sentence

Escaping forward slashes with the backslashes:

$ echo "convert /usr/local/bin to /common/bin" | sed "s/\/usr\/local\/bin/\/common\/bin/"
convert /common/bin to /common/bin

$ echo "Repeat me 5 times." | sed 's/[0-9]/& & & & &/'

Repeat me 5 5 5 5 5 times.

Friday, September 15, 2017

How to change Python version using Anaconda?

$ python --version

Python 3.6.1 :: Anaconda 4.4.0 (x86_64)

$ conda create -n py27 python=2.7 anaconda

$ source activate py27

$ python --version

Python 2.7.13 :: Anaconda 4.4.0 (x86_64)

Also posted on GitHub

How to show hidden files in Apple OS X Finder (AppleShowAllFiles)

Open Terminal and execute the following line:

$ defaults write AppleShowAllFiles YES

Thursday, August 10, 2017

Python CAN bus

Install Python CAN library

~ uki$ sudo pip install python-can
Collecting python-can
Downloading python-can-1.5.2.tar.gz (77kB)
100% |████████████████████████████████| 81kB 3.3MB/s
Installing collected packages: python-can
Running install for python-can ... done
Successfully installed python-can-1.5.2

Follow the Directions