Skip to content

Instantly share code, notes, and snippets.

View dhavalsavalia's full-sized avatar
🦥
Procrastinating

Dhaval Savalia dhavalsavalia

🦥
Procrastinating
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AboutToPasteTabsWithCancel</key>
<true/>
<key>AboutToPasteTabsWithCancel_selection</key>
<integer>2</integer>
<key>AllowClipboardAccess</key>
<true/>
@dhavalsavalia
dhavalsavalia / decorators.py
Last active November 7, 2021 09:41
Catch-All Route Logging Middleware for FastAPI Application
def skip_request_logging(function):
"""Decorator to skip logging of request body
sets kwargs["request"].state.skip_request_logging to True
"""
@wraps(function)
def wrapper(*args, **kwargs):
kwargs["request"].state.skip_request_logging = True
return function(*args, **kwargs)
return wrapper
@dhavalsavalia
dhavalsavalia / file_handler.py
Created February 10, 2021 18:15
Supercharged file handler
class FileHandler():
"""Handles file like never before. Possible overkill for what it does.
- Want to open a file? You got covered.
- Want to remove lines from the file? You got covered.
- Want to add test to the file? You got covered.
Attributes
----------
file_name : Name of the file
INSER INTO Employees VALUES (0, 'Samantha', 'Roy', 32252),
(1, 'Carlos', 'Lopez', 46748),
(2, 'Kevin', 'Bush', 37959),
(3, 'Theresa', 'Ryan', 63076),
(4, 'Samantha', 'Wilson', 36499),
(5, 'Justin', 'Waller', 40499),
(6, 'Teresa', 'Smith', 42638),
(7, 'Charles', 'Spencer', 44112),
(8, 'Michael', 'Gonzales', 56319),
(9, 'Nicholas', 'Cox', 44365),
@dhavalsavalia
dhavalsavalia / binaca_geetmala.json
Last active December 29, 2020 16:51
A JSON file for Binaca Geetmala (Ameen Sayani) songs from year 1953-1984.
[
{
"year": 1953,
"songs": [
{
"name": "Ye Zindagi Usi Ki Hai, Jo Kisi Ka Ho Gaya, Pyar Hi Me Kho Gaya",
"movie": "Anarkali (1953)",
"artists": [
"Lata Mangeshkar"
]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
@dhavalsavalia
dhavalsavalia / scale_transpose.py
Created September 27, 2020 09:59
Transposes musical scales Pythonically!
root_notes = [
'A',
'A#',
'B',
'C',
'C#',
'D',
'D#',
'E',
'F',
@dhavalsavalia
dhavalsavalia / django-paytm-views.py
Last active April 13, 2020 23:32
file for for Django-PayTM demo | Medium Article:
from . import Checksum
from django.shortcuts import render
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from payments.utils import VerifyPaytmResponse
import requests
def home(request):
@dhavalsavalia
dhavalsavalia / Checksum.py
Created April 13, 2020 17:58
PayTM Checksum file which is compatible with PyCryptodome
import base64
import string
import random
import hashlib
from Crypto.Cipher import AES
IV = b"@@@@&&&&####$$$$"
BLOCK_SIZE = 16

Keybase proof

I hereby claim:

  • I am dhavalsavalia on github.
  • I am dhavalsavalia (https://keybase.io/dhavalsavalia) on keybase.
  • I have a public key ASD7Xu3kb_tYRH4SMkQxoxIVufUyhBqUjWYb85Pl8XB16go

To claim this, I am signing this object: