Search Git Users

Introduction

Let’s say we want to change our git username to another one. Instead of checking manually if the username is already taken, we can automate this process by writing a script named fgitusr. The content of the script looks like this:

Code

# Check regex rules
if [[ !("$1" =~ ^[0-9a-zA-Z]{1}[0-9a-zA-Z\-]*[0-9a-zA-Z]{1}$) ]]; then
    echo "$1 DOESN'T MATCH REGEX"
    exit 1
fi

# Check if usersname exists
curl --output /dev/null --silent  --head --fail "https://github.com/$1"
if [ $? -eq 0 ]; then
    echo "USER $1 EXISTS";
else
    echo "USER $1 DOESN'T EXIST";
fi

The main idea is that we use curl to look if the url https://github.com/<username> is a valid link. If it is, then the user exist.

[Read More]
bash  regex 

Read Html inside terminal

This can be done by using curl and pandoc. The command looks like this:

curl <url> | pandoc -f html -t plain | less

After that you can go up and down with j and k keys. With this command you can read directly in the terminal. If you want to store the information in a text file, you could use this command:

curl <url> | pandoc -f html -t plain > file.txt

Where file.txt is the name of the file where the information is stored.

[Read More]
bash  html 

Hand position when writing

After a lot of typing my wrist started to hurt. So I done some research and found out that the best way to have you hand when typing is without resting your palms on you keyboard, basically keep your elbows up like a piano player…because in the long run can cause fatigue and also other wrist problems. After testing this method I am quite happy with the result and I will try to implement it more and more 😃.

First post

Hugo is a great minimalistic tool for generating static websites. It took me one day to get a hang of it and be able to generate and publish my own website. Also the fact that there are a lot of themes at your fingertips is great, because you can also switch your aspect of your site without much effort.

static  hugo