Skip to content

Instantly share code, notes, and snippets.

@saurabhmodh94
saurabhmodh94 / redis_del_keys.sh
Created November 23, 2021 12:35
Non-Blocking script to Delete Redis Instance Keys.
#!/bin/bash
if [ "$#" -lt 1 ]
then
echo "Scan keys in Redis matching a pattern using SCAN (safe version of KEYS)"
echo "Usage: $0 <host> [port] [database] [pattern] [count]"
exit 1
fi
host=${1:-}
port=${2:-6379}
# vim:ft=zsh ts=2 sw=2 sts=2
#
# AgnosterJ Theme - https://github.com/apjanke/agnosterj-zsh-theme
#
# A Powerline-inspired theme for ZSH
# Based on the original Agnoster Theme - https://github.com/agnoster/agnoster-zsh-theme
#
# # README
#
# In order for this theme to render correctly, you will need iTerm2 or a
# GMAIL
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'xxx@gmail.com'
EMAIL_HOST_PASSWORD = '' # APP Password
EMAIL_USE_TLS = True
{
"Id": "Policy1555233602764",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1555233600130",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
from django.core.exceptions import PermissionDenied
from simple_decorators.apps.models import Entry
def user_is_entry_author(function):
def wrap(request, *args, **kwargs):
entry = Entry.objects.get(pk=kwargs['entry_id'])
if entry.created_by == request.user:
return function(request, *args, **kwargs)
else:
raise PermissionDenied
#Generating a new SSH key
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
#Add a new SSH key to your GitHub account
~/.ssh/id_rsa.pub
# use python3 in django project
virtualenv .venv --python=python3