zsh.li Pinkhat Memories Me About ?

Dear My
Linux

ARCHIVES_DATE 2019

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
do
	if ( echo $FILE  | grep -e png$ ); then
#	       sleep 10 
	       convert "$FILE" "${FILE%.png}.jpg"
	      mv "$FILE" /tmp
	       fi
done

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
	exit
else
kill -9 $$
fi

Getting ip from radio streaming station


First of all you may use directory.shoutcast.com for getting the ip and port that may change over the time.

However using this method I wasn't able to search any working vocaloid station, so I searched it in my favorite search engine and found this online vocaloid radio site: vocaloidradio,, however despite of using the developers tools in the web browser I wasn't able to find the streaming station IP, this javascripts radio players are getting smarter over time for hiding the source IP.

The most surprising is that the servers are using a free technology for streaming, icecast, however the fronted is privative and includes advertisement. So even if the web browser is not showing me the ip, I had an idea, I would use a package instrospection tool if that is the right name, I used iptraf-ng in Linux for monitoring in realtime all the ips with the DNS revolver enabled and found this url: http://curiosity.shoutca.st:8019/. This is the icecast webserver page. Here I was able to download the right port of this streaming service since this software is free.

This is helpful because I like to use streamripper to download the music I'm listen to because I believe in sharing.


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.