Skip to content

Instantly share code, notes, and snippets.

View manashmandal's full-sized avatar
👨‍💻
Probably Coding || ! Probably Coding

Manash Kumar Mandal manashmandal

👨‍💻
Probably Coding || ! Probably Coding
View GitHub Profile
@rednafi
rednafi / sqla_dict.py
Last active June 30, 2020 18:03
Python's dict-like custom data structure that can store data in any SQLAlchemy supported database. Uses transaction.
"""
This is a self contained custom data structure with dict like
key-value storage capabilities.
* Can store the key-value pairs in any sqlalchemy supported db
* Employs thread safe transactional scope
* Modular, just change the session_scope to use a different db
* This example uses sqlite db for demonstration purpose
The code is inspired by Raymond Hettinger's talk `Build powerful,
@rednafi
rednafi / async_redis.py
Created June 7, 2020 06:37
Seems like aioredis isn't being maintained anymore. This uses redis-py in async mode
import json
import os
import sys
from datetime import timedelta
import httpx
import redis
from dotenv import load_dotenv
from fastapi import FastAPI
from asgiref.sync import sync_to_async
@harveyconnor
harveyconnor / a-mongodb-replica-set-docker-compose-readme.md
Last active April 20, 2024 15:54
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@rluts
rluts / token_auth.py
Last active October 13, 2023 20:56
Token authorization middleware for Django Channels 2
from channels.auth import AuthMiddlewareStack
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
class TokenAuthMiddleware:
"""
Token authorization middleware for Django Channels 2
"""
@chetanppatil
chetanppatil / install-postman.sh
Last active June 10, 2023 17:11
Install Native Postman On Linux
#!/bin/bash
# Download Postman
cd /tmp || exit
echo "Downloading Postman..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
# Extract and install Postman to /opt
echo "Extracting and installing to /opt..."
sudo tar -xzf postman.tar.gz -C /opt/
@paduvi
paduvi / FlatCnnLayer.py
Last active May 13, 2023 20:30
Hierarchical Softmax CNN Classification
import torch
import torch.nn as nn
import torch.nn.init as init
dropout_prob = 0.5
class FlatCnnLayer(nn.Module):
def __init__(self, embedding_size, sequence_length, filter_sizes=[3, 4, 5], out_channels=128):
super(FlatCnnLayer, self).__init__()
@hrshovon
hrshovon / build_opencv_ARM_cross
Last active May 21, 2022 17:10
Cross compile opencv3.3.0 for your raspberry pi and similar ARM devices with python support
This is a note on how to cross compile opencv for pretty much any ARM device(HardFP supported in this case) and deploy. Native
compiling in ARM devices can be painfully slow and they seem to hang often during build(mine got stuck at 43%). So if you happen
to have a desktop/laptop/server running ubuntu or similar linux distro, u can build opencv in fractionth of the time taken for
native compiling without any issues.
Building opencv3 with TBB and NEON and VFP support can boost opencv performance. Thanks to Adrian at pyimagesearch for pointing
that out.
Both my PC and target machine aka orange pi zero are running ubuntu 16.04 with python2.7 and python 3.5.
Let us use the term "build machine" for your PC where you are building opencv and "target machine" for the ARM single board computer.
1.Run the following commands in both machines(I think installing these in target machine only would do) to install the necessary libraries etc.(mine worked with them,so they should be enough
@eamartin
eamartin / notebook.ipynb
Last active November 6, 2022 18:53
Understanding & Visualizing Self-Normalizing Neural Networks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@StuartFarmer
StuartFarmer / classification-forex-model.py
Created October 24, 2016 02:27
Classification Forex Prediction Model
import csv
import random
import numpy as np
import matplotlib.pyplot as plt
import math
import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32,allow_gc=False"