lunes, 25 de abril de 2016

Updating all pip/pip3 installed packages

Motivation

I've been looking for several options to upgrade my local python packages installed via pip. I've read some posts at stackoverflow and some github.com issues addressing different ways to upgrade them, but I was not very satisfied. I tried to make things on my own and here's how I did it.


Updating pip/pip3 packages

I knew that the command list of pip/pip3 consoles return the list of locally installed python packages. Just needed to take that output, process it and use it to feed pip/pip3 itself in order to get the packages updated.



I hope you find this useful!

sábado, 9 de abril de 2016

Script for automated text translation in Linux*

* I'm working with GNU/Linux Debian, but it should work ;)

Motivation

Some times you are reading stuff on books, documents, or simply the web. I know it sucks to keep opening new tabs on your browser in order to get translations for some words you don't understand. A Friend of mine told me about some script that can be bound to a keystroke combination, popping out the meaning of the highlighted text.

There are several of such scripts on the web, so making one by myself wouldn't be smart righ? Wrong!. I've tried some of them and all of them lack of features like checking that the clipboard is not empty or setting some limit for the size of the text to be translated or something like checking the languages involved in the translation(It could be useful every now and then). Besides it proved to be a good bash excercise for me.


How it works?

The operation steps are:

  • Check the contents of the primary clipboard. This clipboard always stores the text selected with thw mouse pointer at X sessions.
  • Queries a translation of the contents to google translator api
  • Formats result and makes a call to notify-send to deal with notifications daemon who shows the translation

Take a look at the script here

Making things work

Download the script and place it somewhere like /usr/local/bin give it execution permissions and bind the executable to some key combination that you will press each time you need to translate a selection of text :D

jueves, 31 de marzo de 2016

Putting the shit together

A year has passed since I wrote anything in this blog. I would like to say it was lack of time, or even lack of motivation. That wouldn't be by far the most honest thing to say. Now that the word "honesty" popped out I'd like to say that "honesty" is one of the most precious qualities someone can have, I appreciate it a lot, and I do my best to remain honest even though it would get me in trouble. And it has gotten me in troubles in the past.
Theres an important link between honesty and courage. It takes courage to be to be honest and open, and who wants to be a pussy? not me if you ask me.

Anyway, things has been happening (life is always happening...) and I had and have to cope with them. Luckily, a lot is to be learned each day we have on this earth and I've been taking my lessons during the last 366 days, and I found that attitude towards "life stuff" makes an important difference.

I'm baking some posts (some of them left untouch for over a year) I'll be serving them in the next days.

I'm glad to be right back at it again.