- Python where we can, C++ where we must.
- CLI where we can, web where we must.
- Use available software where we can, write our own where we must.
- Open source software where we can, proprietary software where we must.
- Upstream where we can, patch where we must.
- Bash where we can, others where we must.
- Nginx where we can, Apache where we must.
- JSON where we can, XML where we must
- POST where we can, GET where we must
- REST where we can, RPC where we must
openssl is a command line tool to use various cryptography functions.
The req command of openssl provides PKCS#10 X.509 Certificate Signing Request (CSR) management facilities.
We will generate a new certificate request for the domain
openssl req -new -nodes -keyout www.example.com.key -out www.example.com.csr
If you have to insert comment on several lines do you do manually insert the comment character in every line? Stop. Vim is a really good editor and has a nice feature to accomplish this quickly. Here are the steps:
- Enter visual blocking mode by pressing CTRL V (CTRL key and the lowercase v).
- Make your selection using motion keys(jklm, etc).
- Press I(uppercase I) to enter block insert mode.
- Press #, the comment character.
- Press Esc key. The comment character # will be inserted on each line the visual block selection.
(datetime.datetime(datetime.datetime.today().year, datetime.datetime.today().month, calendar.monthrange(datetime.datetime.today().year, datetime.datetime.today().month)) - datetime.datetime.today()).total_seconds()
There's a log going on in that one liner. Let's break it down.
The two key Python modules we need to calculate the number of seconds till the end of year are datetime and calendar.
calendar.monthrange(year, month) returns a tuple. The tuple's second element is the number of days in the month.
We create two date objects:
Here's a quick tip for Mercurial users.
Travel back in time and see how the file appeared. :)
hg cat --rev "date('2011-05-03')" controllers/crons.py
Let's break it down.
hg cat is the command we use to print the given revision of file.
hg cat --rev 10885:ae28ee103fed controller/crons.py
would print the file for the revision 0885:ae28ee103fed.
Mercurial supports a functional language for selecting a set of revisions. To know more about it try:
hg help revsets
In our solution:
Anand and Golix are chit chatting in a bar.
Anand: Golix, I have a doubt about USB cables.
Golix: What is it?
Anand: I've been thinking about it for a while. What happens if you connect the USB cable to your brain?
Golix: You'll hear the message: "this disk is not formatted. Do you want to format it now?".
Golix walks into a college campus. Asks few questions to the students.
Golix: What does POP stand for?
Sharath: POP? No idea. Sounds like a distant cousin of Jazz to me.
Golix: What does IMAP stand for?
Shruthi: International mail application something.
Golix: Who created UNIX and C?
Parameshwar: It is beyond me.
Golix: What is Ubuntu?
Parvati: It's a bird!
Golix: Which is the most popular social networking site?
Golix: Which technique is often used to download movies and music freely from the Internet?
Golix: Which operating system do you use?
The uninitiated readers must watch the video.
Bizsense is an open source CRM project which uses Zend Framework. The open source project was started by Binary Vibes about three years ago and was released under the GPL V3 license. Some of you might have noticed that I am no longer active in Binary Vibes.
I wanted Bizsense project development to continue to nourish, flourish and cherish. Therefore, there we did a few changes. Bizsense is now released under the new BSD license. Bizsense uses Google open source project hosting which offers issue tracker, Wiki and source control. Bizsense now uses Mercurial for source control. The documentation is published at docs.jubero.com. In order to contribute to Bizsense, signing a CLA is no longer required.
Here are the project links:
Redmine is a software project management tool which has Wiki, issue tracer, source code browser and other cool features built in. If you want to install Redmine with MySQL and Nginx on CentOS 6, follow these steps.
I always use EPEL repository with CentOS. EPEL provides additional RPM packages. We can use Nginx and some Ruby gem packages from EPEL.
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
Install required packages:
yum install nginx mysql-server ruby rubygem-rack rubygem-rake ruby-mysql
Redmine requires a Ruby gem called i18n. I couldn't find the RPM for i18n gem. I had to install i18n gem using the gem installer.
gem install -v=0.4.2 i18n
Start MySQL server:
Use the MySQL secure installation program:
Connect to the MySQL server as root:
mysql -u root -p
Create a MySQL database and user for Redmine:
mysql> CREATE DATABASE redmine character set utf8;
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'secret_password' WITH GRANT OPTION;
Amazon Simple Storage Service or Amazon S3 is a storage service with a web API. I use Amazon S3 to store backups of my blog and other sites. I made a simple python script to handle file uploads to S3.
In order to use Amazon S3, first create a bucket using your Amazon AWS account. As the name suggests, bucket is a container. You can create buckets using the AWS management console.
The script we're going to write will take two input parameters
- Path to file, local
- Target S3 path