Archive for May, 2014

Use apt-get with Proxy howto – Set Proxy system-wide in Linux shell and Gnome

Friday, May 16th, 2014

linux-apt-get-configure-proxy-howto-set-proxy-systemwide-in-linux

I juset setup a VMWare Virtual Machine on my HP notebook and installed Debian 7.0 stable Wheezy. Though VMWare identified my Office Internet and configured automatically NAT, I couldn't access the internet from a browser until I remembered all HP traffic is going through a default set browser proxy.
After setting a proxy to Iceweasel, Internet pages started opening normally, however as every kind of traffic was also accessible via HP's proxy, package management with apt-get (apt-get update, apt-get install etc. were failing with errors):


# apt-get update

Ign cdrom://[Debian GNU/Linux 7.2.0 _Wheezy_ – Official i386 CD Binary-1 20131012-12:56] wheezy Release.gpg
Ign cdrom://[Debian GNU/Linux 7.2.0 _Wheezy_ – Official i386 CD Binary-1 20131012-12:56] wheezy Release
Ign cdrom://[Debian GNU/Linux 7.2.0 _Wheezy_ – Official i386 CD Binary-1 20131012-12:56] wheezy/main i386 Packages/DiffIndex
Ign cdrom://[Debian GNU/Linux 7.2.0 _Wheezy_ – Official i386 CD Binary-1 20131012-12:56] wheezy/main Translation-en_US
Err http://ftp.by.debian.org wheezy Release.gpg
  Could not connect to ftp.by.debian.org:80 (86.57.151.3). – connect (111: Connection refused)
Err http://ftp.by.debian.org wheezy-updates Release.gpg
  Unable to connect to ftp.by.debian.org:http:
Err http://security.debian.org wheezy/updates Release.gpg
  Cannot initiate the connection to security.debian.org:80 (2607:ea00:101:3c0b:207:e9ff:fe00:e595). – connect (101: Network is unreachable) [IP: 2607:ea00:101:3c0b:207:e9ff:fe00:e595 80]
Reading package lists…

 

This error is caused because apt-get is trying to directly access above http URLs and because port 80 is filtered out from HP Office, it fails in order to make it working I had to configure apt-get to use Proxy host – here is how:

a) Create /etc/apt/apt.conf.d/02proxy file (if not already existing)
and place inside:
 

Acquire::http::proxy::Proxy "https://web-proxy.cce.hp.com";
Acquire::ftp::proxy::Proxy "ftp://web-proxy.cce.hp.com";


To do it from console / gnome-terminal issue:
echo ''Acquire::http::Proxy "https://web-proxy.cce.hp.com:8088";' >> /etc/apt/apt.conf.d/02proxy
echo ''Acquire::ftp::Proxy "https://web-proxy.cce.hp.com:8088";' >> /etc/apt/apt.conf.d/02proxy

That's all now apt-get will tunnel all traffic via HTTP and FTP proxy host web-proxy.cce.hp.com and apt-get works again.

Talking about Proxyfing Linux's apt-get, its possible to also set proxy shell variables, which are red and understood by many console programs like Console browsers lynx, links, elinks  as well as wget and curl commands, e.g.:

 

export http_proxy=http://192.168.1.5:5187/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

For proxies protected with username and password export variables should look like so: echo -n "username:"
read -e username
echo -n "password:"
read -es password
export http_proxy="http://$username:$password@proxyserver:8080/"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

To make this Linux proxy settings system wide on Debian / Ubuntu there is the /etc/environment file add to it:
 

http_proxy=http://proxy.server.com:8080/
https_proxy=http://proxy.server.com:8080/
ftp_proxy=http://proxy.server.com:8080/
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY=http://proxy.server.com:8080/
HTTPS_PROXY=http://proxy.server.com:8080/
FTP_PROXY=http://proxy.server.com:8080/
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"


To make proxy global (systemwide) for most (non-Debian specific) Linux distributions shell environments create new file /etc/profile.d/proxy.sh and place something like:

function proxy(){
echo -n "username:"
read -e username
echo -n "password:"
read -es password
export http_proxy="http://$username:$password@proxyserver:8080/"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
echo -e "nProxy environment variable set."
}
function proxyoff(){
unset HTTP_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
unset FTP_PROXY
unset ftp_proxy
unset RSYNC_PROXY
unset rsync_proxy
echo -e "nProxy environment variable removed."
}

To set Global Proxy (make Proxy Systemwide) for a user in GNOME Desktop environment launch gnome-control-center

And go to Network -> Network Proxy

/images/gnome-configure-systemwide-proxy-howto-picture1

/images/gnome-configure-systemwide-proxy-howto-picture2

To make proxy settings also system wide for some GUI Gnome GTK3 applications

gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http host 'your-proxy.server.com'
gsettings set org.gnome.system.proxy.http port 8080

Archive Outlook mail in Outlook 2010 to free space in your mailbox

Thursday, May 15th, 2014

outlook-archive-old-mail-to-prevent-out-of-space-problems-outlook-logo
If you're working in a middle or big sized IT company or corporation like IBM or HP, you're already sucked into the Outlook "mail whirlwind of corporate world" and daily flooded with tons of corporate spam emails with fuzzy business random terms like taken from Corporate Bullshit Generator

Many corporations, because probably of historic reasons still provide employees with small sized mailboxes half a gigabyte, a gigabyte or even in those with bigger user Mailboxes like in Hewlett Packard, this is usually no more than 2 Gigabytes.

This creates a lot of issues in the long term because usually mail communication in Inbox, Sent Items, Drafts Conversation History, Junk Email and Outbox grows up quickly and for a year or a year and a half, available Mail space fills up and you stop receiving email communication from customers. This is usually not too big problem if your Mailbox gets filled when you're in the Office (in office hours). However it is quite unpleasent and makes very bad impression to customers when you're in a few weeks Summar Holiday with no access to your mailbox and your Mailbox free space  depletes, then you don't get any mail from the customer and all the time the customer starts receiving emails disrupting your personal or company image with bouncing messages saying the "INBOX" is full.

To prevent this worst case scenario it is always a good idea to archive old mail communication (Items) to free up space in Outlook 2010 mailbox.
Old Outlook Archived mail is (Saved) exported in .PST outlook data file format. Later exported Mail Content and Contacts could be easily (attached) from those .pst file to Outlook Express, leaving you possibility to still have access to your old archived mail keeping the content on your hard drive instead on the Outlook Exchange Mailserver (freeing up space from your Inbox).

Here is how to archive your Outlook mail Calendar and contacts:

Archive-outlook-mail-in-microsoft-outlook-2010-free-space-in-your-mailbox

1. Click on the "File" tab on the top horizontal bar.Select "Cleanup Tools" from the options.

2. Click "Cleanup Tools" from the options.

3. Click on the "Archive this folder and all subfolders" option.

4. Select what to archive (e.g. Inbox, Drafts, Sent Items, Calendar whatever …)

5. Choose archive items older than (this is quite self-explanatory)

6. Select the location of your archive file (make sure you palce the .PST file into directory you will not forget later)

That's all now you have old mails freed up from Outlook Exchange server. Now make sure you create regular backups ot old-archived-mail.pst file you just created, it is a very good idea to upload this folder to encrypted file system on USB stick or use something like TrueCrypt to encrypt the file and store it to external hard drive, if you already don't have a complete backup corporate solution backuping up all your Laptop content.

Later Attaching or detaching exported .PST file in Outlook is done from:

File -> Open -> Open Outlook Data File

outlook-open-backupped-pst-datafile-archive-importing-to-outlook-2010


Once .PST file is opened and attached in Left Inbox pane you will have the Archived old mail folder appear.

 

outlook-archived-mail-pannel-screenshot-windows-7
You can change Archived name (like I did to some meaningful name) like I've change it to Archives-2013 by right clicking on it (Data File properties -> Advanced)

luckyBackup Linux GUI back-up and synchronization tool

Wednesday, May 14th, 2014

luckybackup_best-linux-graphical-tool-for-backup_linux_gui-defacto-standard-tool
If you're a using GNU / Linux  for Desktop and you're already tired of creating backups by your own hacks using terminal and you want to make your life a little bit more easier and easily automate your important files back up through GUI program take a look at luckyBackup.

Luckibackup is a GUI frontend to the infamous rsync command line backup  tool. Luckibackup is available as a package in almost all modern Linux distributions its very easy to setup and can save you a lot of time especially if you have to manage a number of your Workplace Desktop Office Linux based computers.
Luckibackup is an absolute must have program for Linux Desktop start-up users. If you're migrating from Microsoft Windows realm and you're used to BackupPC, Luckibackup is probably the defacto Linux BackupPC substitute.

The sad news for Linux GNOME Desktop users is luckibackup is written in QT and it using it will load up a bit your notebook.
It is not installed by default so once a new Linux Desktop is installed you will have to install it manually on Debian and Ubuntu based Linux-es to install Luckibackup apt-get it.

debian:~# apt-get install --yes luckibackup
...

On Fedora and CentOS Linux install LuckiBackup via yum rpm package manager

[root@centos :~]# yum -y install luckibackup
.

Luckibackup is also ported for OpenSuSE Slackware, Gentoo, Mandriva and ArchLinux. In 2009 Luckibackup won the prize of Sourceforge Community Choice Awards for "best new project".

luckyBackup copies over only the changes you've made to the source directory and nothing more.
You will be surprised when your huge source is backed up in seconds (after the first backup).

Whatever changes you make to the source including adding, moving, deleting, modifying files / directories etc, will have the same effect to the destination.
Owner, group, time stamps, links and permissions of files are preserved (unless stated otherwise).

Luckibackup creates different multiple backup "snapshots".Each snapshot is an image of the source data that refers to a specific date-time.
Easy rollback to any of the snapshots is possible. Besides that luckibackup support Sync (just like rsync) od any directories keeping the files that were most recently modified on both of them.

Useful if you modify files on more than one PCs (using a flash-drive and don't want to bother remembering what did you use last. Luckibackup is capable of excluding certain files or directories from backupsExclude any file, folder or pattern from backup transfer.

After each operation a logfile is created in your home folder. You can have a look at it any time you want.

luckyBackup can run in command line if you wish not to use the gui, but you have to first create the profile that is going to be executed.
Type "luckybackup –help" at a terminal to see usage and supported options.
There is also TrayNotification – Visual feedback at the tray area informs you about what is going on.
 

 

 

find text strings recursively in Linux and UNIX – find grep in sub-directories command examples

Tuesday, May 13th, 2014

unix_Linux_recursive_file_search_string_grep
GNU Grep
is equipped with a special option "-r" to grep recursively. Looking for string in a file in a sub-directories tree with the -r option is a piece of cake. You just do:

grep -r 'string' /directory/

or if you want to search recursively non-case sensitive for text

grep -ri 'string' .
 

Another classic GNU grep use (I use almost daily) is whether you want to match all files containing (case insensitive) string  among all files:

grep -rli 'string' directory-name
 

Now if you want to grep whether a string is contained in a file or group of files in directory recursively on some other UNIX like HP-UX or Sun OS / Solaris where there is no GNU grep installed by default here is how to it:

find /directory -exec grep 'searched string' {} dev/null ;

Note that this approach to look for files containing string on UNIX is very slowThus on not too archaic UNIX systems for some better search performance it is better to use xargs;

find . | xargs grep searched-string


A small note to open here is by using xargs there might be weird results when run on filesystems with filenames starting with "-".

Thus comes the classical (ultimate) way to grep for files containing string with find + grep, e.g.

find / -exec grep grepped-string {} dev/null ;

Another way to search a string recursively in files is by using UNIX OS '*' (star) expression:

grep pattern * */* */*/* 2>/dev/null

Talking about recursive directory text search in UNIX, should mention  another good GNU GREP alternative ACK – check it on betterthangrep.com 🙂 . Ack is perfect for programmers who have to dig through large directory trees of code for certain variables, functions, objects etc.

 

Ditaa convert ASCII diagrams into bitmap graphic (pictures)

Monday, May 12th, 2014

ditta_convert-ascii-art-diagram-to-png-jpg-picture
As part of my passion for ASCII art, I've found another interesting tool useful to ASCII art maniacs like me, the tool is called ditta and is able to convert manually drawn ASCII art diagrams to graphics, below is tool description from my debian apt-cache as well as a screenshot:

 apt-cache show ditaa|grep -i ditaa -A 4

Package: ditaa
Priority: optional
Section: graphics
Installed-Size: 164
Maintainer: David Paleino <dapal@debian.org>

Filename: pool/main/d/ditaa/ditaa_0.9+ds1-2_all.deb
Size: 107270
MD5sum: 05ec52d9274b954b053f1835ca5d7a7f
SHA1: 792d91d05fff2a2a19c0ebce317351d138436c18
SHA256: c4319d32e7918aab782e2f38cdad745bc9023f9f09a999033d983095ee4f70d5

 DiTAA is a small command-line utility that can convert diagrams drawn using
 ASCII art ("drawings" that contain characters that resemble lines, like | /
 and -), into proper bitmap graphics.
 .
 DiTAA also uses special markup syntax to increase the possibilities of shapes
 and symbols that can be rendered.
Homepage: http://ditaa.org

 

To install ditaa on Debian and Ubuntu Linux:

debian:~# apt-get install --yes ditaa
...

Ditaa text diagram to Graphics converter is also available in Fedora Linux and in Source RPMs to be used on Redhat Based RPM distributions.
To install in most of RPM based Linuxes:

[root@fedora:~]# yum install -y ditaa

For most people probably Ditta will not be of any value except as a PoC and of a Hack value just like Ditaa's home page suggests. Nomatter that Ditta is cool but has just 2 drawback it doesn't understand non-latin characters i.e. Cyrillic and requires Java Virtual Machine .. but if you're a real geek you will do  the sacrifice to install a whole bunch of the heavy java for the sake of some oldschool fun 🙂 Being written in Java makes Ditta multi-platform, but you will need a Java VM version of at least 1.6 (it doesn't work with Java 1.5).

The format Ditta understands is close to HTML

<ditaa [optional parameters]>
 
... (some ditaa-code) ...
 
</ditaa>


There are also special tags understood by Ditta which are automatically turned into shaped graphical buttons and forms.
 

Possible tags

Not all shape selector tags are documented on the ditaa site. A quick source scan revealed:

tag Description
{c} decision(Choice)
{d} document
{io} input/output, parallelogram
{mo} manual operation
{o} ellipse, circle
{s} storage
{tr} trapezoid (looks like an inverted {mo} )

Here is an example Ditta code
 

<ditaa round noedgesep right>
+--------+   +-------+    +-------+
|        | --+ ditaa +--> |       |
|  Text  |   +-------+    |diagram|
|Document|   |!magic!|    |       |
|     {d}|   |  c478 |    |       |
+---+----+   +-------+    +-------+
:                         ^
|       Lots of work      :
+-------------------------+
</ditaa>

This Ditta code will generate following picture:

ditaa_convert-ascii-art-picture-to-graphic-png-jpg-bmp


To learn more on ditta please check Ditaa's Project homepage on Sourceforge
Many thanks to Cybercity's 30 Cool Open Source Software of 2013 for inspiring this post.

Saint George’s day in an Elder – Spiritual father Georgi (91 years old Priest) in Jeglarci’s Village Bulgaria

Friday, May 9th, 2014

https://www.pc-freak.net/images/otec-father-Georgi-Jeglarci-village-spiritual-elder-in-Bulgaria

This year on 6th of May – saint George's day Church feast and army celebration in Bulgaria I had the blessing to be in a small village with 868 citizens – Jiglarci (Jeglarci).
Jeglarci is situated about 40 km from Dobrich. Father Georgi from Jiglarci is a well known priest in Dobrich region. He is spiritual father of many priests, monks and nuns here in Bulgaria. This is the 3rd time I'm visiting Jiglarci one time I was on Great and Holy Friday – the day on which the Lord Jesus Christ was crucified and one time I was a few months ago with some brothers and sisters from Holy Trinity Church in Dobrich. This time I had the blessing to go fr. Georgi with my wife Svetlana with Russian family from moscow Mihail and Mariana, and Denica (a sister from Church in Dobrich).

Jiglarci-Cyrkva-Church-building-where-father-Georgi-from-Jiglarci-serves

The Church saint George in Jeglarci village

Each time I visit father Georgi I have the blessing to see and hear a living proof of God's existence. Father's Georgi from Jeglarci is famous all around Bulgaria for being one of the spiritual elders of Bulgaria. He is now 91 years old but even though his age  continues his service for God (serves Holy Liturgy every day during great Lent!), continue to preach and accept dozens of people almost daily looking for spiritual advice, spiritual help, confession, or questions on how to deal with life hardship situations.
Father Georgi is known in the world under the secular name Georgi Stoyanov Peev his life is full of miracles, interesting events and wondrous facts. In communism times of atheism and Orthodox Christian faith persecutions, father Georgi was one of the many priests who underwent tortures and persecutions for his faith in Christ. Because of his firm faith of zealous priest, the Lord endowed the fr. with great spiritual gifts. In short I will mention some facts about fr. Georgi From Jeglarci life as the father is an example of a living saint, very much like another Bulgarian Church Elder (Dijado) Dobri from Baylovo.

Father Georgi has been nurtured with Christian virtues since his childhood – his aunt (sister of his father) was a nun. By his own words, "Since a child, the joy of my life was in faith". Since his youth years his faith was strong and because of that God has helped him in numerous times. Fr. Georgi had 6 children 3 sons and 3 daughters. All of his sons choose the way of priesthood and are now priests in the Bulgarian Orthodox Church. His nephew fr. Stoyan is also a priest in Holy Trinity Orthodox Church in Dobrich. The father become priest while being 43 years old, by studying in seminary after feeing the call of God and need for firm believers and mass disbelieve in atheistic communist times. In seminary father Georgi studied together with his son. To be able to support himself and his family financially, he worked all kind of hard labour  (sand mining near his village). His all life was labor and prayer in all his free time during studing he learned the church services, readhing the living of saints and holy bible.

Thanks to the house whom he turned into a small chapel almost 20 people become priests later in Bulgarian Orthodox Church. In his priesthood fr. Georgi was among the minority which opposed the ungodly communistic regime, he rejected to comply with communist desires to close the Church in Jeglarci and as a responce to their closure opened as a Church his own house. He was questioned and asked for reports being increminated from local Communist authorities, threatened with death and called in police stations many times because of his refusal to stop his service in Church and preaching the Gospel.

Here is a story of fr. Georgi's youth:

"Our Lord as a Good Father, not only listens our prayers but also reads in the hearts. In 1953 my brother Atanas was a soldier. We received a letter, that soldiers will be dismissed in January next year, this was a very long time. It was st. Dimiter's feast and I wanted my brother to be home for Christmas. At night I prayed the Lord, simple and by all my heart: "Lord for you nothing is hard or impossible. I beg you – in one way or another make it possible, that my brother Atanas to come home earlier.

I had a strong faith in God. My faith in God was so strong that I was feeling like being able to fly. In 3 days later only, when I saw my brother Atanas on the front door, my legs started shaking and I sat down, started crying and in my thoughts started giving thanks to the Lord, "Lord, Lord I'm a big sinner and what you've done for me the sinner …
In a short while, my brother told me how in a human way everything ordered in a way that he was able to come home, 3 days after my prayer. When I received the letter on St. Dimiter's day I've prayed, the prayer was heard and God moved. The human mind is a spiritual substance connected with God. God orders things and we in a human way receive them. On the next day after st. Dimiter's feast the coy was gathered and the commander said, "Atanas Stoyanov Peichev, make 5 steps forward and start Marching!". Together with another man commander sent them in hospital, where a doctor had to inspect their health. The two soldiers took their luggate, foreseeing that they might be kept in hospital. The health check prooved they're healthy. There were 4 months until service completion but in hospital the doctor told them – "Come on go home. Your service is over". – Do you see how in a human way the things ordered. Disbelievers would say it was a coincidence but believers knows the Lord hears our prayers, when they're prayed by our whole being and with pure heart."

fr-Georgi-Jeglarci-elder-of-Dobrich-Bulgaria-3

Saint George Church in Jeglarci – Altar and Dveri

Another of his stories is connected with fasting:

"The fasting of the body is a big power. It does clean up the body and draws us near God. The fasting gives a big power. I was hindered in many ways, disbelieving authorities in the village has done me many attempts to do me evil but the Lord has saved me. Didn't allowed them nothing bad to happen to me. He grant me powers, spirit to speak the truth and to not resign from righteousness. But I leave fasting …

Fasting and Prayer are lights leading to God. I was warned 3 times by our Lord about fasting significance. When we were living in North Dobrudja, following thing happened to me: " I was 15 years old. Near our village Karamankyoij a river rich of fish was flowing. One day my bigger brother cought a lot of fish from the white one. My father and all of us was tempted, we wanted eating and it was during the Great Lent. My father said, "Okay prepare the fish and let us eat, God will forgive us?" Notice he said that in faith! apostol Paul writes, 'who eat eats for the Lord and who doesn't eat- also doesn't eat for the Lord'". We have done so as well, we were big family 7-8 children,  grandma, grandpa, my father, mother. Some eat others doesn't. I was in the group of those who ate. We ate and we went to bed. A sudden pain in stomach came … hard to explain. Nothing helps, a thought came to my mind: "Lord forgive me, I will no longer eat fish during fasting". The pain immediately disappeared I immediately got well.

But unfortunately I was weak. On the other day my brother prepared fish again and invited me.

– Genyo, come lets eat.
– I suffered yesterday – I don't want.
– Don't worry your pains was from something else not from the fish, come eat I beg you.

I was tempted and ate. We played until night time and all was well with me. In night, I fall asleep, but suddenly the pain come again, 3 times more painful. I thought I am dying, I was all sweating. My mother and grandma tried to heal me but nothing helped. Then I turned with a prayer to the Lord: "Please Lord forgive me this time also." And out of a sudden I hear a noise like from many waters coming like from heaven. Something went through me and took away the pain. There was a flash in front of my eyes. Do you see how merciful is the Lord!"

Among the many spiritual gifts of fr. Georgi is the gift of "foreseeing" (thoughts and deeds, and future). Many people who visited him later narrated the father told them things which helped them improve their spiritual life. During my first visit of the father I had the possibility to raise few questions on my spiritual life, his answers was a proove for myself that the fr. has truly the gift of sagacity.
Father Georgi had many dreams during his life and many of his dreams were prophetic about future events to come. By his own words often God spoke to him in "dreams and visions". A very notable gift he has is the gift of humility and pure Godly love. He speaks in his stories about everyone including of many who tried to do him evil with profound love and forgiveness.

fr-Georgi-Jeglarci-elder-of-Dobrich-Bulgaria-2

By prayers of father Georgi many miracles has happened, he openly speaks of this miracles, believing that through this the weak in faith are strengthened. The father says "Even if the whole earth is convincing me to deny what I saw and experienced with my spiritual eyes I will not forsake.

His humility is sincere, he says about himself: "I am just negligible mot and the miracle is not in human deed but in God's. God uses a lot simple people and through them creates miracle to edify "the smart", those which is of God is being remembered like it happened today.  Wondrous are God's deeds!"

fr-Georgi-Jeglarci-elder-of-Dobrich-Bulgaria-1
 

"The Spiritual deed is very hard. I have worked many kind of works, when you get tired you take a rest, and for the spirit there is no rest.
What to say, how to behave, how to determine the spiritual in you, to be vigilant for your food and for body pureness for pureness of your thoughts and your heart … And of course the Prayer! This is a hard labour. The devil is trying to hit us exactly there, because in all those is the direct relationship with God. Your thought is careless, you remember "important" things, you get tired to be concentrated … And it is most harder to collect your mind and feelings and enter the heart with pure infinite faith that the Lord is with you and he hears you and then pray from all your heart and soul … So is this all easy?! And there is no end and there is no station. But once you live like this there is delight and you can't live no longer in another way …"