I do what I can

Random thoughts from Mauricio Teixeira…

Posts Tagged ‘howto

Tilt-shift video using Bash

leave a comment »

I like to play with tilt-shift videos every once in a while, and usually it needs very complex tools to make. So this time I decided to use the simplest tool ever: a Bash script.

You can see the final result here. Continue reading to know how I did it:

Oh, by the way, this is a very nerdy way of doing it. Not a 1-2-3 method. I did this while bored, but didn’t worry about details. Sorry.

Honestly, I’m using a series of pictures to create a video. In this case I used the Time Lapse application on my Nokia N900. I took a total of 644 shots, one every second.

With all the shots ready, I Google around a little bit, found this interesting web site with very useful hints, and created the following Bash script: tilt_shift_video.sh

The Time Lapse application creates a series of files named FileX.jpg, where X is a number from 0 to the number of pics you have taken. So if you want to use the same script, but did not use the same application to take the pictures, you need to edit the script to suit your file naming (or rename your files).

The tilt-shift effect is actually a blur mask applied to all of the pictures, like this:

So if you want to use the same script, but you want to blur a different position on the picture, you need to edit line 12, and modify the parameters for “sparse-color“. Of course there are a number of other options you can change, so you might want to read the docs to understand.

After the script finishes processing all of the pictures, it will then finally compose all of them together to form the video.

Well, I hope this is somewhat useful for anyone.

If you have any hints, please share on the comments.

Written by netmask

julho 2, 2011 at 17:10

Publicado em Uncategorized

Tagged with , , , ,

TweetDeck on RHEL 6 x86_64

leave a comment »

Yeah, I am a monster, I know. Should not be using it, but… Anyway…

Here is a (not so) quick and (very) dirty way of installing TweetDeck on Red Hat Enterprise Linux 6 x86_64 (Release Candidate, by time of this writing).

  • Install all the necessary dependencies:

# yum install ld-linux.so.2 gtk2-devel.i686 libdbus-glib-1.so.2 libhal.so.1 rpm-devel.i686 libXt.so.6 gnome-keyring-devel.i686 libDCOP.so.4 libxml2-devel.i686 nss-devel.i686

  • Download Adobe Air RPM (best practices, remember?).
  • Install it:

# yum localinstall adobeair.i386.rpm –nogpgcheck

  • Restart Firefox, then go to the TweetDeck installer page and click on “Download now, it’s free“.
  • Next, next, finish.
  • Have fun! 🙂

Written by netmask

outubro 21, 2010 at 12:40

Publicado em Uncategorized

Tagged with , , ,

Email to SMS gateway in Linux

with 17 comments

Updated on Jul/03 — Works on Fedora 13, a fix minor inconsistencies.

This is another one of my “quick and dirty” tutorials. This time I will show you how to build an email to SMS gateway.

Before we continue, bare in mind that I didn’t care to document details on system security (specially in what regards to spam filtering or SELinux configuration). The idea here is to show an overview on what needs to be done to have it working. I also won’t explain how to configure an MX entry in DNS, or how to make this integrate to your current email system. The details should be polished by whoever is going to implement, depending on their environment.

Tools I have used here:

  1. A regular PC
  2. Nokia phone running Symbian OS, connected to the USB port in “PC Suite” mode
  3. Fedora 13, with Postfix (personally, I don’t like Sendmail)
  4. SMS Server Tools 3 (installed from Fedora repository, using yum)

First thing I did was installing the SMS Server Tools application, Postfix and disabling Sendmail. I did that because I think Postfix is easier to configure and maintain. If you want to do this using Sendmail, and you find your way into it, please paste the necessary configuration lines on the comments below.

# service sendmail stop
# chkconfig sendmail off
# yum install smstools postfix

The package in Fedora 13 already adds a private user for the sms system, creates the necessary directories and sets the permissions. So we just go with what we get.

Now we need to configure smstools with the minimum parameters necessary for it to run.

# vi /etc/smsd.conf
+ devices = ACM0
+ loglevel = 5
+ group = dialout
+ infofile = /var/spool/sms/smsd.running
+ [ACM0]
+ device = /dev/ttyACM0
+ incoming = no

Important notes here. The device ttyACM0 exists because when I connected the Nokia I selected the “PC Suite” mode. If you select anything different, it will create a different device, but none of them work for sending messages. If you are doing this on a different distribution other than Fedora, check which group is the owner of this device, and set it on the smstools config file, otherwise the application won’t be able to write to the device.

Great. Now we can start the application, and run a basic test. Remember the accepted phone number format: XXYY99999999, where XX is the country code, YY is the region code, and the rest is the real phone number.

# chkconfig smsd on
# service smsd start
# su smstools -c "smssend 551199999999 'This is a short test.'"
# su smstools -c "echo -e 'To: 551199999999\n\nThis is a long test.\nWith multiple lines.\n' > /var/spool/sms/outgoing/test"

At this point, you should have received two messages. If you don’t, read back and double check your settings (or look at the logs). If all works, keep reading.

The final part is to make Postfix receive the messages, and route via smstools. The script that converts from email to SMS is this:

# cp /usr/share/doc/smstools-*/email2sms /usr/local/bin/
# chmod +x /usr/local/bin/email2sms

And here is how we make Postfix deliver to the script:

# vi /etc/postfix/main.cf
+ inet_interfaces = all
+ mailbox_transport = smstools
# vi /etc/postfix/master.cf
+ smstools  unix  -       n       n       -       -       pipe
+  flags=DORhu user=smstools argv=/usr/local/bin/email2sms
# chkconfig postfix on
# service postfix start

If you don’t set the inet_interfaces option, Postfix will only accept connections from localhost. If you need it to receive messages from anywhere in your network, better put something meaningful there.

Now we need to make Postfix understand what is considered to be a valid user on the server. For that, we keep the old /etc/aliases, and add our users:

# vi /etc/aliases
+ 551199999999: netmask
+ 551188888888: badnetmask
# newlaliases

Remember: for every SMS recipient there must be an entry in /etc/aliases. The name after the colon is mandatory because of the file format, but will make no difference to the delivery system, so just use something that will identify the user of that address.

At last, test it:

$ telnet smsgateway.example.com 25
Trying 10.1.1.100...
Connected to smsgateway.example.com (10.1.1.100).
Escape character is '^]'.
220 smsgateway.example.com ESMTP Postfix
helo netmask.example.com
250 smsgateway.example.com
mail from: netmask@example.com
250 2.1.0 Ok
rcpt to: 551199999999@smsgateway.example.com
250 2.1.5 Ok
data
354 End data with .
To: 551199999999@smsgateway.example.com
Subject: Test subject
Hello world!
.
250 2.0.0 Ok: queued as C52E620236

That’s it!

I hope this is useful for you. If you find any mistakes or you wish to suggest any different setup to our next readers, please feel free to comment below.

Have fun! 🙂

Written by netmask

março 11, 2010 at 11:48

Publicado em Uncategorized

Tagged with , , , ,

Utilizando o controle remoto da PixelView Play TV Pro Ultra no Fedora 12

with 2 comments

Recentemente reorganizei meu escritório em casa, e no meio disso, coloquei um sofá, para que eu pudesse assistir filmes confortavelmente (apenas uma segunda opção, já que tenho um Popcorn Hour na sala de estar). Enquanto olhava nas coisas velhas, encontrei o controle remoto que veio com minha antiga PixelView Play TV Pro Ultra, que eu não utilizo há um bom tempo, mas que está instalada do mesmo jeito. Já que eu tenho isso, decidi usar o controle remoto, para fica ainda mais confortável vendo meus filmes do sofá.

Itens utilizados nesse tutorial:

Visão rápida da instalação do hardware: espete a placa no slot PCI, conecte o receptor de infra-vermelho no pluge certo da placa, inicie o sistema. Você consegue… 🙂

Aparentemente o Fedora irá detectar a placa de TV, mas não vai reconhecer o modelo correto, portanto você precisa dizer exatamente qual placa está sendo utilizada. Você faz isso criando um arquivo que irá passar o modelo para o driver:

# cat /etc/modprobe.d/cx88xx.conf
options cx88xx card=27

Agora você tem duas opçẽos: reiniciar o sistema, ou recarregar o módulo. Para recarregar o módulo, execute os seguintes comandos:

# rmmod cx8800
# rmmod cx88xx
# modprobe cx88xx
# modprobe cx8800

Agora instale os pacotes necessários:

# yum install lirc totem-lirc

E aqui estão os passes de mágica: o controle remoto não funciona de primeira, então precisei dizer ao lirc onde encontrar o dispositivo correto, e criar um novo arquivo de configuração explicando a ele o que cada botão faz (bom, pelo menos a maioria deles).

Primeiro você precisa dizer ao lirc onde encontrar o dispositivo. Para isso edite o arquivo /etc/sysconfig/lirc e modifique-o conforme abaixo:

LIRC_DEVICE="name=cx88\?IR\?\(PixelView\?PlayTV\?Ultra"

Em seguida salve o text desta página para um arquivo chamado /etc/lirc/lircd.conf. Agora habilite o serviço do controle remoto:

# chkconfig lirc on
# service lirc restart

Depois disso, tudo o que você precisa fazer é abrir o Totem, ir para o menu Editar -> Plug-ins e habilitar o “Controle remoto infra-vermelho”.

Infelizmente não dá para abrir um arquivo novo, nem pular para o próximo arquivo na sua lista de reprodução, mas ao menos você pode executar, parar, finalizar, adiantar ou voltar o vídeo. Talvez depois eu dedique um tempo para habilitar mais recursos do controle (ou, se você já o fez, por favor fale como nos comentários dessa página).

Divirta-se! 🙂

Written by netmask

fevereiro 14, 2010 at 21:43

Publicado em Uncategorized

Tagged with , , , , ,

Using PixelView Play TV Pro Ultra remote control on Fedora 12

leave a comment »

I recently reorganized my home office, and when doing so, I added a couch so I could watch movies more comfortable (it’s a second option, since I already have a Popcorn Hour at the living room). While looking at some old stuff, I found the remote control that came with my ancient PixelView Play TV Pro Ultra, which I don’t use for a long while, but it’s still installed anyway. Since I have that, I decided to make the RC available, so I could be even more comfortable while pausing/fast-forwarding my movies from the couch.

Items used in this tutorial:

Quick overview about the hardware install part: place the card on the PCI slot, connect the IR receiver on the proper plug on the board, boot the system. You’ll find your way… 🙂

Apparently Fedora will detect the TV card, but it won’t recognize the proper model, so you need to tell it exactly which card is in use. You do so by creating a file telling the driver about it:

# cat /etc/modprobe.d/cx88xx.conf
options cx88xx card=27

Now you have two options: reboot, or reload the module. To reload the module, run the following commands:

# rmmod cx8800
# rmmod cx88xx
# modprobe cx88xx
# modprobe cx8800

Now install the necessary packages:

# yum install lirc totem-lirc

And here are the magic tricks: this remote control does not work out of the box, so I had to tell lirc where to find the IR input device, and create a new config file to make it understand what each button does (well, at least most of them).

First you need to tell lirc where to find the IR input device. You do so by editing /etc/sysconfig/lirc and editing the device line like this:

LIRC_DEVICE="name=cx88\?IR\?\(PixelView\?PlayTV\?Ultra"

Next, save the text of this page to a file named /etc/lirc/lircd.conf. Now enable the remote control daemon:

# chkconfig lirc on
# service lirc restart

After that, all you need to do is open Totem, go to menu Edit -> Plug-ins and enable the “Infra-red remote control” plug-in.

Unfortunately you can’t open a new file, neither skip to the next file on your play list, but at least you can play, pause, stop, fast forward and rewind. Maybe I’ll take some time later to enable more of the IR features (or, if you have done so, please add to the comments of this page).

Have fun! 🙂

Written by netmask

fevereiro 14, 2010 at 21:21

Publicado em Uncategorized

Tagged with , , , , ,

Aplicação na Área de Notificação do Gnome em Python (português)

with 4 comments

É bom ver como sua aplicação preferida no Gnome fica lá na área de notificação (também chamada de bandeja), e convenientemente fica lá até alguma coisa acontece. Você já se perguntou como se faz isso em Python?

Essa é uma demonstração não-tão-rápida e não-tão-limpa de como escrever uma pequena aplicação Gnome em Python que fica na área de notificação do Gnome (que também vamos chamar de “bandeja”), e reage a algumas ações de menu.

Você pode encontrar o código compledo baixando o arquivo hello-tray.py. Abaixo irei comentar as partes mais importantes do código, de forma que você entenda o básico, e possa criar seu próprio código daqui em diante.

Continue lendo »

Written by netmask

abril 18, 2009 at 13:31

Publicado em linux

Tagged with , , , ,

Gnome Notification Area Application in Python (English)

with 13 comments

It’s nice how many of your preferred Gnome applications can fall back into a small icon on the notification area (also called tray), and conveniently sit there until something happens. Have you ever wondered how to do that in Python?

This is a not-so-quick and not-so-dirty demonstration of how to write a small Gnome Python application that will sit in the Gnome notification area (which we will also call “tray”), and react to some menu actions.

You can find the full code by downloading this file:
hello-tray.py

Below I will comment the most important parts of the code, so that you understand the basics, and create your own code from there.

Continue lendo »

Written by netmask

abril 18, 2009 at 13:00

Publicado em linux

Tagged with , , , ,