Skip to content

Instantly share code, notes, and snippets.

View rjsnh1522's full-sized avatar
🎯
Focusing

Pawan Chaurasia rjsnh1522

🎯
Focusing
View GitHub Profile
# Add this to you .zshrc or .bash_rc
alias gst="git status"
alias rns="python manage.py runserver"
alias mmgrt="python manage.py makemigrations"
alias mgrt="python manage.py migrate"
alias csu="python manage.py createsuperuser"
alias shl="python manage.py shell"
alias shlp="python manage.py shell_plus"
alias show_urls="python manage.py show_urls"
@rjsnh1522
rjsnh1522 / Git_flow.md
Last active July 15, 2022 05:28
Git Branching flow.

Git Branching Strategy

Objective:

1. To solve issue of merge conflict of migrations. When deploying if developer has forgot to check in their migrations. 
2. To solve Settings.xlsx conflict to remove duplicate entries and over written values.
3. To not block any new release.
4. Solve merge conflict of hot fix if any database changes is there.
@rjsnh1522
rjsnh1522 / extension.py
Last active May 8, 2020 10:46
Adding custom filter to all variables in jinja2
from jinja2.lexer import Token
from jinja2.ext import Extension
class ListDictTable(Extension):
tags = set(['listdicttable'])
def filter_stream(self, stream):
variable_done = False
in_trans = False
@rjsnh1522
rjsnh1522 / python-code-snippet.py
Created April 26, 2019 06:21
python-code-snippet
# To use redis in django
# in settings.py
REDIS = {
'host': 'localhost',
'port': 6379,
'db': 2
}
# make a singleton class and make one redis instance
import redis
@rjsnh1522
rjsnh1522 / recursive_file_deletion.py
Created March 15, 2019 05:51
To recursively delete files with a specific extensio
import os
def caller():
for (root,dirs,files) in os.walk(os.getcwd(), topdown=True):
for file in files:
if file.endswith('.url') or file.endswith('.txt'):
print(os.remove(os.path.join(root, file)))
@rjsnh1522
rjsnh1522 / System Design.md
Created March 8, 2019 05:35 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@rjsnh1522
rjsnh1522 / notes.md
Created January 17, 2019 09:30 — forked from inecmc/notes.md
How to run multiple Redis instances on Ubuntu 16.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
@rjsnh1522
rjsnh1522 / new_environment_installation
Last active June 8, 2018 03:59
New Environment installations for rails development in ubuntu and mac
===================================INSTALL CHROMIUM==============================
# install chromium
$ sudo apt-get install chromium-browser
===================================INSTALL rvm==============================
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
@rjsnh1522
rjsnh1522 / max_of_k_size_sub_array.rb
Created March 6, 2018 16:34
Maximum Of K- size subarrays (Deque)
# question
# quertion url
# https://www.hackerearth.com/practice/data-structures/arrays/1-d/practice-problems/algorithm/maximum-of-k-size-subarrays-deque/
# Given an array A of size 'N' and an integer k, find the maximum for each and every contiguous subarray of size k.
# Input :
# First line contains 2 space separated integers 'N' and 'k' .
# Second line contains 'N' space separated integers denoting array elements.