13 Nov 2014

i believe you are the one i'm searching for

i believe you are the one i'm searching for
Assalamu"alaikum,
I am miss zainab  from iran, i was happy to got your email through (quora.com)please reply to my email address....so we can communicate easily to know each other the more, i promise to also send you my photo for you to know me. Remember that distance, religion or tribe does not matter in life but true affection is everything we need to live our life and be happy.
Yours new found friend,
Miss
zainab

03 Nov 2014

Hello Dear,

Hello Dear,
I came across your profile at www.quora.com i will be delighted to have good relationship with you and to know much better.my name is Isabella, i am single and never married. I will wait for your reply. you can contact me at this my email address( isabellayounis@hotmail.com ) and i will send you my picture and more about myself. waiting to hear from you Please don't forget to contact me direct to my Email address ( isabellayounis@hotmail.com ) Waiting to read your message at my email box.

30 Jan 2013

The web is stateless, why you need to refresh the page.

As I deal with people who use computers every day, who don't necessarily understand what is happening. I have decided to try and explain it once in nice simple language so that it is easy to
understand why certain web sites / applications / pages seem to have issues showing the most up-to-date information.

The web is stateless. It has no way of remembering what is happening or what has happened. This is the way it was built from the very lowest levels. It is designed to survive a nuclear war.

What you see on your computer is just a picture or view of the web application or web page at a particular point in time. The time you requested the page you are currently viewing. Your web browser has no way of know if any thing has changed on the server or web page. Unless you ask the server by requesting the page again. You need to refresh the page to see any changes that have been made since you last asked the server.

To make things even more complicated your web browser tries to speed up the time it takes to load pages by caching web pages. If you just viewed a web page your web browsers stores it on your device or computer. If you ask for that page again, instead of fetching the page from our server it will show you the page it stored on your device.

Web developers have developed a number of technologies to work around caching, by telling web browser which pages it can cache and what in a web page it can cache. Though some times this does not always work as expected and thing can be come out of sync. The pages you see are a mix of the old data stored on your device and the new content on the servers.

To make things even more complicated it all comes down to how computers understand time. The time on the server is different from the time on a server sitting in the middle of Russia. Which is also
different from the time on your computer. Even for computer in the same country the time they show can differ by hours if they are not set correctly. So how your web browser caches data, and for how long can be quite different then what our server or web page asked it to.

The point is that the only time that matters when you are working with a web server or web application is the time on the server not on your computer. Bidorbuy provides a way to see this using the follow page, http://www.bidorbuy.co.za/jsp/header/BidorbuyTime.jsp. This page can be found on our site at the very bottom of every page, in the footer under the bidorbuy heading.

http://www.webopedia.com/TERM/S/stateless.html
http://en.wikipedia.org/wiki/Stateless_protocol

http://www.mouseworks.net/refreshbrowser.htm
http://www.refreshyourcache.com/en/cache/
--

https://plus.google.com/u/0/117484568487416046905/posts

05 Sep 2012

Working with log files in the /var/log/ directory Part 3 ssh

Continuing from part 1

Part 3 will deal with using these commands in scripts and over ssh to get some information on remote servers. 

As most of what I wanted to say is covered in an other blog I am provding a link to that blog with some of the important parts cut out.

 http://backreference.org/2011/08/10/running-local-script-remotely-with-arguments/ 

Well, ssh runs a shell on the remote host, so why not do
 $ ssh user@remote < local.sh  

And if your script has arguments
$ ssh user@remote 'cat | bash /dev/stdin arg1 arg2 arg3' < local.sh 
Argument is __arg1__  
Argument is __arg2__  
Argument is __arg3__

Now what would you put inside a script. In my case I have a script that I use to do some basic checks. I will cut out our work specific stuff but you should get a really good idea about what you can do and how to do it. This script is a work in progress please fell free to make changes. 

How I run the script. Use the multiple arguments method

ssh root@192.168.0.51 'cat | bash /dev/stdin -a < ./check.sh


What my script does



 /tmp/check.sh -h
Usage: check.sh [-hvapdbs] [-o arg] args
Options avalible in the script -h Help
  -v version
  -s disable sleep time beween checks

Chose which checks you want to perfom 
  -a (all) checks 
  -p not implemented
  -d defualt linux health checks 
  -w webserver checks
  -l list all the check functions

How to use

ssh root@192.168.0.51 'cat | bash /dev/stdin -a -s' < `basename $0` | tee /somedir/checks_output

The script 



#!/bin/bash

# simple example of how to use this script

# simple script that will run some of the basic checks that need
# to be done on the bob servers. 

# simple boolean to enable or disapable sleep/pauses in script out put 
# set waits=$NULL or waits=  to ensure the test evalues false. 
# how to test
# waits=
# [ $waits ] && echo true
# waits=$NULL
# [ $waits ] && echo true
#
# setting $waits to anything other then null evaluates true
# waits=1
# [ $waits ] && echo true
# true
waits=TRUE
pause=2

#Nicely formated title on checks
title() 
{
    Sstart="\n\e[04;31m="
    Send="=\e[00m\n"
    Sfill="================================================================="
    Stitl="$1"
    Sbuild="$Sstart $HOSTNAME -- $Stitl"
    fill=${#Sbuild}
    #echo $fill
    #echo ${Sfill:fill}
    #echo -e "\e[04;31m= $HOSTNAME ==== $1 =============\e[00m\n"

    Sbuild="$Sstart $HOSTNAME -- $Stitl ${Sfill:fill}$Send"
    echo -e "$Sbuild"
}

# check disk usage on server
disk_check()
{
    title "Checking Disk Space"
    #echo -e "\e[04;31m=$HOSTNAME=====Checking Disk Space===================\e[00m"
    df -h
    [ $waits ] && sleep 3

    # check inodes
    title "Checking Available inodes"
    #echo -e "\e[04;31m=$HOSTNAME=======Checking Available inodes===========\e[00m"
    df -i
    [ $waits ] && sleep 3
}

dmesg_check() 
{
    #dmesg
    title "Checking DMESG"
    #echo -e "\e[04;31m=$HOSTNAME======Checking DMESG========================\e[00m"
    [ $waits ] && sleep 2
    echo "dmesg tail -n 60"
    dmesg | tail -n 60
    [ $waits ] && sleep 8
    echo "summary of dmesg"
    dmesg | sed -e "s/\[[^][]*\]//" -e "s/[0-9]\+//g" | sort | uniq -dc | sort -n
    [ $waits ] && sleep 8
}

mesg_check() 
{
title "Messages Log"
    #cut -d" " -f 4- /var/log/messages | sort | uniq -dc
    #cut -d" " -f 5- /var/log/messages |\
    # sort |\
    # sed -e "s/pid=[0-9]* //"\
    # -e "s/EXIT\: rsync status\=0.*/EXIT: rsync status=0/"\
    # -e "s/last message repeated.*/last message repeated/" |\
    # uniq -c |\
    # sort -n

    sed -e "s/\(.*\)\($HOSTNAME\)/\2/" -e "s/\[[^][]*\]//" -e "s/[0-9]\+//g" /var/log/messages | sort |  uniq -c | sort -n
    [ $waits ] && sleep 5
}

DT_check()
{
    # date
    title "Checking Date & Time"
    [ $waits ] && sleep 3
    date
    [ $waits ] && sleep 3
}

network_check()
{
    # check interfaces for droped packets and errors
    title "Checking Network Interfaces"
    [ $waits ] && sleep 3
    ifconfig
    [ $waits ] && sleep 5
    # check firewall
    echo "Showing ip tables"
    iptables -L
    [ $waits ] && sleep 5
}

crontab_check()
{
    # check the jobs schedule 
    title "Checking Crontab Entries"
    #echo -e "\e[04;31m=$HOSTNAME======Checking Crontab Entries==============\e[00m"
    [ $waits ] && sleep 3
    #find /var/spool/cron/* -printf  \\n%p\\n%t\\n -exec cat {} \;
    find /var/spool/cron/* -printf "\\n\\n%p\\nLast Modified : %t\\nLast Accessed : %a\\n\\n" -exec cat {} \;
    [ $waits ] && sleep 3
    #[ $waits ] && sleep 3
    #[ $waits ] && sleep 3
}

keys_check()
{
# check ssh configuration to make sure it has not changed
    title "Checking Known Hosts"
    [ $waits ] && sleep 2
    cat /root/.ssh/known_hosts 
    echo -e "\n"
    echo -e "\nList of authorized IPs"
    cut -d" " -f1 /root/.ssh/known_hosts | sort -n
    [ $waits ] && sleep 5
    title "Checking Authorized Keys"
    [ $waits ] && sleep 2
    cat /etc/ssh/authorized_keys 
    echo -e "\nList of authorized IDs\n"
    grep -v "#" /etc/ssh/authorized_keys | cut -d" " -f3
    [ $waits ] && sleep 5
}

mail_check()
{
# chech maillog for status not sent should not return any output
    title "Checking Mail Logs"
    [ $waits ] && sleep 3
    echo -e "\nChecking mail logs\n"
    grep -P "(stat|status)=(?"\!"[Ss]ent)" /var/log/maillog
    grep -P "(stat|status)=(?"\!"[Ss]ent)" /var/log/maillog | wc
    #grep -P "stat=(?"\!"Sent)" /var/log/maillog
    #grep -P "stat=(?"\!"Sent)" /var/log/maillog | wc 
    #grep -P "status=(?"\!"sent)" /var/log/maillog
    #grep -P "status=(?"\!"sent)" /var/log/maillog | wc
    [ $waits ] && sleep 3
}


apache_check()
{
    # Apache Error Logs
    title "Checking Apache"
    if  [ -e /var/log/httpd/error.log ]
    then
        [ $waits ] && sleep 2
        #sed -e "s/\[[^][]*\]//g" -e "s/[0-9]\+//g" /var/log/httpd/error.log | sort | uniq -c | sort -n
        title "Sumary of httpd error"
        #echo -e "\n Sumary of httpd error messages"
        sed -e "s/\[[^][]*\]//g" -e "s/ referer:.*//" -e "s/[0-9]\+//g" /var/log/httpd/error.log | sort | uniq -dc | sort -n
    #sed -e "s/\[.*\]\([^:]*\)\(.*\)/\1/" /var/log/httpd/error.log | sort | uniq -dc | sort -nr
    #sed -e "s/\[.*\]\([^:]*\)\(.*\)/\1/" /var/log/httpd/error.log | sort | uniq -u | sort -nr
        #grep "phpmyadmin" /var/log/httpd/error.log
        [ $waits ] && sleep 5
    else 
        echo -e "no apache error logs at /var/log/httpd/error.log\n"
    fi
}



all_checks()
{
disk_check
dmesg_check 
mesg_check 
DT_check
network_check
crontab_check
keys_check
mail_check
apache_check

}

default_checks() 
{
disk_check
dmesg_check
mesg_check
DT_check
network_check
crontab_check
keys_check
mail_check

}


checks()
{
#g/()/

checklist=$(cat <
title() \n
disk_check()\n
dmesg_check() \n
mesg_check() \n
DT_check()\n
network_check()\n
crontab_check()\n
keys_check()\n
mail_check()\n
apache_check()\n
checks()\n

EOF
)
echo -e $checklist

}


USAGE="Usage: `basename $0` [-hvapdbs] [-o arg] args"
USAGED=$(cat <
Options avalible in the script
\t-h  Help\n 
\t-v  version\n
\t-s  disable sleep time beween checks\n

\nChose which checks you want to perfom \n
\t-a  (all) checks \n
\t-p  not implemented\n
\t-d  defualt linux health checks\n
\t-w  webserver checks\n
\t-l  list all the check functions\n

\nHow to use\n
ssh root@192.168.0.51 'cat | bash /dev/stdin -a < ./check.sh | tee /somedir/server_report\n
EOF
)


# Parse command line options.
while getopts hvsabdwtlo: OPT; do
    case "$OPT" in
    h)
        echo $USAGE
        echo -e $USAGED
        exit 0
        ;;
    v)
        echo "`basename $0` version 0.4"
        exit 0
        ;;
    s)
        waits=
        ;;
    o)
        OUTPUT_FILE=$OPTARG
        ;;
    a)
        echo "doing all checks"
        all_checks
        exit 0
        ;;

    b)
        echo "doing bob checks"
        bob_checks
        exit 0
        ;;

    p)
        echo "doing all checks"
        all_checks
        exit 0
        ;;
    d)
        echo "doing default checks"

        default_checks
        exit 0
        ;;
    w)
        echo "doing apache checks"
        apache_check

        exit 0
        ;;
    l)
        echo "showing all checks"
        checks
        exit 0
        ;;

   \?)
        # getopts issues an error message
        echo $USAGE >&2
        exit 1
        ;;
    esac
done

# Remove the switches we parsed above.
shift `expr $OPTIND - 1`

# We want at least one non-option argument.
# Remove this block if you don't need it.
if [ $# -eq 0 ]; then
    echo $USAGE >&2
    exit 1
fi

# Access additional arguments as usual through
# variables $@, $*, $1, $2, etc. or using this loop:
for PARAM; do
    echo $PARAM
done

# EOF






20 Jul 2012

Delete old emails in gmail from a specific date.

I can perform a search with the following criteria in gmail.
before:2011/11/20 AND in:anywhere

How can I go to the next step and delete all those mails.
Google search for delete old mail from gmail don't return any thing useful.

Idealy I would like to create a filter with some search useing just the "before:" operator.
before:2011/11/20
I keep getting a Please "fill in some search criteria" message box.
To fix this you don't use the filters
Gmail creates a link for you to delete all the old mail, it is not very obvious. It appears just above the first message in the list of messages.

"All 20 conversations on this page are selected. Select all conversations that match this search"


If you are running short of space you could always buy some more from google
https://www.google.com/settings/storage/

05 Jul 2012

gmail filters to search for mail from bidorby

This is essentially what I am trying to do in the Google mail.
http://mashable.com/2012/06/22/gmail-filters/

http://support.google.com/mail/bin/answer.py?hl=en&answer=6579#0

So the images show step for step how to search for emails from bidorbuy.co.za and then create a filter form that search to mark those emails as important.

If you click each image you can load a bigger high resolution version of it. That should make thing easier to see.

First I click the gmail search drop down to show the advanced search.

The advanced search will show up like this

Next I type in the advanced search that I want to perform. 
In the From Filter I type in @bidorbuy.co.za. Then I click the search button at the bottom of the page.
that should perform the search and bring up all the mails that google has been automatically sending to the archive. You may need to change the date range that the search is performed over to include a period of more then 1 day. 

To create the filter I click the drop down again, it remembers my previous search so the from filter is pre-populated

At the bottom of the advanced search dialogue, there is an option to "create filter with this search". Clicking on that takes us to the filter dialogue. 

Now I can tell gmail to always make mail from bidorbuy as important and apply that filter to previous mails.