Skip to content

Instantly share code, notes, and snippets.

View linuxkathirvel's full-sized avatar

Kathirvel Rajendran linuxkathirvel

View GitHub Profile
@linuxkathirvel
linuxkathirvel / mac-address-generator-sequential.md
Created December 13, 2019 07:36
MAC Address Generator - Sequential

MAC Address Generator - Sequential

for x in {252..255};do for y in {0..255};do for z in {0..255};do printf "52:54:00:%X:%X:%X\n" $x $y $z;done;done;done >> MAC.list
@linuxkathirvel
linuxkathirvel / network-script-for-rhel74-oracle-linux74.md
Last active December 11, 2019 15:27
Network script for RHEL 7.4/ Oracle Enterprise Linux 7.4

Network script for RHEL 7.4/ Oracle Enterprise Linux 7.4

Edit '/etc/sysconfig/network-scripts/ifcfg-eth0'

These three lines are important

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

Below is sample

@linuxkathirvel
linuxkathirvel / install-oracle-enterprise-linux.md
Last active May 6, 2025 09:39
How to install Oracle Enterprise Linux 7.4?

How to install Oracle Enterprise Linux 7.4?

Oracle's downloading script downloads many ISOs around 14.1GB totally. I tried 'Oracle Linux Release 7 Update 4 Boot ISO image for x86 (64 bit) (461.0MB)' and 'Oracle Linux Release 7 Update 4 source DVD 1(3.4GB)' ISOs. The first one was given 'Error setting up base repository' and second one is not booting. So, download the below image and use it to install.

Download below ISO image from the Oracle site

V921569-01.iso(4.6GB)
Oracle Linux Release 7 Update 4 for x86 (64 bit)
SHA-1: A855783F4CD8BDD17B785591A21746EDA7ABF476
SHA-256: F2E11A2FCEBA8E285490C8DF7C2172336CC23EB4BAB95924B98D1029DCE7EB0B
@linuxkathirvel
linuxkathirvel / get-ip-address-in-django.md
Created December 10, 2019 07:04
How do I get user IP address in django?

How do I get user IP address in django?

def get_client_ip(request):
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[0]
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip
@linuxkathirvel
linuxkathirvel / krunner-position.md
Created December 6, 2019 14:05
How can I change the screen position of krunner in KDE Plasma 5.x?
@linuxkathirvel
linuxkathirvel / make-cgroupv1-as-default-in-fedora31.md
Last active December 11, 2019 15:11
How to make CGroupsV1 as default in Fedora 31 Server?

How to make CGroupsV1 as default in Fedora 31?

CGroupsV2 as default in Fedora 31 Server. We change it and can assign CGroupV1 as default using the below line in kernel command line.

systemd.unified_cgroup_hierarchy=0

Steps

sudo vim /etc/default/grub
# Add 'systemd.unified_cgroup_hierarchy=0' in kernel command line. It will look like below
@linuxkathirvel
linuxkathirvel / serialize-django-orm-objects-in-json.md
Last active December 5, 2019 16:18
Serialize Django ORM objects in JSON format

Serialize Django ORM objects in JSON format

Use natural_key() function in models.py

use_natural_foreign_keys=True in serializer object as below

models.py

class Book(models.Model):
    name = models.CharField()
    price = models.FloatField()
 
@linuxkathirvel
linuxkathirvel / kill-gunicorn-process.md
Created December 1, 2019 12:27
Kill Gunicorn worker process

Kill Gunicorn worker process

ps aux | grep gunicorn | awk '{print $2;}' | xargs kill -9 2>/dev/null
@linuxkathirvel
linuxkathirvel / gunicorn-daemon-django.md
Last active November 29, 2019 13:38
Django+Gunicorn daemon in Fedora 31 Service

Django+Gunicorn daemon in Fedora 31 Service

Create /etc/systemd/system/gunicorn-django-app.service file with below content

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=username
Group=groupname
@linuxkathirvel
linuxkathirvel / django-nginx-gunicorn-deployment.md
Last active December 6, 2020 14:13
How to Deploy Django application in Fedora 31 with NGINX and Gunicorn?

How to Deploy Django application in Fedora 31 with NGINX and Gunicorn?

Disable SELinux in Fedora

sudo setenforce 0
# To disable permenently
Change SELINUX value to 'disabled' in '/etc/sysconfig/selinux' file

Install Gunicorn

source venv/bin/activate