Regex, perl, sed… inúmeras são as ferramentas utilizadas para manusear textos e padrões. Achá-los, substituí-los, etc.

Aqui, vamos para um caso bem simples mais que pode ser bastante comum entre aqueles que precisam manusear arquivos tabulados/com colunas e informações.

O Problema: Imagine que você tem dois arquivos, arq1 e arq2. Em arq1 você possui duas colunas, veja abaixo.


123 ABC
345 DEF
78 EF


21 123 1
23 345 1
23 345 0
23 123 1
34 345 1

Agora, o que você precisa fazer é que nas posições do arq2 seja acrescentada uma nova coluna com a informação do nome destas posições. Como fazer isso? AWK é a resposta🙂.

awk 'NR==FNR{a[$1]=$2;next}{$4=a[$2];}1' f1 f2

Explicando o comando…

  • NR==FNR, permite que o AWK percorra cada arquivo por vez/ou melhor um de cada vez.
  • a é um vetor gerado na hora que o primeiro arquivo é percorrido. Nesse caso, criamos um vetor associativo, onde a[$1] = $2, lê-se, a com chave $1 recebe valor $2 do primeiro arquivo. Trocando em miúdos, seria como a[34] = ‘CD’, etc.
  • next permite que ele passe o resto do bloco
  • {$4=a[$2], basicamente diz que a coluna $4, que não existe no arquivo 2, mas será criada, deve ser preenchida com o conteúdo do array associativo da coluna 2 do arquivo 2 usando o array associativo criado com arq1. Ou seja, a[123] = AB , e assim por diante.
  • o 1 no }1 , diz ao awk para printar a linha.

Como resultado final, obtém-se:

21 123 1 ABC
23 345 1 DEF
23 345 0 DEF
23 123 1 ABC
34 345 1 DEF

:)! Espero que seja útil.


Yes, sometimes you just forget it and probably you already read this on the web, but let’s just be sure about that.


  1. in grub screen press ‘e’ to edit
  2. in kernel line, at the and append: init=/bin/bash (to see how your cmdline looks like, just type: cat /proc/cmline)
  3. Done that, wait for it.
  4. mount -o remount,rw /
  5. passwd root
  6. touch ./autorelabel  (For fedora, because SELinux)
  7. and enjoy it.

If you are an unhappy user of Chromium-browser or chrome you know exactly what I’m talking about. I stopped to count how many time I had to reboot my whole system because these two guys. Yeah, I’m guilty in part. Since I often have 30 tabs in my browser. But, shouldn’t these guys handle with memory resource in a more clever way? Recently I read that the new way Chrome is deal with it is to kill tabs that reach a limit amount of memory, but it’s not a happy end at all.
In my system, Linux Mint (currently), I just lost my counts the times I had to reboot all the system because The Memory Eater.
For now , seems it hasn’t any solution, but I realized these guys have a chrome://memory-redirect tool [1], that show you how many memory are in using. Take a look at the s-shot.

While any real solution comes, how about to keep an eye in who is the greedy memory guy and close it🙂.


[1] https://www.chromium.org/developers/memory-usage-backgrounder


Talvez você se enrole na hora de definir suas permissões. Talvez você nem entenda o que raios são aqueles números que você coloca para ter permissões.

Vamos então dá uma rápida olhada em como elas funcionam:

# Há exatamente três colunas nas quais você pode restringir permissões:
# Owner - Group - All Users
rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000

# cada flag setada corresponde a um bit setado para 1 ou zero caso contrário.
# se lermos cada coluna separada em binário teremos
rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4

# Assim:
- 777 = 111 111 111 = rwx rwx rwx
- 644 = 110 100 100 = rw- r-- r--
- 755 = 111 101 101 = rwx r-x r-x
# e assim por diante...
# Simples, não é?!
# Você pode ler mais sobre o assunto nas referências [1] :)!

[1] http://linuxcommand.org/lts0070.php

TODO list command

I often have to track my tasks in a day, week, month, and so on. The way I was doing this was to type in file what I should to do. But I always want to use a more simple and practical way. Because that I just implemented this ‘td’ command to solve my problems in tracking tasks🙂. Hope it’s also good for you.

Just take a look in my github for get it: https://github.com/kirotawa/td

What is it?

– td is an acronym for TODO that aims to provide a way using just
command line for keep a track of activities/todo things.


Usage: td [-h] [-a] [-d DESC] [-S {started,finished,canceled}] [-s START]
[-e END] [-D] [-i ID] [-p {normal,medium,high}] [--debug] [-v]
[--getd] [--up-status] [--up-end] [--up-priority]
[--list | -ls | -le | -lp | -lS]

optional arguments:
-h, --help show this help message and exit
-a, --add adds a todo into list
-d DESC, --desc DESC sets a description
-S {started,finished,canceled}, --status {started,finished,canceled}
sets todo status
-s START, --start START sets a start date
-e END, --end END sets a end date=d/m/Y format
-D, --delete delete a give todo by id
-i ID, --id ID pass a id to other options
-p {normal,medium,high}, --priority {normal,medium,high}
sets a priority
--debug provides debug info
-v, --version provies current version
--getd get full description of todo by id
--up-status update status given a id
--up-end update end date given a id
--up-priority update priority given a id
--list list everything todo by id
-ls, --lstart list by start date
-le, --lend list by end date
-lp, --lprio list by priority
-lS, --lstatus list by status

These days I had a couple of interviews in a company. First the technical one, a problem that I had to solve in three days. After a chatting with persons from the company; another chatting with tech guys; an attempt to do pair programming; and a last one talking with a leader.

As you see, many steps to get an offer. Well, they did offer me anything. It’s OK. But while it’s okay what bother is that feedback from companies today aren’t clear. Seems all the companies have an agreement where they say the same bullshit all the time.

“Sorry, you seems to be great…blah blah blah…but…”

You never get a real feedback and that is annoying. I wonder how someone can improve their skills, the way he/she does interviews, be better, etc. If  no one never says what is/are your negative points.

Let’s just imagine that you go to the doctor and there he says “Well, you have a terrible disease, let’s start some treatment” and these are the only things he says. How the heck you will understand the issues you have? How the heck you can deal with this in a properly way? That’s is the same when these companies says their empty meaning feedback email. They say something that mean nothing.

It would be really cool if companies start to act in a more honest way. “hey, you were good in tech, nice solution, etc…but we just didn’t like how you interact in our pair programming. Maybe you can improve this for next interviews in your career” or just ” hey you were good in tech one, but we just didn’t like how you look like in the webcam, sorry, look for a new hairstylist” – You know, last is a joke, but I really would like to have a honest and REAL feedback sometimes, instead this bot bullshit they send.

EDITED: I was just thinking for a moment, what if human race had not seen its mistakes and try to do better? Well we, for sure, would not have evolved. Said that, Companies, be a Darwinist one giving feedback don’t be a creationist one. I don’t want to wait for a god to say me what I’m doing wrong. import this in Python and take this line for you “Explicit is better than implicit.”. If you want people get better and not only use their six sense to guess what was the issue – of course, when it’s not obvious – please, start to act doing a straight feedback! –  Thank you!

AES is the most important algorithm used today for crypto. You may not see it, but it is everywhere.

For those that need to understand in a quick overview AES this image is for you🙂



[1] EXPANDkey image

[2] AES shiftrows

[3] AES Subbytes

[4] AES MixColumns