Skip to content

Instantly share code, notes, and snippets.

View akashadhikari's full-sized avatar
🎯
वोर्किङ

Akash Adhikari akashadhikari

🎯
वोर्किङ
View GitHub Profile
@akashadhikari
akashadhikari / example.py
Created May 22, 2022 15:45
Savitzky–Golay filter example
import numpy as np
import matplotlib.pyplot as plt
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
from math import factorial
try:
window_size = np.abs(np.int(window_size))
order = np.abs(np.int(order))
except ValueError:

Submit a post request with correct authentication details

http post http://127.0.0.1:8000/api/token/ username=akash password=Akashsky13

The response you get is access token and a refresh token:

{
    "access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjA2MTg1MzkwLCJqdGkiOiI3MTcxOTZlN2E3Yjk0M2I0YWRjNmU0YWZhYjEzZWQ2MSIsInVzZXJfaWQiOjF9.aQQHPGsSHpIf38Bhww76WNOwsZ4PiChgn1a1OV_IlD4",
    "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYwNjI3MTQ5MCwianRpIjoiN2I5OTMxN2Q2ZWViNDI3YzhiNGUxM2FkMTQzNzRhNmEiLCJ1c2VyX2lkIjoxfQ.aayavlSfDbVoDltJOqMWO-ru6T1307iLhLRODx2zACU"
}
@akashadhikari
akashadhikari / venv.sh
Last active June 14, 2018 03:46
Brisk: A Custom Virtual Environment Wrapper
# Written by @akashadhikari (https://github.com/akashadhikari/) and @Bindeep (https://github.com/Bindeep/)
# NOTE: <path to your virtualenv listing> is where you set all of your venv directories
# eg: mine is set as /home/akash/.virtualenvs
workon() {
current_dir=$PWD
if [ $1 ]
then
cd '<path to your virtualenv listing>' && cd $1 && source 'bin/activate' && cd $current_dir
else