Home Linux Blog Memories Me About ?

Dear My
Linux

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:


35c35
<     format = format or " UTC:  %H:%M || "
---
>     format = format or " %d local: %H:%M "
37c37
<    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,
            mylauncher,
            s.mytaglist,
            s.mypromptbox,
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            mykeyboardlayout,
            wibox.widget.systray(),
	   utc,
            mytextclock,
            mytextclock2,
            s.mylayoutbox,
        },
    }

Convert all htaccess files to httpd.conf directives


This post is for the Apache web server, I created a simple script that will do the job. You may use it in Wordpress or in many CMS, surely this script will be useful in a lot of situations. It will help you to increase the speed and security of your site. Requirements: root access.

#! /bin/bash
b=$(find $1 -name .htaccess)
for p in $b; do if [[ -s "$p" ]] ; then a=$(dirname $p); echo \<Directory \"$a\"\>; cat $p; echo; echo \</Directory\>; echo; fi; done

You only have to specify the website directory and it fill search for all .htaccess files in sub-directories, then it will print the directives for the httpd.conf file, you can invoke the script like this:

./script.sh /var/www/html


Add the resulting configuration manually to httpd.conf and don't forget to add AllowOverride None to the root directory, in this way my website speed increased noticeably! Also security increased. Please notice that you may end with a duplicated entry for the base directory, so please check it carefully. I read that a hacked website may include malicious code in the .htaccess files, so please check the code before adding into the config file.


All system messed when installing an application


It has been a while since the last time I did a whole system update in Slackware, this time I tried to install audacious, an audio player included in the official repos, the first thing to do was updating the list of files:

slackpkg update

Then I installed audacious:

slackpkg install audacious

At certain point it seems that it asked me to replace configuration files. It messed with my whole system. Installing just an application messed with all my /etc directory. So my advice is that you always check the configuration files that will be updated no matter what you are doing or the distro you are using.

How I solved it?

The next day I realized that I had lots of .orig files in /etc. So I restore all my important config files.

find /etc -name *.orig

Notice that I lost my /etc/rc.d/rc.local , there was not an /etc/rc.d/rc.local.orig


Script for concatenation


Here a tip for using split and cat, you can use this simple bash script for concatenating the pieces of the file, first you have to change the current directory to the one with the current files part.

You will be asked by the base name and the extension of the file. Easy!

#! /bin/bash
read -p "Base name: " basi
read -p "Extension: " ext
cat $(ls $basi*) > $basi.$ext

Site announcements.


I lost my domain rpm.li, but I got zsh.li instead. Did you know that the dot li domains has to be renew 15 days before the expiration date?

The blog was moved from pinkhat.rpm.li to pinkhat.zsh.li

Also cat.rpm.li was moved to cat.zsh.li and the public link shortener was removed.

The Screenshot in https://pinkhat.zsh.li gallery was removed and will be included again in a more traditional way.

The home page is now very minimalist and includes links for all sites.

I tried to include bitcoin based advertisement, but I didn't liked because it makes the load of the sites slower, Advertisement it's like politics and religion, polemic.

Lately I been working in increasing the efficiency of the site instead of creating content, but there will be new posts and content soon.