AUTOMATION FOR NON PROGRAMMERS: MAKE YOUR LIFE SIMPLER USING ALIASES

By: Saurav

2019-03-14 07:03:00 UTC

Xbash scripting.jpeg.pagespeed.ic.c2gr4l vsj

For a lot of people, programming is something only software engineers do. A few even feel its too complex to make sense. Even their laptop is too complex to handle. Well! I agree to disagree. I think programming is tough only if you don't have an internet connection, a good enough laptop and a brain good enough to hold a full-time job. If you got all the above, you are good to go.

But you may ask even then why bother if you are not getting paid to write programs?

The thing is, we are surrounded by mundane, repetitive tasks which we hate to do but we have got no choice. Apps nowadays are helping us out to automate those things. New robot vacuum cleaners with timers, automated payment transfer to your kid's account, automatic bill payments, automatic recording of live TV, etc are a few.

Nonetheless, you can still automate a million things on your own no matter who you are and make your life even simpler. In this post, I will talk about one such automation which will help out any professional get started with his/her day asap and save a few minutes.

Let's take three users. They all work on their MacBooks and their days start with opening it with a sip of coffee.

Let's see what they do and how a little bit of programming can help them become even more efficient in their lives.

1. Jonah is a Lawyer. Her days start with checking work emails, checking slack messages,
checking the todo list set by her senior, starting the billable software, starting google docs, and starting up skype.

2. Abigail is an interior designer. She grabs her decaf and then fires up her MacBook, she checks her work email, then her slack. She then checks the daily todos, opens up her design studio as well as Pinterest for some design inspirations and also likes to start Spotify hand in hand.

3. Finally, Jack is a DJ. He loves making music. His days normally start a little later. He starts his MacBook and then checks for emails. Checks his facebook fan page, his youtube channel, his Spotify, Soundcloud and his digital mixer software.

They all do this kind of mundane startup ritual day in day out each day, 5 -7 days a week.

Won't it be simple if they just fire up one command and their whole setup and all the software and tools start and are automatically opened for them to use while they go get their coffee?

I will first show you my setup and then will help you to get a similar one so you can start your day efficiently.

Screen shot 2019 08 13 at 11.26.30 pm

As you saw in the video, every day in the morning all I have to do is type start command in my terminal and it fires up my whole setup including Gmail, Spotify, Slack channel for team messages, Design software Figma and Coding Editor VS Code. All I have to do is to open a terminal and hit start.

The setup looks complex but it is very simple. There are just a few things you need to know.

1. .bashrc files Basically a file that is run whenever you open a new shell/terminal.
To search for it open a spotlight search by holding on to Command key and pressing the whitespace key. Then type in the following:

Screen shot 2019 08 13 at 11.50.14 pm

You can also find it using the Finder app in MacBook as shown below

Screen shot 2019 08 13 at 11.51.57 pm

2. Also shown above is the aliases file which is inside the bash folder. Please create this file at that location.

3. Now, open your bashrc file and put the following in it:

. ~/bin/dotfiles/bash/aliases 

This tells bash where the aliases are.

Aliases are mainly shortcuts that you can use to refer to any program or a function on your computer. For examplle, you can say opm to open mail app or cdp to open project folder. You are free to choose any shortcut command (unless its a key word) until it throws an error.

Now moving on to the fun part, For my startup, I used the following code:

#Starting Day

function open_vs_code(){
 open -a /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code
}

function open_tabs(){
 open "https://mail.google.com/mail/u/0/#inbox"
}

function open_slack(){
 open /Applications/Slack.app
}

function open_figma(){
 open /Applications/Figma.app
}

function open_spotify(){
 open "https://www.spotify.com/us/"
}

alias vca=open_vs_code
alias tabs=open_tabs
alias slack=open_slack
alias figma=open_figma
alias spotify=open_spotify

alias start='vca ; tabs ; slack ; figma ; spotify'

Essentially I created aliases for each app I want to open (line starts with alias) and then called them all at once by invoking another alias.

start is the alias which fires up these aliases vca ; tabs ; slack ; figma ; spotify

and each of these aliases calls the respective function as specified after = in which I have defined what to do for each of them. 

The vca calls open_vs_code which is my code editor. 
The mail calls open_mail which simply opens the URL link to Gmail
The slack calls open_slack which opens the slack app
The figma calls open_figma which opens my design studio
and Finally, the Spotify calls open_spotify which opens another tab in my chrome with Spotify.

Note: If there is an app you want to add, go to the Applications folder and get the info of the app as shown for Slack app below

Screen shot 2019 08 14 at 12.07.16 am

Screen shot 2019 08 14 at 12.07.25 am

So in your case suppose you want to start a skype app. Go to the Applications folder and get the info of the skype app.

Add a new function in the same aliases file. Let's call it open_Skype:

function open_skype(){
 open /Applications/Skype.app
}

Then make a new alias called skype=open_skype 

and extend you start alias to be -> alias start='vca ; tabs ; slack ; figma ; spotify ; skype'

The extension (.app) is very important to specify so don't forget to add it to the function above.

If an app name has space in between, use '\ ' to separate the words as I did for open_vs_code() function

And when you start your laptop, open a terminal and hit start, all the apps along with skype will get started for you to get going.

So Jonah, all you need to do is to add your work email url, slack app path, todo list url, your billable software path from the Applications folder, the url for google docs and skype (which I already added as functions) just once in your aliases file and from now on, you are gonna save a minute and a ton of stress each day from now on.

Your aliases file would look like:

#Starting The Day

function open_billing(){
 open /Applications/My\ Billing\ App.app
}

function open_mail(){
 open "https://mail.google.com/mail/u/0/#inbox"
}

function open_slack(){
 open /Applications/Slack.app
}

function open_todo(){
 open "https://www.mytodolist.com"
}

function open_docs(){
 https://docs.google.com/document/u/0/
}

function open_skype){
 open /Applications/Skype.app
}


alias billing=open_billing
alias mail=open_mail
alias slack=open_slack
alias todo=open_todo
alias docs=open_docs
alias skype=open_skype

alias start='billing ; mail ; slack ; todo : docs ; skype'

For all the Abigails and Jacks, I hope these examples are easy enough to understand and help you get your morning started quickly from now on. Try it and lemme know if it doesn't work out.


Let me know what you think!
Twitter: sprakash24oct
Linkedin

Owned & Maintained by Saurav Prakash

If you like what you see, you can help me cover server costs or buy me a cup of coffee though donation :)