Skip to content

Instantly share code, notes, and snippets.

View linuxkathirvel's full-sized avatar

Kathirvel Rajendran linuxkathirvel

View GitHub Profile
@linuxkathirvel
linuxkathirvel / send_mail_using_celery_Django.txt
Last active May 11, 2017 07:28
Steps to setup Celery in Django
# Step 1
# Install Redis server
sudo apt-get install redis-server
# Please confirm with 'redis-cli ping' command. If that display 'PONG', it is working fine.
# Step 2
pip install celery redis
@linuxkathirvel
linuxkathirvel / debian.txt
Last active May 26, 2017 09:14
Frequently used commands in Debian
# Enable auto completion in Debian bash
sudo apt-get install bash-completion
# Enable sudo group to existing user
sudo apt-get install sudo
adduser username sudo
Reference: https://wiki.debian.org/sudo
import datetime
# strptime() is used for converting a string to a datetime object.
# strftime() is used for converting datetime object to formatted string
date_string = "2017-08-10 17:32:25"
# To convert as Python DateTime object
python_date_time_object = datetime.datetime.strptime(date_string, "%Y-%m-%d %H:%M:%S")

Download Youtube Videos by start date and end date

youtube-dl -i --datebefore=20170901 --dateafter=20170101 https://www.youtube.com/user/periyartv/videos
yum install https://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-7-x86_64/pgdg-redhat93-9.3-3.noarch.rpm
yum install postgresql93
yum install postgresql93-server

/usr/pgsql-9.3/bin/postgresql93-setup initdb
systemctl enable postgresql-9.3
systemctl start postgresql-9.3

Install 'nslookup' in CentOS 7

sudo yum install bind-utils
nslookup gnutamil.blogspot.com

Shutdown linux machine

sudo shutdown -h now

Add swap partition in CentOS7

  1. Create new partition using fdisk /dev/sda with needed swap size
  2. Change change partition type as LVM by partition code 8e using t option in fdisk
  3. Save changes using w option
  4. Reboot CentOS7
  5. Create PV using pvcreate /dev/sdaX. 'X' will be newly created partition number.
  6. Get VG name using vgdisplay
  7. Extend VG size using vgextend centos /dev/sdaX
  8. After extending VG size create Logical Volume using lvcreate centos -n swap -L 4G. Here, 'centos' in VG name and 'swap' is LV name
postgres=# CREATE DATABASE confluencedb WITH ENCODING 'UNICODE' LC_COLLATE 'en_US.utf8' LC_CTYPE 'en_US.utf8' TEMPLATE template0;

Enable swap in Linux

  1. Uncomment swap entry in /etc/fstab file, if comment.
  2. Run sudo mount -a; sudo swapon --all --verbose
  3. Check with free -h command.