Skip to content

Instantly share code, notes, and snippets.

@hemantbadhe
hemantbadhe / installing-postman.md
Created July 31, 2020 14:17 — forked from ba11b0y/installing-postman.md
Installing Postman on Ubuntu/Gnome

Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux

Although I highly recommend using a snap

sudo snap install postman

Installing Postman

tar -xzf Postman-linux-x64-5.3.2.tar.gz
@hemantbadhe
hemantbadhe / settings.py
Created July 24, 2020 16:39 — forked from ipmb/settings.py
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGGING_CONFIG = None
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
logging.config.dictConfig({
from Crypto.Hash import SHA3_256
class MerkleTools(object):
def __init__(self):
self.reset_tree()
def _to_hex(self, x):
return x.hex()
@hemantbadhe
hemantbadhe / dump
Last active January 15, 2020 16:04 — forked from ipedrazas/dump
Mongo dump/restore with docker
# Backup DB
docker run \
--rm \
--link running_mongo:mongo \
-v /data/mongo/backup:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
# Download the dump
scp -r USER@REMOTE:/data/mongo/backup ./backup
@hemantbadhe
hemantbadhe / mysql-docker.sh
Created January 15, 2020 16:02 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@hemantbadhe
hemantbadhe / django_post_save_signal.py
Last active September 16, 2019 18:29
Django post save signal
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_api.models import UserProfile
@api_view(['GET', 'POST'])