Home Linux Blog Memories Me About ?

Dear My


Email notifications in your terminal

I lost my domain zsh.li mainly because I didn't check my email pretty often, getting email notifications in the terminal is pretty easy, but it took me a while to figure out how to do it.

This is an old-fashioned method, but I like because nowadays developers are too obsessive with deficient and bloated apps, it can use IMAP but I like POP3 as it deletes the original message from the server which is great for privacy.

I'm using Slackware current which is the testing branch for Slackware 15. Slackware current is using Postfix as the system mail service, surprisingly Postfix is also used for an internet email server but here postfix is restricted to our local installation.

Sadly I haven't been receiving the cron mails in a lot of time and the command mailq showed me lots of mails in queue, so I had to fix the postfix service, I did so generating an alias database. Mailq show me lots of mail alias errors.

Most of time the mail system works out of the box, so you will only need the following:

1. Install fetchmail

2. Paste the following code and replace daya with your local unix user, mail.gmail.com with the mail domain, flor@gmail.com to your email address and parangaricutirimicuaro to your password:

set daemon 600
set syslog
poll mail.gmail.com
  with nodns,
  with protocol POP3
  user "flor@gmail.com" there is daya here,
  with password parangaricutirimicuaro ,
  with ssl, sslcertck;

Add to .bashrc (or .profile):

mail -e && mail -H

And for having an ascii cow displaying the email headers:

mail -e && cowsay "$(mail -H)"

You may need to install the bsdgames for it

Notice: Your emails would be deleted from the email server. You may add the keep parameter after here (daya here)

How to automatically convert the PNG pictures to JPG images.

On the server I have this script running in the background that converts all the PNG files I upload through SFTP to the jpg format in order to improve the website performance.

Requeriments: inotify-tools

#! /bin/bash
inotifywait -m --format '%w%f' -e close_write -r /var/www/ | while read FILE
	if ( echo $FILE  | grep -e png$ ); then
#	       sleep 10 
	       convert "$FILE" "${FILE%.png}.jpg"
	      mv "$FILE" /tmp

How to record and replay a terminal session

Paste the following code in $HOME/.profile or $HOME/.bashrc

, I was inspired for internet forums, however I added the exit function a, it's important mainly for SSH. Also included the time parameter, using the time parameter allows us to replay the script record using the scriptreplay --time=FILE1 FILE2 command.

In the case that you want it to be more hidden or system-wide you can add the code into /etc/profile.

mkdir -p $HOME/.log
test "$(ps -ocommand= -p $PPID) | awk '{print $1}')" == 'script'  || script --timing=$HOME/.logs/$(date +%s).time $HOME/.logs/$(date +%s) -q

if [[ "$(ps -ocommand= -p $PPID) | awk '{print $1}')" == 'script' ]]; then
kill -9 $$

World clock in awesome

awesome systray
Awesome systray

For displaying multiple clock in awesome with different timezones we need to create new clock widgets, this post is based on awesome 4.2, you will need to create a new widgets in ~./config/awesome with the following code: utc.lua

It has just two differences with the original textclock.lua widget, here the diff output from these two files:

<     format = format or " UTC:  %H:%M || "
>     format = format or " %d local: %H:%M "
<    timezone = timezone or TimeZone.new("Z")
>    timezone = timezone and TimeZone.new(timezone) or TimeZone.new_local()

I'm not a programmer, but I read the programmer Documentation and modified the code accordingly, I only was able to understand that the parameters after the OR operand was true and I don't know why, but my code works.

Its important to notice that you have to specify the timezone name in the format variable in order to show the clock's name, check the bold text in the diff output above.

The most important thing to do is to replace the Z in the TimeZone.new("Z") function, Z is the UTC timezone, in the case of Argentina the timezone would be: TimeZone.new("America/Buenos_Aires")

Then edit your ~/.config/rc.lua file and search for this string:

mytextclock = wibox.widget.textclock()

In order to use the widget we have to pass the function into a variable, so if we have the Argentina and UTC clocks besides the local one, it will look like this:

mytextclock2 = textclock2()
utc= utc()
mytextclock = wibox.widget.textclock()

Finally search for the widgets wibox session and add the declared variables there:

-- Add widgets to the wibox
    s.mywibox:setup {
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,

Slackware and recording an iso image

How to record a DVD in Slackware

Slackware includes the command growisofs by default, however, it cannot be run as root, so you have to be in the cdrom group.

In order to record an iso I run the following command:

growisofs -dvd-compat -Z /dev/dvd=iso.iso

And it started burning the image in a very high speed, 24x, the DVD disk says that 16x, indeed I prefer to use a lower speed like 4x for recording; thus, the when it finished the burning, the file in the disk was corrupt, so I recommend you to specify the speed reasonably while using this command.

For doing that use the parameter speed and specify number that is the x speed


Rss feed of the category