Call me lazy, but I just love automating things.
Today we are automating my morning routine.
You may be wondering what that routine is.
- Make coffee (Shit, we won't automate this, Yet!)
- Open 10 tabs
Yes, that last part we are automating using the magic and mighty bash
!
See here how cool this project is:
Bash opening browser tabs
Note: This script is written/tested on Mac and can differ for you on different machines.
First, we will be making a plain old .txt
file that will hold all the pages we want to open:
https://hashnode.com/
https://daily-dev-tips.com/
https://twitter.com/
Now we will be making a bash script to open all browser tabs:
alias google-chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
while read line; do
google-chrome --new-tab "$line"
done < ~/www/browser-hack/list.txt
I have defined the alias for google-chrome; I think on windows, you can leave the alias out (untested).
Then we will loop through each line defined in list.txt and call google chrome to open a new tab for that website.
Next, we can add an alias to make it even cooler:
alias morning=~/path/to/script/bash.sh
Now in your terminal type: morning
and see the magic happen
Voila, we just hacked our morning routine to be that much quicker!
You can find this project on Github: Browser-hack
Thank you for reading, and let's connect!
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter
Top comments (27)
At work I have a
today
script that recursively fetches every git repo in my~/workspace
, sets someat
timers to remind me of break time and callsfortune
at the end :DIt also brings up a list of unpushed repositories at the end of the day and lets me select which ones I want automatically pushed.
share
Here's the main script that does most of the stuff:
Most of the output is in German, but otherwise it should be fairly easy to follow.
The
git-push-pending
script is a bit more complex:and it makes use of the
git-pending
script which looks like this:Awesome, ssst. but I'm posting my GIT status script tomorrow, all build in bash to tell you what your git statusses are.
What that sounds amazing actually what a great idea!!
Technically you could automate the coffee with bash. It has been done before:
github.com/NARKOZ/hacker-scripts
Check the fu*ng-coffee.sh and fu*ng-coffee.rb
Jep, would be lovely to have a internet connected coffee machine 👀💙
Ohh that would be nice, offering some hacker the option to make coffee for you lol
Just kidding, it would be awesome, I thought about it before
Haha isn’t that what interns are for? 😂🧐
Cool post Chris, it makes sense to automate the morning routine if you can save time with it!
I used to automate my routine at the last company too.
When the computer boots:
I just couldn't automate the work unfortunately :P
Seems like a good startup script Markus!
Perhaps GPT-3 could automate your work?
I still want to see if it can write blogposts for me 😂
Probably, I am scared of GPT-3 becoming too powerful :P
Yes, I want that too! Tell me about it when a blog post starts writing itself :D
theverge.com/2020/8/16/21371049/gp...
You could also pin the tabs to chrome, it would have the same behaviour
Yeah, but let cool :P does pinning also work on reboot? (might be, I never use it)
Yes, it works. Actually, I found out this feature recently, that's why I shared it here, I used to make scripts like that too.
That's awesome! Nice feature indeed
This is really cool!
I came here for something like this. No reason this can't be automated!
Getting my arduino in soon, might use it for something like that 🙆♂️
Love it man!!
I have my Linux to ask me if I want to check logs from remote servers whenever I turn on my computer.
Automation is life!!!!
That sounds amazing Jorge!
Nice to see so many people into automation 🤟
I use a tiling window manager in Linux and Everything is ready in assigned workspaces as soon as I boot my pc.
That's cool! Linux is so much easier though
Nice living in the future with all of these automated workflows.
It could be way more automated with some raspberry pi's and wifi adopted machines.
How about just not turning off a computer? 😉
Mac for instance gets so bloated if you don't fully turn them off every now and then 😂