Skip to content

Instantly share code, notes, and snippets.

View akifateef's full-sized avatar

Muhammad Akif Ateef akifateef

View GitHub Profile

Install Go using asdf for Visual Studio Code on macOS

I had a lot of issues trying to install Golang on macOS using asdf package manager to develop on Visual Studio Code.

So here's the steps needed to setup it properly:

Open Terminal and install asdf with this command:

You have to install Homebrew before running the installation command.

@akifateef
akifateef / terminal-colors-branch
Created September 4, 2019 10:18 — forked from danielalvarenga/terminal-colors-branch.sh
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
# This script is not written by me.
# I have just modified it for using speedtest-cli on ubuntu
# and have just replaced a values.
# You can configure a cron for making the bot actually a bot ;)
#
# https://www.reddit.com/r/technology/comments/43fi39/i_set_up_my_raspberry_pi_to_automatically_tweet
# http://pastebin.com/WMEh802V
# https://github.com/bear/python-twitter
# https://pypi.python.org/pypi/speedtest-cli/
@akifateef
akifateef / hex_to_kml_color.rb
Last active December 23, 2015 09:49
KML files have their own format for color, which creates some confusion. To clear the confusion we can write a simple method which will convert hex colors to KML color format.
# to convert hex colors to kml color format
# for reference you can visit the link below
# https://developers.google.com/kml/documentation/kmlreference?hl=en#elements-specific-to-colorstyle
# hex is color in hexadecimal (000000 - FFFFFF)
# alpha is opacity of the color (0 - 100)
def hex_to_kml_color(hex, alpha = 100)
opacity = (((alpha / 100.to_f) * 255).round).to_s(16).upcase
color = (hex.scan(/.{1,2}/).reverse.join).to_s
opacity + color