Find the largest files or directories in Linux

Writing by on Wednesday, 25 of February , 2015 at 8:32 am

Running out of space? To find the biggest files or folders in your Linux environment in descending order, switch to the root folder and then run the du command.

cd /
du -Sh | sort -rh | head -n 20

Mac equivalent is something like

find . -type f -print0 | xargs -0 ls -l | sort -k5,5rn

Leave a comment

Category: Linux

MongoDB for SQL users

Writing by on Thursday, 18 of December , 2014 at 11:42 pm

Here’s a Quick Reference to get started

Description SQL Mongo DB  
Lingo 1 Table; Relation Collection  
Lingo 2 Row; Record; Tuple Document  
List Databases SHOW databases show databases  
List Tables SHOW tables show collections  
Switch to a DB USE db use db  
Show Table Data SELECT * FROM table db.collection.find.pretty()  
Filter Table Data WHERE colum = 'value' db.collection.find({'column':'value'})  
Select Columns SELECT col1, col2 db.collection.find({},{col1:1, col2:1})  
Delete Rows DELETE FROM table WHERE col='val' db.collection.remove({'col':'val'})  
Get Rid of a Table DROP table db.collection.drop()  
       

Leave a comment

Category: MongoDB,SQL DB

tastypie Error Sorry, this request could not be processed. Please try again later.

Writing by on Wednesday, 17 of December , 2014 at 4:10 am

  • Check the logs for the general issues.
  • Check the JSON that you’re sending to see if it’s valid. (I had an invalid JSON due to an extra comma)

Leave a comment

Category: Python

RSyslog – The Basics

Writing by on Wednesday, 3 of December , 2014 at 10:38 pm

Honestly, I found syslog-ng simpler to use once I knew The Basics. However, I also needed to do some testing with rsyslog and hence needed to dig in.

Setup and configure the Host Machine where you will receive the syslog messages.

# 1. Install rsyslog
$ sudo apt-get install rsyslog

# 2. Backup the config file syslog-ng.conf
$ sudo cp /etc/rsyslog.conf /etc/rsyslog.conf.orig

# 3. Edit the config file
$ sudo vi /etc/rsyslog.conf

# 4. Enable TCP/UDP by Uncommenting the following
# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

# Add a file that will be the destination for your Syslog
local5.* /var/log/my_rsyslog.log

# 5. Restart rsyslog
$ sudo service rsyslog restart

When you configure your Appliance to forward syslog to your Host at local5, you will see the logs in “/var/log/my_rsyslog.log”.

Leave a comment

Category: Linux

Formula to convert Epoch Timestamps to Readable Date in Excel

Writing by on Thursday, 20 of November , 2014 at 1:47 am

If you have several epoch times that you want to convert to human readable date then here’s a great post from spreadsheetpage.com on converting Unix Timestamps.

In a nutshell … you use the provided formula and then format to date.

For GMT
=(((A1/60)/60)/24)+DATE(1970,1,1)

For Pacific
=(((A1/60)/60)/24)+DATE(1970,1,1)+(-8/24)

Right Click the Cell –> Format Cells –> Date

Leave a comment

Category: Tips and Tricks

Must Have Mac Apps

Writing by on Wednesday, 12 of November , 2014 at 4:43 am

Here’s a list of Apps that I must have on my Mac:

Leave a comment

Category: Apple

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.