zsh.li Linux Blog My Memories About ?

Dear My
Linux

ARCHIVES_DATE august 2019

Ip leaking, spotify and hardware clock.


Sync hardware clock with cron

My hardware clock won't keep correct time, that is the reason I should be using ntpd but this service is not working in my system, but here is how I fixed the issue, instead of reliying of ntpd, I scheduled two cronjobs like this:

0 19 * * * bash /etc/cronup.sh 
3 19 * * * hwclock --systohc

This will run a sh script everyday at 19:00 and then it will sync the hardware clock at 19:03, it way not run at the exact time, but as long as it run daily is fine, the script content is the following:


#! /bin/bash
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"

Installing Spotify in Slackware

Installing spotify in Slackware is pretty strightforward, I just installed with the Slackbuilds in the Slackbuild repo using sbopkg, however I need to create a symbolic link for it to work:

ln -s /usr/lib64/libcurl.so.4.5.0 /usr/lib64/libcurl-gnutls.so.4

Thanks to the following link linuxquestions.org

Ip leaking in Linux

I never though that the ip leaking issues happened in Linux, I mean, this is not Windows, the first one filtration happens with the NetworkManager plugin, is not realiable using a VPN from this plugin, I have checked by myself, however the most realiable openvpn daemon is incredibly failing too, in the lapse between connecting to the VPN if you open a web browser, your ip is leaked, another one leaking that surprised me was an ipv6 vpn filtration, I'm not sure how this was possible, so when using a VPN in Linux, its a must to enable a firewall to only allow that VPN and if you can please disable ipv6.


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,
        },
    }