Skip to content

Instantly share code, notes, and snippets.

@lorenzodifuccia
lorenzodifuccia / generate_instagram_enc_password.py
Created December 22, 2020 02:12
Encryption function used by Instagram (Browser App) to generate the 'enc_password' from PubKey (AES-GCM + SealedBox)
import base64
import struct
import datetime
import binascii
from urllib.parse import quote_plus
# pip install pycryptodomex
from Cryptodome import Random
from Cryptodome.Cipher import AES
@defulmere
defulmere / settings.py
Last active June 18, 2024 18:20
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
@merwok
merwok / storages.py
Last active October 24, 2023 18:13
Example code to reconcile django-storages and django-filebrowser-no-grappelli https://github.com/smacker/django-filebrowser-no-grappelli/issues/47
import posixpath
from filebrowser.storage import StorageMixin
from storages.backends.s3boto3 import S3Boto3Storage
class S3Storage(StorageMixin, S3Boto3Storage):
"""Integration between filebrowser and S3 storage."""
def isdir(self, name):