On May 8th, 2021 in Tech

My Gmail account is my main email. I get dozen (if not hundreds) of e-mails everyday. Most of them are already filtered with dozen of rules that I’ve been creating since 2006. But there are a functionality that was missing: alert me whenever an important e-mail arrives.

I tried using filters combined with notifications alerts on Android or IOS, but after struggling for sometime, I gave up.

Years later, on my “automation my life” mission, I decided to search for some Google Scripts that could ease my life. That’s when I found Andreas Hochsteger’s Gmail2GDrive. I gave a try and it worked flawless, nowadays many of my bills are saved automatically on my Google Drive making my life much easier.

Then yesterday I remembered of my long lasting issue of not being able to be notified of my important e-mails. As my studies on Python have increased, also my knowledge and use of Telegram API. So I thought that maybe I could join Gmail2GDrive and Telegram API and personalize a solution, that’s when I adapted Gmail2Gdrive.

I got the project and made it much simpler (not better, simpler in functionalities) and adapted it to work with Telegram. I set the script to run every 5 minutes and voilà, now I have my notification system working.

If you want to check it, go to Gmail2Telegram on Github.

Tags: automations e-mail Google Script javascript

Customizing my macOS Terminal

On April 24th, 2021 in Myself, Tech

MacOS Terminal is ugly and not very functional. I have one always open, so I decided to make it look better. I used some tips from a Medium post (How To Customize Your macOS Terminal).

Setting the Theme

I’ve been using a theme called Homebrew for the last months, but I wasn’t satisfied with it, so I decided to take a look on the recommended theme “atom-one-dark-terminal“. I imported it and I liked it.

Setting preferences

On the same Terminal Preference Window, set those settings.

Text Tab
* Font: Menlo Regular 12 pt
*Text: Deselect Use Bold Fonts and Allow Blinking Text
*Cursor: Select Vertical Bar and Blink Cursor
Window Tab
*Title: Deselect Active process name, Arguments, Dimensions
Tab Tab
*Title: Deselect Path, Active process name, Arguments, Show activity indicator
Shell Tab
*Startup: Select Run command: and add ‘clear’ to the textbox, select Run inside shell
Keyboard Tab
*Select Use Option as Meta key

It’s almost the same as the Medium post suggested, my only change was the font size. I prefer it with 12pt.

Configuring .bash_profile

My .bash_profile was already set, but I decided to improve it and clean with the Medium suggestions.

# My .bash_profile source ~/.bash_prompt source ~/.aliases
Code language: PHP (php)

Configuring .bash_prompt

I had to create the .bash_prompt:

touch .bash_prompt
Code language: CSS (css)

If you want to understand what to what, take a look in the Medium post. It’s well written and explained. I’m showing my complete .bash_prompt:

#!/usr/bin/env bash # GIT FUNCTIONS git_branch() { git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } # TERMINAL PROMPT PS1="\[\e[0;93m\]\u\[\e[m\]" # username PS1+=" " # space PS1+="\[\e[0;95m\]\W\[\e[m\]" # current directory PS1+="\[\e[0;92m\]\$(git_branch)\[\e[m\]" # current branch PS1+=" " # space PS1+=">> " # end prompt export PS1; export CLICOLOR=1 export LSCOLORS=ExFxBxDxCxegedabagacad
Code language: PHP (php)

Configuring .aliases

I had to create my .aliases too:

touch .aliases
Code language: CSS (css)

And here’s my file:

# NAVIGATION alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." # COMMON DIRECTORIES alias dl="cd ~/Downloads" # alias dt="cd ~/Desktop" alias dc="cd ~/Documents" # alias p="cd ~/Documents/projects" # alias home="cd ~" # GIT alias g="git" alias gs="git status" alias gd="git diff" alias gb="git branch" alias gm="git checkout master" # SHOW/HIDE HIDDEN FILES #alias showhidden="defaults write AppleShowAllFiles -bool true && killall Finder #alias hidehidden="defaults write AppleShowAllFiles -bool false && killall Finder # SHOW/HIDE DESKTOP ICONS #alias hidedesktop="defaults write CreateDesktop -bool false && killall Finder #alias showdesktop="defaults write CreateDesktop -bool true && killall Finder # CUSTOM CHANGES alias ll="ls -alh"
Code language: PHP (php)

Notice that I copied the Medium post file, but commented many of the lines. I also recreated one of my most used alias on this file (the “ll”).

After that, you just need to reopen Terminal and it’ll be working with the new tweaks.


Tags: bash mac terminal