The Cobra and the Axe

A carpenter went home after shutting down his workshop, a black poisonous cobra entered his workshop.

The cobra was hungry and hoped to find its supper lurking somewhere within.

It slithered from one end to another and accidentally bumped into a double-edged metal axe and got very slightly injured.

In anger and seeking revenge, the snake bit the axe with full force.

What could a bite do to a metallic axe? Instead the cobra’s mouth started bleeding.

Out of fury and arrogance, the cobra tried its best to strangle and kill the object that was causing it pain by wrapping itself very tightly around the blades.

The next day when the carpenter opened the workshop, he found a seriously cut, dead cobra wrapped around the axe blades.

The cobra died not because of someone else’s fault but faced these consequences merely because of its own anger and wrath.

Sometimes when angry, we try to cause harm to others but as time passes by, we realise that we have caused more harm to ourselves.

For a happy life, it’s best we should learn to ignore and overlook some things, people, incidents, affairs and matters.

It is not necessary that we show a reaction to everything.

Step back and ask yourself if the matter is really worth responding or reacting to.

Lets treat people with kindness even if they hurt you.

People that show no inclination to change, are best handled with silence and prayer.

This story can help us take some good decisions.

How Poor We Are

One day a father of a very wealthy family took his son on a trip to the country with the firm purpose of showing his son how poor people live.

They spent a couple of days and nights on the farm of what would be considered a very poor family.

On their return from the trip, the father asked his son,

“How was the trip?”

“It was great, Dad”.

“Did you see how poor people live?” the father asked.

“Oh yes”, said the son.

“So, tell me, what did you learn from the trip?” asked the father.

The son answered:

“I saw that we have one dog and they had four.”

“We have a pool that reaches to the middle of the garden and they have a creek that has no end.”

“We have imported lanterns in our garden and they have the stars at night.”

“Our patio reaches to the front yard and they have the whole horizon.”

“We have a small piece of land to live on and they have fields that go beyond our sight.”

“We buy our food, but they grow theirs.”

“We have walls around our property to protect us, they have friends to protect them.”

The boy’s father was speechless.

Then his son added:

“Thanks, Dad for showing me how poor we are.”

Be Masters of Our Mouth

Once upon a time an old man and a young man were living nearby.

The old man spread rumors that his young neighbor was a thief.

As a result, the young man was arrested by the police and brought to magistrate.

Days later the young man was proven innocent.

After been released he sued the old man for wrongly accusing him.

In court the old man told the Judge:

He just made comments, didn’t harm anyone..

The judge, before passing sentence on the case, told the old man:

Write all the things you said about him on a piece of paper.

Cut them up and on the way home, throw the pieces of paper out.

Tomorrow, come back to hear the sentence.

The next day, the judge told the old man:

Before receiving the sentence, you will have to go out and gather all the pieces of paper that you threw out yesterday.

The old man said:

I can’t do that ! The wind spread them and I won’t know where to find them.

The judge then replied:

The same way, simple comments may destroy the honor of a man to such an extent that one is not able to fix it.

“If you can’t speak well of someone, rather don’t say anythıng.”

Let’s all be masters of our mouths, so that we won’t be slaves of our words.

Bread and butter

There was a farmer who sold a pound of butter to the baker.

One day the baker decided to weigh the butter to see if he was getting a pound and he found that he was not.

This angered him and he took the farmer to court.

The judge asked the farmer if he was using any measure.

The farmer replied, your Honor,

“I am primitive. I don’t have a proper measure, but I do have a scale.”

The judge asked, “Then how do you weigh the butter?”

The farmer replied:

“Your Honor, long before the baker started buying butter from me, I have been buying a pound loaf of bread from him.

Every day when the baker brings the bread, I put it on the scale and give him the same weight in butter. If anyone is to be blamed, it is the baker.”

What is the moral of the story?

We get back in life what we give to others. Whenever you take an action, ask yourself this question:

Am I giving fair value for the wages or money I hope to make?

Honesty and dishonesty become a habit. Some people practice dishonesty and can lie with a straight face.

Others lie so much that they don’t even know what the truth is anymore. But who are they deceiving? Themselves.

VIM: Vundle to vim-plug

After several years of using my old .vimrc with vundle, finally bit the bullet and converted to vim-plug. It was quite an easy transition, and in my case, vim is now quicker to load.


$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

I then wrote out the new .vimrc as follows


"
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" Declare the list of plugins.
" git plugins
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
Plug 'tpope/vim-obsession'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'

" statusbar
Plug 'vim-airline/vim-airline'

" syntax highlighting
Plug 'scrooloose/syntastic'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'dense-analysis/ale'

" colourstuff
Plug 'nightsense/night-and-day'
Plug 'altercation/vim-colors-solarized'
Plug 'tpope/vim-vividchalk'
Plug 'gkjgh/cobalt'
Plug 'vim-scripts/mayansmoke'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()

" Now ensure certain stuff on
filetype plugin indent on

" other settings
set encoding=utf-8
set mouse=a
set ff=unix
set spelllang=en_au
syntax enable
set termguicolors

"--------------------------------------------------------------
" Console ui and text display
" -------------------------------------------------------------
set vb t_vb =
set ruler
set noerrorbells
set scrolloff=5
set number                                                     "line numbering
set showmatch                                                  " show matches

"--------------------------------------------------------------
" TAB specific options
" -------------------------------------------------------------
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set smarttab
set shiftround
set nojoinspaces

"--------------------------------------------------------------
"  colourscheme settings depending on sunlight levels.
" -------------------------------------------------------------
let g:nd_themes = [
  \ ['sunrise+0/0',  'mayansmoke',       'light' ],
  \ ['sunset+0/0',  'cobalt',           'dark'  ],
  \ ]

let g:nd_latitude = '-30'
let g:nd_timeshift = '0'
let g:nd_airline = 1

set wildmenu
set wildmode=list:longest

set fileformats=unix,dos,mac

set incsearch
set ignorecase
set smartcase

if filereadable(".vim.custom")
	so .vim.custom
endif

" vim airline
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#branch#empty_message = ''
let g:airline#extensions#branch#syntastic#enabled = 1
let g:airline#extensions#tabline#enabled = 1

It was then just a matter of restarting vim and entering:


:PlugInstall

Updating is simple as well:


:PlugUpdate

To update vim-plug itself, just enter:


:PlugUpgrade

Install ClamAV in Debian Linux

Can your Linux installation catch a virus? Yes it can, even though they are rare. This is the case especially if you are sharing data (documents and other files) from Windows based computers. It is useful to install ClamAV to remove those viruses.

ClamAV is an open source antivirus engine for detecting trojans, viruses, malware and other malicious threats. Of course, it is available for the most common Linux distributions including Debian, Ubuntu, and CentOS.

In case you didn’t know, ClamAV is the standard for mail gateway scanning software. Of course, we are talking about the open source area. This tells you how powerful and reliable it is. All this, with a high performance, which assures you that you will not have an unnecessary expense of computer resource.

Install ClamAV

Installing ClamAV is really simple because it is available in the main repositories of most Linux distributions.

To install for Debian

sudo apt update && sudo apt upgrade -y
sudo apt install clamav clamav-daemon

The installation is done.

Using ClamAV

Like any antivirus, its effectiveness depends on how often you update your virus definition. So the first step is to update ClamAV.

freshclam

Next, scan your home directory

clamscan -r /home/you

The -r option ensures all directories are scanned, even the hidden ones.

Setup ClamAV to Constantly Monitor

The above process is very easy but it is not a good idea if it has to be done frequently. So, initialize the ClamAV daemon to constantly look for threats.

sudo /etc/init.d/clamav-daemon start
sudo /etc/init.d/clamav-freshclam start

Getting Help

Finally, you can consult the rest of ClamAV usage using its help. It is important to know other options of use and configuration.

clamav -help

Conclusion

It is important to know how to use ClamAV on Linux because security is an issue that should not be taken lightly. Its installation and use are quite simple but because it is open source it guarantees a correct and frequently updated database.

Please share this post with your friends.

An Engineer accidentally goes to Hell instead of Heaven


An Engineer dies and goes to hell. He’s hot and miserable, so he decides to take action. The A/C has been busted for a long time, so he fixes it. Things cool down quickly.

The moving walkway motor jammed, so he unjams it. People can get from place to place more easily.

The TV was grainy and unclear, so he fixes the connection to the Satellite dish and now they get hundreds of high def channels.

One day, God decides to look down on Hell to see how his grand design is working out and notices that everyone is happy and enjoying umbrella drinks. He asks the Devil what’s going on?

The Devil replies, “Things are great down here since you sent us that engineer.”

“What?? An engineer? I didn’t send you one of those, that must have been a mistake. Send him back up right this minute.”

The Devil responds, “No way! We are going to keep our engineer. We like this guy.”

God demands, “If you don’t send him to me immediately, I’ll sue!”

The Devil laughs. “Where are YOU going to get a lawyer?”

Password Generator in tk/tcl

The basis for this program was written in another lifetime to create basically pronouncable passwords for students.


#!/bin/sh
# pass_gen - create pronouncable passwords with 4-20 characters, 1-10 numbers
# and optional symbol
# author:Morpheus Being
# licence: GPL
# tested on
# puppy linux - initial development and testing
# xubutu
# windows xp
#
# changelog
# 1.5 - Added capital letters
# 1.4 - added template for different forms of password
# 1.3
# 1.2 - fixed random problem not choosing z u 9 etc
# 1.1 - mods to allow different lengths of vowels, letters, digits, symbols
# 1.0 - initial development
#
#\
exec wish "$0" "$@"

package require BWidget

set version "1.5"
set licence "G.P.L"
set author "Morpheus Being"
set dupdate "August 2018"

# data sets used for creating the password
set vowels { a e i o u A E I O U }
set letters { b c d f g h j k l m n p q r s t v w x y z B C D F G H J K L M N P Q R S T V W X Y Z }
set digits { 0 1 2 3 4 5 6 7 8 9 }
set symbols { ! @ # $ % ^ & * ( ) _ - + }

# -----------------------------------------------------------------------------
# appCreate - create window frame and all its contents, spinboxes, buttons,
# display elements
#
proc appCreate { } {
variable version

# menu description
set descmenu {
"&File" all file 0 {
{command "E&xit" {} "exit application" {} \
-command appExit }
}
"&Help" all help 0 {
{command "H&ow To Use" {} "how to use" {} \
-command appHelpHow }
{command "&About" {} "about the application" {} \
-command appHelpAbout }
}
}

# create the main menu
wm title . "Password Generator $version"
set wid [expr {25*[font measure mydefault 0]}]
set mainframe [MainFrame .mainframe -menu $descmenu -width $wid]

# create spinboxes for number of letters and numbers
set titf1 [TitleFrame $mainframe.titf1 -text "Number of Characters" ]
set subf1 [$titf1 getframe]
set spin1 [SpinBox $subf1.spin -range { 4 20 1 } -textvariable alpha ]

pack $spin1 -side right
pack $titf1 -fill x -pady 2 -padx 2

set titf2 [TitleFrame $mainframe.titf2 -text "Number of Numbers" ]
set subf2 [$titf2 getframe]
set spin2 [SpinBox $subf2.spin -range { 1 10 1 } -textvariable numeric ]

pack $spin2 -side right
pack $titf2 -fill x -pady 2 -padx 2

# create radio button (yes/no choice) for symbols
set titf3 [TitleFrame $mainframe.titf3 -text "Symbol"]
set subf3 [$titf3 getframe]
set rad1 [radiobutton $subf3.rad1 -text "Yes" \
-variable wantsymbol -value 1 -relief "flat"]
set rad2 [radiobutton $subf3.rad2 -text "No" \
-variable wantsymbol -value 0 -relief "flat"]

pack $rad1 $rad2 -side left
pack $titf3 -fill x -pady 2 -padx 2

# create radiobutton for format type
set titf4 [TitleFrame $mainframe.titf4 -text "Format - symbol is optional"]
set subf4 [$titf4 getframe]
set rad3 [radiobutton $subf4.rad3 -text "w(s)nw" \
-variable ftype -value 0 ]
set rad4 [radiobutton $subf4.rad4 -text "ww(s)n" \
-variable ftype -value 1 ]

pack $rad3 $rad4 -side left
pack $titf4 -fill x -pady 2 -padx 2

# create display box for generated passwords
set titf5 [TitleFrame $mainframe.titf5 -text "Password"]
set subf5 [$titf5 getframe]
set ent1 [Entry $subf5.entry -textvariable genpassword]

pack $ent1 -pady 4 -anchor w -side left
pack $titf5

# create button for generating new password
set but [Button $mainframe.but -text "New" \
-command "newPass" -helptext "create new password" ]

pack $but -side left -padx 4

wm protocol . WM_DELETE_WINDOW { appExit }
pack $mainframe -fill both -expand yes
update idletasks
}

#
# newPass - determine how many letters, vowels, digits, symbols and display the
# created password
#
proc newPass { } {
global genpassword alpha numeric wantsymbol ftype

set fpl [ expr $alpha / 2 ]

if { $alpha % 2 } {
set fpl [ expr int($alpha / 2) + 1]
}

set lpl [ expr $alpha - $fpl ]

# to change format of password edit following lines
set start [ aPart $fpl ]
set mid [ nPart $numeric ]
set end [aPart $lpl ]

# want symbol in password
if { $wantsymbol == 1 } {
set sym [ sPart ]
}

# which type of format to display
switch $ftype {
0 {
if { $wantsymbol == 1} {
set genpassword [ format "%s%s%s%s" $start $sym $mid $end ]
} else {
set genpassword [format "%s%s%s" $start $mid $end ]
}
}
1 {
if { $wantsymbol == 1} {
set genpassword [ format "%s%s%s%s" $start $end $sym $mid ]
} else {
set genpassword [format "%s%s%s" $start $end $mid ]
}
}
}
}

#
# aPart - return randomly selected letters and vowels from the lists
#
proc aPart { slen } {
global vowels letters

set vlen [ expr [ llength $vowels ] ]
set llen [ expr [ llength $letters ] ]

for { set i 0 } { $i < $slen } { incr i } { if { $i % 2 == 0 } { set randid [ expr int( rand() * $llen ) ] append ret [ lindex $letters $randid ] } else { set randid [ expr int( rand() * $vlen ) ] append ret [ lindex $vowels $randid ] } } return $ret } # # nPart - return randomly selected digit(s) from the digit list # proc nPart { slen } { global digits set dlen [ expr [ llength $digits] ] for { set i 0 } { $i < $slen } { incr i } { set randid [ expr int( rand() * $dlen ) ] append ret [ lindex $digits $randid ] } return $ret } # # sPart - return randonly selected symbol from the list # proc sPart { } { global symbols set sylen [ expr [ llength $symbols ] ] set randid [ expr int( rand() * $sylen ) ] append ret [ lindex $symbols $randid ] return $ret } # # appExit - selected from menu # proc appExit { } { set choice [ tk_messageBox -message "Are you sure you want to exit?"\ -icon question -type yesnocancel ] if {$choice == "yes" } { exit } } # appHelpHow proc appHelpHow { } { tk_messageBox -message "Select the number of\n\ - letters\n\ - numbers\n\Aug 2018 - optional symbol\n\ - format\n\ before pressing the \bNew\b button.\n" } # # appHelpAbout - display info about the program in new disposable window # proc appHelpAbout { } { global version licence author dupdate tk_messageBox -message "Written in tk/tcl.\n\ Author: $author. \n\ Date: $dupdate \n\ Updated: $update. \n\ Version: $version.\n\ Licence: $licence." } # # main procedure to manage window creation and destruction # proc main { } { wm withdraw . appCreate wm deiconify . } main #---------------------------- end of program ----------------------------------

My New .vimrc

Recently rebuilt my laptop with latest Debian Testing after HDD failure. While I was at it, I redid my .vimrc file to suit new activities better. Remember to have git installed along with vundle from github first, ignore errors, then once vim/gvim loaded run :PluginInstall.

set nocompatible " required
filetype off " required

" set the run time path and initialise vundle
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" let Vundle manage itself
Plugin 'VundleVim/Vundle.vim'

" Now do the extras
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-obsession'
Plugin 'tpope/vim-sleuth'

" Plugin 'vimoutliner'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'

" statusbar
Plugin 'vim-airline/vim-airline'
Plugin 'ervandew/supertab'
Plugin 'majutsushi/tagbar'
Plugin 'lervag/vimtex'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-surround'
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'

" Plugin 'LaTeX-Box-Team/LaTeX-Box'
" Colourscheme stuff
Plugin 'nightsense/night-and-day'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tpope/vim-vividchalk'
Plugin 'gkjgh/cobalt'

" all plugins must be installed before this line

call vundle#end() " required

" now able to turn filetype back on
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
"------------------------------------------------------------
" Other settings
"------------------------------------------------------------
set encoding=utf-8 " handle all characters
set mouse=a " mouse every where
set ff=unix " set file format to unix
set spelllang=en_au " set spellcheck language to english
syntax enable " syntax highlighting with current colour scheme
set termguicolors

"------------------------------------------------------------
" tree view
"------------------------------------------------------------
let g:netrw_liststyle=3

"------------------------------------------------------------
" Console UI and Text Display
"------------------------------------------------------------
set vb t_vb =
set ruler
set noerrorbells
set scrolloff=5
set number " line numbering
set smartindent autoindent " smart indent and autoindenting
set showmatch " show matches

"------------------------------------------------------------
" TAB specific options
"------------------------------------------------------------
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set smarttab
set shiftround
set nojoinspaces

"------------------------------------------------------------
" colourscheme settings
"------------------------------------------------------------

let g:nd_themes = [
\ ['07:00', 'solarized', 'light' ],
\ ['18:00', 'cobalt', 'dark' ],
\ ]

"if &t_Co >= 256 || has("gui_running")
" set lines=35 columns=100
" set background=light
" colorscheme solarized
"colorscheme calmar256-dark
"else
" set t_Co=256
" " set background=dark
" colorscheme solorized
"endif

set wildmenu
set wildmode=list:longest

set fileformats=unix,dos,mac
filetype plugin indent on "

"------------------------------------------------------------
" gui font settings
" -----------------------------------------------------------
if has('gui_running')
set guifont=Lucida_Console:h11
endif

"------------------------------------------------------------
" Search settings
"------------------------------------------------------------
set incsearch
set ignorecase
set smartcase

"------------------------------------------------------------
" check for custom .vim.custom in a folder
"------------------------------------------------------------
if filereadable(".vim.custom")
so .vim.custom
endif

"------------------------------------------------------------
" vim-airline
" -----------------------------------------------------
" enable/disable fugitive/lawrencium integration
let g:airline#extensions#branch#enabled = 1
" change the text for when no branch is detected
let g:airline#extensions#branch#empty_message = ''
" enable/disable syntastic integration
let g:airline#extensions#branch#syntastic#enabled = 1
let g:airline#extensions#tabline#enabled = 1

"-----------------------------------------------------------
" syntastic extensions
"------------------------------------------------------------
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1 " always show error list
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" to toggle between active/passive type checking
map e :Errors
map s :SyntasticToggleMode

nmap :TagbarToggle

"-----------------------------------------------------
" doxygen settings
"----------------------------------------------------
" nmap :Dox
" nmap :DocLic

"----------------------------------------------------
" statusline
"----------------------------------------------------
set statusline=%-5.3n\ %F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]%=\ [ASCII=\03.3b]\ [HEX=\02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2
set cmdheight=1

"---------------------------------------------------
" hdevtools
" --------------------------------------------------
au FileType haskell nnoremap :HdevtoolsType
au FileType haskell nnoremap :HdevtoolsClear

"-------------------------------------------------------------
" Word processing mode
"
function! WordProcessorMode()
setlocal formatoptions=1
setlocal noexpandtab
map j gj
map k gk
setlocal spell spelllang=en_gb
set thesaurus+=/home/robin/.vimrc/thesaurus/mythesaur.txt
set complete+=s
set formatprg=par
setlocal wrap
setlocal linebreak
endfunction
com! WP call WordProcessorMode()

" ---------------------------------------------------------------------------
" latex stuff
"----------------------------------------------------------------------------

"
" Nerdtree settings
"
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

map :NERDTreeToggle

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif