22 Nov 2015
I think everyone of you geeks would like if your terminal looks cool and productive. And yes, I’m talking here about terminals in POSIX-compliant OS’s, more specifically terminal in a Linux environment.
Anyhow I will share you the details of my customized terminal configurations so you could get an idea of what it is really capable of doing and perhaps you would start applying the changes to your own terminal.
So to make it all happen I had to give up on
bash and start using
zsh provides some extensive support to terminal users and it is certainly feature rich, customizable and cooler than
bash. So all the customizations I made are based on
zsh and oh-my-zsh (a really cool community driven project for managing
If looking at theming
oh-my-zsh provides some cool and nice looking themes out of the box. But the theme that I’m using is an external theme and needs little bit more configurations before using it.
It’s call bullet-train and to make it look right I had to install some fonts from Vim-Powerline. I also had to change the color scheme of my terminal to use Solarized (dark). Here I’m using xfce4-terminal that comes with Xubuntu, so I can easily change the color scheme from the preferences menu. I also make it a bit transparent to make it even more cooler.
Enough of the looks. Lets see how is it when it comes the productivity. Here again
oh-my-zsh provides some nice plugins that you can use to increase your productivity. I’ll list down the plugins that I’m using
- git - A very comprehensive plugin for
git with lots of aliases for easy usage
- history-substring-search - Very useful plugin that will get you through your
zsh history backwards-forwards via up and down arrow keys
- zsh-syntax-highlighting - this will highlight the commands we use inside the terminal
- command-not-found - will suggest alternative/correct commands instead of just command not found error
- colorize - this will colorize the syntaxes for almost every popular sciprting/programing language
- colored-man-pages - syntax highlight in man pages for easy reading
- python - provides lots of useful aliases to Python
- sudo - hit ESC twice and boom!
sudo will added to your command
- web-search - simply opens up your browser with the search query of yours in desired search engine i.e
google whats the weather like today
- chucknorris - this plugin isn’t particularly meant for productivity but it can get really humorous.
- ubuntu - this particular plugin provides lot of Ubuntu specific aliases to ease up the day-to-day work
Once put these all together this is how it looks
25 Aug 2015
Have you ever come across a difficulty to find a definition of a word that you are looking for. Well I find it bit difficult for me.
I normally use Google search to find definitions of words. For example to get the definition of the word “replenish” I use definition replenish on search bar
But this approach is still bit clumsy though, since you need a browser and if you are already opened multiple tabs then it is sometimes get messy around to switch around tabs.
So I found out this simple script from the book Linux Shell Scripting Cookbook, 2nd Edition that will query your word and get the definition of it.
Let’s see how to get it to work (I have altered the original script from the book to make is more convenient)
- First you need an account in dictionaryapi.com - http://www.dictionaryapi.com/register/index.htm
- API key for the learners API would be enough for the time being
- Get the script from here
- Assign your API key to the variable apikey
- Make it executable
chmod +x define
- Optional: if you want to make it available system wide add the script to
- Finally you can run it as
The outcome would be:-
12 Jun 2015
I recently got to know about this official Java REPL (Read-Eval-Print-Loop) or JShell project. It is named as Kulla and you can visit here to see the project’s home. This is pretty much same like the Python’s IDLE (If you have used it before) and a great way to exercise your code in real time. Also the good thing is that this project will be available as a part of JDK9 among with some other cool features.
Anyhow I managed to get it run on own and have tried few exercises too. Here, take a look
How do I get it to run
I haven’t tried this on Windows, only on POSIX based systems (Linux). But I believe the precompiled jar will work on Windows. You can give it a go and see.
If you want to try out REPL right away there’s this precompiled Jar that you can use . What you’ll need is
- Link for the Jar:Kulla.jar
- Java 9 early access JDK
Once these are in place you just need to set the JAVA_HOME to your / path / to / JDK 9. Then execute the following -jar command:-
$ java -jar kulla.jar
You will be entered in to the JShell.
NOTE: The whole build process can take up to 20-30 minutes or more, so brace yourself.
- Make sure you have set the JAVA_HOME
- You also need Mercurial. If you are on Ubuntu just give
sudo apt-get install mercurial
- Then the follow these commands to get kulla-dev branch built
- hg clone http://hg.openjdk.java.net/kulla/dev kulla-dev
- cd kulla-dev
- sh get_sources.sh
- bash configure –with-boot-jdk=/path/to/jdk1.9
- make clean images
- make install (optional)
OK, kulla-dev branch is now built, hopefully without any errors. Now lets see how we can build and run the REPL. I’m extracting these information from official README under Kulla dev branch.
Download JLINE2 from Maven, and set the environment variable JLINE2LIB to point to the downloaded jar file.
If everything goes fine you’ll be entered to the JShell without any issues.
I will add a summary of features that you’ll find useful when using the REPL.
- REPL has networking support. Yes you can work with java.net
- Semicolone is optional giving you a flexibility like most of REPL’s out there
- It has some useful help commands that you can use to improve your productivity. /help list those commands
- Checked exceptions are not valid here. Like in normal Java environment you will not be forced to handle the checked exceptions. REPL will be handling it in the background
- Expressions will also work out of the box here. Arithmetic, String manipulations, method calls .etc
Here I found a good tutorial that might be useful. It has some basic to intermediate exercises that you can follow go get familiar with the JShell/REPL