Friday, October 12, 2012

How to Clean Old Mails from Gmail to increase Mail Storage

Please take care for Important mails

If you don't want to delete mails from a particular label just add -label:important (-label:labelname) in all searches

Tip #1: Delete Automated Updates

In Search Field type
from:noreply* OR from:do-not-reply* OR from:donotreply* OR from:notification*
This way you’ll filter out all the automated updates that come from various sources (such as social media friend requests, calendar reminders, weberp tickets).

Tip #2: Delete All Blog Comment Notifications

Search: [from:wordpress* OR from:disqus]
If you are a blogger who hasn’t disabled comments, you’re probably getting email notifications each time a comment is pending approval or waiting for your reply.

Tip #3: Clean Up Email Subscriptions

Search [from:news* OR from:digest* OR from:auto* OR from:reports* OR from:*mailer*]

TIP # 4 Delete Mails from a particular Period/Year

In the Search field, type before:2010/12/20. That's just an example date.You can use any date you want, Select All & Delete. Date format YYYY/MM/DD.

TIP # 5 Find Attachments & Delete them

has:attachment
has:attachment  (Search for file extension *.jpg *.rar *.zip *.doc *.xls & many more)

You can use multiple options in one search

"has:attachment from:me label:sent before:2011/1/1" - it will show all messages with attachment in the Sent Mail folder before Jan 2011.

Thursday, September 20, 2012

Saving a root owned file as normal user

This happens lot of times. I login as a normal user and start to edit root owned file in vim / vi text editor. However, I'm not able to save changes due to permission issue (all config files are owned by root). So to save file, i can do :w !sudo tee % 
Where,
:w - Write a file.
!sudo - Call shell sudo command.
tee - The output of write (vim :w) command redirected using tee. The % is nothing but current file name i.e. /etc/apache2/conf.d/mediawiki.conf. In other words tee command is run as root and it takes standard input and write it to a file represented by %. However, this will prompt to reload file again (hit L to load changes in vim itself):

Top Reasons of SPAM Mails

Why Is My Emails Getting As Spam? Qusetion asked by everyone if your mails are marked spam to your friends mailbox
 
Don't worry just follow the below steps.

First we need to check Email Headers.
1. Return Path
2. To
3. From
4. We should not use CAPS because not only being unprofessional, but it
also triggers spam filters. To land in the Spam folder consistently,
please do not USE ALL CAPS IN THE SUBJECT LINE AND THE BODY FROM TO and
Excessive punctuation (e.g. -/, ;^%#$@+ * "').

E.g. as follows.

1. Email "From : ADMIN ENROLL " getting
spam in gmail.com sometimes and if we not change it will increasing
count.

2. Email "From: noreply@exmaple.com" it
getting in mailbox, check the CAPS deference.

http://php.net/manual/en/function.mail.php
http://www.niso.org/khelp/kmlm/user_help/html/examine_mail_headers.html

Please check this too. It can be understand better. :)
http://www.infusionblog.com/email-marketing/7-ways-for-your-email-to-land-in-the-spam-folder/

Check SPF for Domain.:
http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/

What is SPF records and How to setup?
http://www.kazeli.com/help/index.cfm?pageloc=quest&questid=435&catid=337,338

To diagnose the mail. Why its going in Spam.
Check tool:
http://mxtoolbox.com/
Here you can check following points
1. Mxlookup : For your domain and ip
2. Blacklist : For your IP
3. Diagnostics : SMTP Diagnostics, check your mail server
4. Analyze Headers : Check your mail headers.
5. SPF Records : Check your Sender Policy Framework
7. DNS Lookup : Check your Domain lookup.

If you check above all things your mail will not go in Spam.!

Friday, June 8, 2012

Transparent SQUID 2.6 Configuration on Centos

SQUID 2.6 (Transparent PROXY SERVER)

Main benefit of setting transparent proxy is you do not have to setup up individual browsers to work with proxies.

Server: bhagwat-desktop (192.168.1.5 Local Network IP)
Client: Linux & Windows XP//Vista/7
Default Port NO: 8080


Please change this Setting for automatic forwarding

vi /etc/sysctl.conf
net.ipv4.ip_forward=0    >>    net.ipv4.ip_forward=1

Installation Of Required Packages:

Install the squid package with yum

yum install squid

Configure SQUID config file:

NOTE: Modify squid.conf file (Before Modifying any Files take one backup copy)

vi /etc/squid/squid.conf


#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 9100
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl Safe_ports port 9100    #  Network Printer
acl CONNECT method CONNECT
acl freesites url_regex "/etc/squid/freesites"
http_access allow freesites
acl blockfiles urlpath_regex "/etc/squid/blocks.files.acl"
http_access deny blockfiles
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl our_networks src 192.168.1.0/24
http_access allow our_networks
http_access allow localhost
http_access deny all
icp_access allow all
http_port 192.168.1.5:8080 transparent
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
ftp_passive on
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern .        0    20%    4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
visible_hostname my_squid_bhagwat
coredump_dir /var/spool/squid

Now start Squid server & also add in start up
/etc/init.d/squid start

chkconfig squid on

Now run this command to redirect all traffic on squid

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

/etc/init.d/iptables save
/etc/init.d/iptables start

Check it with this command
iptables -t nat -L


You do not have to setup up individual browsers to work with proxies.


Problems and Solution with FTP

Add following line in /etc/rc.local

/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
/sbin/modprobe iptable_nat
/sbin/modprobe ip_nat_ftp

save with :wq

then run 

/etc/rc.local

& it's done

Starting httpd: (98) Address already in use: make_sock: could not bind to address 0.0.0.0:443

Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs!

Solution
netstat -ptnl | grep 443
tcp        0      0 :::443                      :::*                        LISTEN      953/sshd

Kill the process (kill -9 process_id)

check error log
tail -f /var/lof/httpd/error.log

Wednesday, May 23, 2012

Install phpMyAdmin on CentOS 5 - With Yum Installation

Install MySQL

yum install mysql-server mysql mysql-devel
chkconfig mysqld on
service mysqld start
 Set Password for MYSQL
mysql -u root -p
enter password

Install PHP & HTTPD

yum install php php-mysql
yum Install httpd

Download the rpmforge package from Centos website
after installing rpmforge run following command
yum install phpmyadmin

vi /etc/httpd/conf.d/phpmyadmin.conf
the format should be like below (allow from all)
<Directory "/usr/share/phpmyadmin">
  Order Deny,Allow
  Deny from all
  Allow from all
</Directory>


Go to phpmyadmin direcotry (in my case it /usr/share/phpmyadmin)
cp config.sample.inc.php config.inc.php
vi config.inc.php

Edit th config.inc.php file, find the line that contacin "blowfish_secret", and modify like below
$cfg['blowfish_secret'] = 'TypeAnything_for_secure';

(Type any secure password instead of TypeAnything_for_secure)

service httpd restart


Open browser & type http://ipaddress_of_machine/phpmyadmin
login with root
password of mysql (which you set earlier)

Tuesday, May 22, 2012

Install DBD::Oracle in Ubuntu

ERROR

root@bhagwat-desktop: perl Makefile.PL
Using DBI 1.620 (for perl 5.012004 on i686-linux-gnu-thread-multi-64int) installed in /usr/local/lib/perl/5.12.4/auto/DBI/

Configuring DBD::Oracle for perl 5.012004 on linux (i686-linux-gnu-thread-multi-64int)

Remember to actually *READ* the README file! Especially if you have any problems.

Trying to find an ORACLE_HOME
Your LD_LIBRARY_PATH env var is set to ''

      The ORACLE_HOME environment variable is not set and I couldn't guess it.
      It must be set to hold the path to an Oracle installation directory
      on this machine (or a machine with a compatible architecture).
      See the appropriate README file for your OS for more information.
      ABORTED!

Solution


Oracle Instant Client

Download the instant client packages you’ll need. I chose to download the RPMs and convert them to .deb files using alien Oracle also provides .zip files if you don’t want to do it the alien way.
convert rpm into deb package through aliean (apt-get install alien)
aliean oracle-instantclient11.2-basic-xx.x.x.x.x-x.i386.rpm
Above command convert rpm to deb package
install the deb package 
dpkg -i  xxxxx*.deb
 Then type this command at terminal
export ORACLE_HOME=/usr/lib/oracle/11.2/client/
echo $ORACLE_HOME 
create permanent entry with 
vi /etc/profile
ORACLE_HOME=/usr/lib/oracle/11.2/client/
export ORACLE_HOME

 

 Install DBD::Oracle with following command

cpan DBD::Oracle
or 
go to downloaded directory of DBD::Oracle package & run 
perl Makefile.PL
make
make install

Wednesday, May 9, 2012

Install OCI8 in Centos/RedHat

Install OCI8 in Centos

Download OCI8 package from here
http://pecl.php.net/package/oci8
tar -xzvf oci-<VERSION>.tgz
cd oci-<VERSION>
phpize

1) Configure the PECL package as a shared object using the instant client and specifying where the Oracle client libraries are. Then build and install it.

./configure –with-oci8=instantclient,/usr/lib/oracle/<VERSION>/client/lib
make
make install

2) Add the library shared object for PHP

echo extension=oci8.so > /etc/php.d/oci8.ini

3) Start Apache

‘service httpd start’ _or_ ‘/etc/init.d/httpd restart’

4) Create a PHP info page and checked to see if the Oracle (oci8) driver is listed:

echo <? phpinfo(); ?> > /var/www/html/phpinfo.php

Install PDO_OCI in Centos

First install oracle instant client
Download Oracle Instant Client (basic and devel) from here:
    http://www.oracle.com/technetwork/topics/linuxsoft-082809.html

Install
    rpm -ivh oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
    rpm -ivh oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm

Optional - Add the Oracle instant client to dynamic linker
    echo /usr/include/oracle/11.2/client/lib/ > /etc/ld.so.conf.d/oracle_client.conf
    ldconfig -v
    If not working then type below command (Both do the same thing)
    echo /usr/lib/oracle/11.2/client/lib/ > /etc/ld.so.conf.d/oracle_client.conf

Optional - Oracle Profile
    Create a new file in /etc/profile.d named oracle.sh and include the following:
        export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib/
        export     ORACLE_HOME=/usr/lib/oracle/11.2/client/lib/
      
Save the file with :wq Enter
    Run:
        source /etc/profile.d/oracle.sh

Download pdo_oci
Download pdo_oci from there:
        http://pecl.php.net/package/PDO_OCI/1.0

Untar the package and prepare it for compiling (using directory /opt/oracle/src/)
   tar -xzvf PDO_OCI-.tgz
   cd PDO_OCI-
   phpize
Example
   tar –xzvf PDO_OCI-1.0.tgz
   cd PDO_OCI-1.0
   phpize

Patch
If you work with Oracle Instant Client version 11.2, you need edit the config.m4 file and add the following after exploding the src look for similar sections:
Block 1:
   elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.11.2; then
   PDO_OCI_VERSION=11.2
Block 2
   11.2)
      PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
     ;;

Compiler
(IMP) Please run phpize command again in PDO_OCI folder else Patch won't work

   ./configure  --with-pdo-oci=instantclient,/usr,11.2
   make
   make install

If above command not working please run below command otherwise continue with next step
./configure  --with-pdo-oci=instantclient,/usr/lib/oracle/11.2/client/lib
make
make install

Include in files to php parsed
Create a new file in /etc/php.d named pdo_oci.ini and include the following

   extension=pdo_oci.so

Start apache
   service httpd start  or /etc/init.d/httpd restart

It's Done.........:)
Write to me bhagwat@outlook.in if you need more support on this

Must Read for Every Corporate Employee

It’s half past 8 in the office but the lights are still on… PCs still running, coffee machines still buzzing… And who’s at work? Most of them ??? Take a closer look…

All or most specimens are ?? Something male species of the human race…

Look closer… again all or most of them are bachelors…

And why are they sitting late? Working hard? No way!!! Any guesses??? Let’s ask one of them… Here’s what he says… ‘What’s there 2 do after going home…Here we get to surf, AC, phone, food, coffee that is why I am working late…Importantly no bossssssss!!!!!!!!!!!’

This is the scene in most research centers and software companies and other off-shore offices.

Bachelors ‘Passing-Time’ during late hours in the office just bcoz they say they’ve nothing else to do… Now what r the consequences…

‘Working’ (for the record only) late hours soon becomes part of the institute or company culture.

With bosses more than eager to provide support to those ‘working’ late in the form of taxi vouchers, food vouchers and of course good feedback, (oh, he’s a hard worker….. goes home only to change..!!). They aren’t helping things too…

To hell with bosses who don’t understand the difference between ‘sitting’ late and ‘working’ late!!!

Very soon, the boss start expecting all employees to put in extra working hours.

So, My dear Bachelors let me tell you, life changes when u get married and start having a family… office is no longer a priority, family is… and That’s when the problem starts… b’coz u start having commitments at home too.

For your boss, the earlier ‘hardworking’ guy suddenly seems to become a ‘early leaver’ even if u leave an hour after regular time… after doing the same amount of work.

People leaving on time after doing their tasks for the day are labelled as work-shirkers…

Girls who thankfully always (its changing nowadays… though) leave on time are labelled as ‘not up to it’. All the while, the bachelors pat their own backs and carry on ‘working’ not realizing that they r spoiling the work culture at their own place and never realize that they would have to regret at one point of time.

So what’s the moral of the story??
* Very clear, LEAVE ON TIME!!!
* Never put in extra time ‘ unless really needed ‘
* Don’t stay back unnecessarily and spoil your company work culture which will in turn cause inconvenience to you and your colleagues.

There are hundred other things to do in the evening..

Learn music…..

Learn a foreign language…

Try a sport… TT, cricket………..

Importantly,get a girl friend or boy friend, take him/her around town…

* And for heaven’s sake, net cafe rates have dropped to an all-time low (plus, no fire-walls) and try cooking for a change.

Take a tip from the Smirnoff ad: *’Life’s calling, where are you??’*

Please pass on this message to all those colleagues and please do it before leaving time, don’t stay back till midnight to forward this!!!

IT’S A TYPICAL INDIAN MENTALITY THAT WORKING FOR LONG HOURS MEANS VERY HARD WORKING & 100% COMMITMENT ETC.

PEOPLE WHO REGULARLY SIT LATE IN THE OFFICE DON’T KNOW TO MANAGE THEIR TIME. SIMPLE !