Skip to content

Instantly share code, notes, and snippets.

View nusherjk's full-sized avatar
💭
I dont know what I am doing here :|

Nusher Jamil Kazi nusherjk

💭
I dont know what I am doing here :|
View GitHub Profile
@nusherjk
nusherjk / nginx.MD
Last active January 18, 2024 10:57
Tutorial On NGINX Deployment for Django in CentOS8 VM using Gunicorn.

Django is arguably the most popular web framework in the python programming language because of its robust architecture and vast documentation. However I have found deploying in the virtual Machine of a linux distro is quite tough that even chatgpt couldn't help that much

In order to deploy your project you first have to have a project. Lets assume you have a working project in the centOs distro where you have installed python3 and its dependencies for the project. Lets call the project my_demo_project

So running this command wonk cause to any errors

python3 manage.py runserver
@nusherjk
nusherjk / csvXLSdownloader.js
Created January 12, 2023 05:15
CSV and XLS Download simpler methods
function downloadTableAsCSV() {
var table = document.getElementById("tblData");
var csv = "";
for (var i = 0; i < table.rows.length; i++) {
for (var j = 0; j < table.rows[i].cells.length; j++) {
csv += table.rows[i].cells[j].innerHTML + ",";
}
csv += "\r\n";
}
var downloadLink = document.createElement("a");
@nusherjk
nusherjk / KeyCloak.MD
Last active December 28, 2022 05:34
Key Cloak Integration with Django all Auth

INSTALLATION:

Please follow the steps while integrating keycloak on Django-alauth

  1. On your Django application , Open “Settings.py” and insert the following lines (Important - Please note ‘django.contrib.sites’ is required as INSTALLED_APPS):

image add ‘django.contrib.sites’ in INSTALLED_APPS list

  1. add the following line into INSTALLED_APPS=
@nusherjk
nusherjk / ldap.py
Created December 9, 2022 13:09
LDAP active directory login function
from ldap3 import Server, Connection, ALL
from .models import *
def ldapcheck(username, password):
servername= 'LDAP URL'
server = Server(servername, get_info=ALL) # define an unsecure LDAP server, requesting info on DSE and schema
# define the connection
connection = Connection(server, user=username, password=password) # define an ANONYMOUS connection