Skip to content

Instantly share code, notes, and snippets.

View mfsiat's full-sized avatar
👾
bugs everywhere

Md. Nasirul Islam mfsiat

👾
bugs everywhere
View GitHub Profile
@Tarequzzaman
Tarequzzaman / password_bcrypyt_and_checking.py
Last active May 23, 2022 12:45
Password Encryption(bcrypt) & Checking
#------------------- Requirements ------------------------
pip install bcrypt
#------------------- Hashing Password ---------------------
import bcrypt
passwd = b'xyz123'
salt = bcrypt.gensalt()
@Tarequzzaman
Tarequzzaman / encryption_decryption_AES_256.py
Created May 22, 2022 06:04
AES 256 encryption and description in Python 3
# AES 256 encryption/decryption using pycrypto library
"""
used Python version:
--------------------
Python3.8
requirements:
------------
pip3 install -U PyCryptodome
@Tarequzzaman
Tarequzzaman / decorator.py
Last active May 23, 2022 12:46
How to use decorator as Cache
import functools
def memoize(obj):
cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
if args not in cache:
cache[args] = obj(*args, **kwargs)
return cache[args]
@Tarequzzaman
Tarequzzaman / POST_api_call.py
Last active May 23, 2022 12:46
Async API call in Python 3
import json
import aiohttp
url = "http://127.0.0.1:5005/webhooks/rest/webhook"
data = '{"sender":"218311","message":"english"}'
async def aiohttp_session():
async with aiohttp.ClientSession() as session:
async with session.post(url, data=data) as r:
return await r.json() if r.status ==200 else await r.text
@Tarequzzaman
Tarequzzaman / post_request_aiohttp.py
Created March 6, 2021 17:39
async post request python
import aiohttp
async def call_url(session):
url = "http://127.0.0.1:5005/webhooks/rest/webhook"
data = '{"sender":"218311","message":"english"}'
response = await session.post(url=url, data=data)
return response
# async def call_with_aiohttp():
@bradtraversy
bradtraversy / django_crash_course.MD
Last active March 1, 2024 02:44
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
@iamcryptoki
iamcryptoki / fix-sysctl.txt
Created July 29, 2019 09:20
Fix sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables.
$ modprobe bridge
$ echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.conf
$ sysctl -p /etc/sysctl.conf
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
# SOLUTION
$ modprobe br_netfilter
$ sysctl -p /etc/sysctl.conf
@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 28, 2024 19:51
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@matthewjberger
matthewjberger / instructions.md
Last active April 30, 2024 18:02
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache