Skip to content

Instantly share code, notes, and snippets.

View ishwar6's full-sized avatar
🎯
Focusing

Ishwar Jangid ishwar6

🎯
Focusing
View GitHub Profile
"""
Fast-path interpreter — deterministic classification with zero LLM tokens.
Handles ~80% of user inputs: exact matches, partial matches, numbers, keywords.
"""
from __future__ import annotations
import re
from typing import Any
@ishwar6
ishwar6 / database_replication.py
Last active August 15, 2023 18:00
Database Replication Basic Classes
import time
from threading import Thread
class Node:
"""
Represents a basic database node. This can be a leader or follower.
"""
def __init__(self, node_id):
self.node_id = node_id
self.data = {}
1. pip install social-auth-app-django
2.
Add the social_django to your INSTALLED_APPS
3.
python manage.py migrate
@ishwar6
ishwar6 / otp
Created February 13, 2019 02:28
<form action="" method='post'>
{% csrf_token %}
<p><label for="id_phone">Phone:</label> <input type="number" name="phone" required id="id_phone"></p>
<span id='msg'></span>
<br>
<p><label for="id_otp">Otp:</label> <input type="number" name="otp" required id="id_otp"></p>
Paste this at the bottom of settings.py file
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static_my_proj"),
]
STATIC_ROOT = os.path.join(os.path.dirname(
import string
from django.utils.text import slugify
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def unique_slug_generator(instance, new_slug=None):