Sunday, March 30, 2014

Print the attributes of an object in Python

This can be done easily using,

print object.__dict__

You can also write a function as below.

def dump_an_object(obj):
    for attr in dir(obj):

        print "obj.%s = %s" % (attr, getattr(obj, attr))

Monday, March 24, 2014

Getting rid of unicode pain in Python

Python programming has its quirks and one of them revolves around Unicode. This article provides a very useful explanation of the issues and ways to go around it.

http://nedbatchelder.com/text/unipain.html


Monday, March 3, 2014

REST API Guide

Here is a good guide to the REST API's.

http://rest.elkstein.org


Thursday, January 23, 2014

Uninstall McAfee Agent on a Mac



To uninstall McAfee Agent on a Mac,

1. Log on as an administrator or with root account permissions.
2. Open the Terminal window and type,

sudo /Library/McAfee/cma/uninstall.sh

Type the logged on administrator or root account password and press ENTER to uninstall the Agent.

NOTE: During the removal, you will see the following messages: stopping McAfee agent and McAfee agent stopped.

Restart your computer when the uninstall is complete.

Uninstall McAfee Endpoint Protection for Mac 2.1.0

1. Open a Terminal window. Type the following command, then press return.

sudo /usr/local/McAfee/uninstall EPM

The uninstallation command is case sensitive.

Type the administrator password when prompted. When self-protection feature is enabled in EndPoint Protection for Mac 2.1.0 uninstalling the software using the command line prompts you to type the password provided by the ePolicy Orchestrator administrator.

When the software is uninstalled, the following message appears:

McAfee Endpoint Protection for Mac 2.1.0 has been uninstalled successfully.

When you uninstall the software, the McAfee Agent is not uninstalled from the system. This is
because that it might be used by other products. Refer to the product guide of your McAfee Agent
version for more information.

Wednesday, December 11, 2013

Installing ntfs-3g on Mavericks

http://crosstown.coolestguidesontheplanet.com/os-x/56-how-to-write-to-a-ntfs-drive-from-os-x-mavericks

Friday, November 15, 2013

Interface builder for bootstrap CSS

Here it is... A tool to build bootstrap websites quickly.

http://www.layoutit.com/

Bootstrap CSS

Bootstrap provides a Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.

Check it out at http://getbootstrap.com/

Sunday, November 10, 2013

Good explanation of python decorators

By Simeon Franklin

http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/

Thursday, November 7, 2013

Installing python-ldap in Ubuntu

$ sudo apt-get install python-dev libldap2-dev libsasl2-dev libssl-dev 
$ pip install python-ldap

Wednesday, November 6, 2013

Where are books stored in iBooks in Mavericks

At the following path.

~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books

Checking the PYTHONPATH interactively

You can see the value of your Python path using the Python interactive interpreter and tying this:

>>> import sys 
>>> print sys.path

Thursday, October 3, 2013

Computer powers on itself after shutdown.

I used to run into a problem in which my newly built computer would power on itself after being shutdown. Most of the online posts talked about Windows Scheduled Tasks. However, these come into play only when the computer is in 'Sleep' mode not in shutdown.

Finally, I found the solution. The problem was a default setting on Asus motherboard (Z87 Pro) which kept the Wireless adaptor powered on even though the computer was shutdown. This would cause the box to boot up anywhere between 2 and 20 mins after shutdown.

The solution was to enable "ErP Ready" under the APM Configuration in the BIOS. When the machine shuts down with the Wifi adapter enabled, the Wifi LED will go off (instead of staying on like before). The ErP mode setting will disable the Wifi wakeup at the BIOS level. The setting description says, "This item allows user to switch off some power at S5 to get the system ready for ErP requirement."

S5 state is the shutdown/OFF state. So it makes sense when it says it switches off power at the S5 state; it switches off power to the Wifi module, essentially disabling it and not allowing it to turn the machine on.

Tuesday, September 17, 2013

Formatting JSON files

Oftentimes you have JSON files which need to be formatted and checked for validity. You can use the following ways of going about it.

1. Using Python
cat file.json | python -mjson.tool > newfile.json

2. Uing jsonlint
Install jsonlint using 'sudo apt-get install  python-demjson'

Then use the command 

jsonlint -fv file.json > newfile.json 

Tuesday, April 16, 2013

Best uninstaller for mac

Uninstalling mac apps is easy. Just drag them to the Thrash. But you are often left with files in the ~/Library folder created by the app. To completely get rid of these files, its always a good idea to use an  uninstaller.

The best uninstaller for Mac is free and is called AppCleaner. Download it from http://www.freemacsoft.net/appcleaner/

Sunday, March 31, 2013

Repairing a time chaine volume

http://www.garth.org/archives/2011,08,27,169,fix-time-machine-sparsebundle-nas-based-backup-errors.html

Tuesday, January 29, 2013

How to manually uninstall the Altiris Agent for Mac

See details at http://www.symantec.com/business/support/index?page=content&id=HOWTO59038

Tuesday, September 11, 2012

Installing a SSL on a synology DS

I assume you are running OSX or Linux and have openssl installed.

Follow the steps below to create and install the SSL

1. Open a terminal and type the following commands. The first command will ask for a paraphrase. The same paraphrase will be required by the other commands.

  • openssl genrsa -des3 -out my.key 2048
  • openssl rsa -in my.key -out final.key
  • openssl req -nodes -new -key my.key -out request.csr
  • openssl x509 -req -in request.csr -signkey my.key -out certificate.crt -days 3650

2. The above commands will create the key and the certificate. They will be stored in my.key and certificate.crt respectively.

3. Login to the DSM GUI, go to the control panel, DSM Settings, HTTP Service and click the button marked Import Certificate.

4. For the private key select my.key and for the certificate select certificate.crt. Reboot the NAS.

Syno Community

Good source of synology packages

http://www.synocommunity.com/repository

Disable notifications for a service in nagios

Assuming you are running nagios on a UBuntu box and want to disable notification emails for a particular service, you would follow the steps below.

1. Locate the service configuration file. In my case it happened to be located at /etc/nagios3/conf.d/localhost_nagios2.cfg

2. Edit the file and find the service definition for the service you are interested in. The service definitions all start with 'define service'

3. Add the following configuration inside the service definition

notifications_enabled 0

4. Restart nagios - /etc/init.d/nagios3 restart

Notification would now be disabled for this service.