I use brew utility for all my terminal based installation needs. However recently I had to deal with a corrupted brew install. To fix this I followed this link. The uninstallation and reinstallation worked fine and I now have a working brew instance.
The commands as mentioned in the above link are:
$ cd `brew –prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew
$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
I recently started exploring python and immediately ran into the following issue:
$ pip install requests
-bash: pip: command not found
A quick google search yielded this result. So basically on MacOS you have Python preinstalled along with easy_install command. So the following command installs pip:
$ sudo easy_install pip
Searching for pip
Best match: pip 9.0.1
Processing dependencies for pip
Finished processing dependencies for pip
A quick and handy solution indeed!
Found a good article which enabled me to install python 2.7.3 inside a folder.
Install python to separate directory on linux in 5 easy steps
A simple technique on MacOS which I use every now and then when my SSH connections hang due to network disconnect. You can immediately terminate the hung SSH session by pressing ~. (tilde and dot) keys together.
I use CURL for debugging my REST endpoints every now and then if I don’t want to use Postman or DHC clients. I usually like to copy paste results / statistics from command line into emails to my colleagues. This gives them a plain jane command which they can use to test themselves as well as compare their results with mine. The following article has some good pointers on how to use CURL and some very practical examples have been provided.
15 Practical Linux cURL Command Examples (cURL Download Examples)
I recently got into a situation where I had to debug around 10 servers all of which were suffering from memory issues. My java applications were slowing down after a day or so. Although its is difficult to diagnose this kind of issues which span across multiple VMs (welcome to Micro Services!) but with some little bit of scripting it is possible to see in real time the actual numbers if you manage to use tmux to multiplex multiple shell sessions stacked together. I hacked up the following command to display hostname, running war files as well as the memory statistics refreshed every 1 second on screen.
watch -d -n 1 "hostname | tr '\r\n' ' ' && printf \" \" && jps -l | grep .war | tr '\r\n' ' ' && echo "" && free -h"
I found a good link which lists good usages of the Linux command “du”.
This command allows me to see the usage in a ascending sort which is really helpful.
Tested on Linux.
du -h / | sort -h
Tested on Mac OS.
du -hs * | gsort -h
In case you don’t have gsort install coreutils.
brew install coreutils
This variation allows me to see any line which has the text “G” in it which basically allows me to see folders using space in GBs. Agreed it might give some folder names as well with “G” in it but I can bear with it.
Tested on Linux.
du -h /the/path | sort -h | grep "G"
Tested on Mac OS.
du -h /the/path | gsort -h | grep "G"
In order to install sonar I used the following approach to create database and user.
create database sonar;
grant all privileges on sonar.* to 'sonar'@'%' identified by "sonar";
I needed to make SSH connection into a VM box setup inside VirtualBox which by default uses NAT. To enable this I had to setup port forwarding. This article proved useful.
I used this link to fix the error of sudo command not found on fresh install of Debian 8.