Skip to content

Instantly share code, notes, and snippets.

View rosehgal's full-sized avatar
🎯
Focusing

Rohit Sehgal rosehgal

🎯
Focusing
View GitHub Profile
from django.conf import settings
from django.contrib.auth.models import User
from django import forms
def my_portal_authenticate(username, password):
if username == 'fooDjango'
and password == 'barDjango':
return True
return False
from django.db import models
class DateModel(models.Model):
created_by = models.CharField(max_length=50)
modified_by = models.CharField(max_length=50)
from django.contrib import admin
from app.models import MyModel
admin.site.register(MyModel)
from django.contrib.auth.forms import AuthenticationForm
from django.forms import ValidationError
class CustomLoginForm(AuthenticationForm):
#overriding clean method to change default authentication behaviour
def clean(self):
userid = self.cleaned_data.get('username')
password = self.cleaned_data.get('password')
from django.contrib.admin import AdminSite
from .login import CustomLoginForm
from django.utils.translation import ugettext_lazy as _
from .models import MyModel
Class CustomLoginAdminSite(AdminSite):
site_title = _('My site admin')
site_header = _('Administration')
index_title = _('CustomLogin')
#registering Custom login form for the Login interface
from app.admin import admin_site
urlpatterns = [
url(r'^app/',include('app.urls',namespace="app"),name='app_access'),
#informing the django about the new admin site
# TADA thats done !! whhoh
url(r'^admin/', include(admin_site.urls)),
]
#Rest of Settings.py
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'app.backends.MyPortalBackend',
]
import splunklib.client as client
from splunklib.binding import AuthenticationError
import sys
import json
splunk_config = {
"splunk":{
"host": "localhost",
"port": 8089,
import splunklib.client as client
from splunklib.binding import AuthenticationError
import sys
import json
splunk_config = {
"splunk":{
"host": "localhost",
"port": 8089,
/*
Understand how the fucntion call look like in assembly.
gcc -m32 function_call.c -o fucntion_call -fno-stack-protector
*/
#include <stdio.h>
#include <unistd.h>
void foo(){
printf("Printing from foo");