Tuesday, August 28, 2012

Monitor cURL traffic in fiddler

If you want to view your curl request-response in fiddler, you need to tell curl to use fiddler proxy.
You can do that by passing -x parameter.
e.g.
curl -x 127.0.0.1:8888 http://www.priyankgandhi.com

If your url is https, then you will need to pass -k parameter. This will disable curl's ssl verification.
curl -k -x 127.0.0.1:8888 https://www.google.com

Tuesday, August 21, 2012

PostgreSQL: login without entering password

If you want to connect to your postgre database without entering password every time, you can achieve that by creating PGPASS file in your home directory.
e.g. Create a file called .pgpass in your home directory. Add and entry in this format.

hostname:port:database:username:password

priyank@localhost:~$ vi .pgpass
192.168.1.101:5432:restaurant:priyank:passwordispassword

Here is a documentation from postgresql site.
http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html

Friday, August 10, 2012

MYSQL: Connect to mysql using command

How to connect to mysql using a command - from terminal

mysql -u <user> -p -h <host ip> -P <port> <dbname>

Example:

mysql -u root -p -h priyankgandhi.com -P 3306 testdb