Skip to content



from flask import make_response

def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)


pre-commit run black --all-files

Git stash

# To list the stashed modifications
git stash list

#To show files changed in the last stash
git stash show

#So, to view the content of the most recent stash, run
git stash show -p

#To view the content of an arbitrary stash, run something like
git stash show -p stash@{1}


pytest -v --cov-report=html --cov=apis


import requests
def notification(message):
    report = {}
    report['value1'] = message'<Replace-key-here>', data=report)


from functools import wraps
def my_logger(orig_func):
    import logging
    logging.basicConfig(filename='{}.log'.format(orig_func.__name__), level=logging.INFO)

    def wrapper(*args, **kwargs):
            'Ran with args: {}, and kwargs: {}'.format(args, kwargs))
        return orig_func(*args, **kwargs)
    return wrapper

def my_timer(orig_func):
    import time
    def wrapper(*args, **kwargs):
        t1 = time.time()
        result = orig_func(*args, **kwargs)
        t2 = time.time() - t1
        print('{} ran in: {} sec'.format(orig_func.__name__, t2))
        return result
    return wrapper


:set makeprg=python\ %
:set autowrite

Simple CSS

<style type="text/css">body{margin:40px

remove docker log file

sudo find /var/lib/docker/ -name "*.log" -exec ls -sh {} \; | sort -h -r | head -10
sudo sh -c "truncate -s 0 /var/lib/docker/containers/<filename>-json.log"

Boyfriend Alert

while true; do echo ok | nc -l 8000; for i in 1 2 3 4; do printf '\a'; sleep 1; done; done
while true; do echo Coming! | nc -l 8000; for i in 1 2 3 4; do say "Lunch time!"; sleep 1; done; done
while true; do (echo ok | nc -q 1 -vlp 8000 2>&1; echo; date -u) | tee -a beeper.log; for i in 1 2 3 4; do printf '\a'; sleep 1; done & done

Reloads configuration without restarting Nginx

sudo nginx -s reload 

bash alias to help copy commands that include '$'

alias '$'=''

remove node modules

find . -name "node_modules" -exec rm -rf '{}' +