$ sudo install -o redis -g redis -d /var/lib/redis2
$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
# 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. |
===================================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 |
Picking the right architecture = Picking the right battles + Managing trade-offs
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))) | |
# 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 |
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 |
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.
# 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" |