Skip to content

Instantly share code, notes, and snippets.

View anandtripathi5's full-sized avatar
🎯
Focusing

Anand Tripathi anandtripathi5

🎯
Focusing
View GitHub Profile
@anandtripathi5
anandtripathi5 / 12_factor_app_checklist_explained.md
Last active December 3, 2022 13:24
The 12 Factor App checklist explained

The twelve-factor app Checklist Explained

| ✓ | Factors | Status | Remarks | |----|-----------------------------------------------

@anandtripathi5
anandtripathi5 / svn2git.md
Created March 17, 2018 02:04
Svn to git migration with history

For this, I have used svn2git library with the following procedure:

sudo apt-get install git-core git-svn ruby sudo gem install svn2git svn log --quiet | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq > authors.txt (this command is for mapping the authors)

  • Above step should be performed in the folder that you are going to convert from svn to git.

>- Add one mapping per line in authors.txt like this

@anandtripathi5
anandtripathi5 / rabbitmq_auth_backend_ip_range.md
Last active June 12, 2018 12:38
Configure rabbitmq community plugin rabbitmq_auth_backend_ip_range on ubuntu

Rabbitmq-auth-backend-ip-range link is community plugin for client authorization based on source IP address. With this community plugin, we can restrict access to client on the basis of IP address

Steps To configure plugin in rabbitmq version 3.6.X

@anandtripathi5
anandtripathi5 / brief_explanation_of_zen_of_python.md
Last active August 1, 2020 10:34
A brief explanation of zen of python

The Zen of Python is a collection of 20 software principles that influence the design of Python Programming Language, only 19 of which were written down around June 1999 by Tim Peters. You can find the list of Zen of Python in any python interpreter just fire a command - import this

  • Beautiful is better than ugly.

    • To better understand this suppose the editor is your canvas and your code is your art, then how much effort you will put in so that someone will call you an artist. According to Somya Ghosh(Random Quora answer) Rather than using && or|| as logical operators, consider using and || or, if it works && is readable to you.

          if ( a && b == 0 || s == 'yes')
      

      Versus

          if a and b == 0 or s == 'yes': 
      
npm install socket.io-client
pip install flask
pip install flask-socketio
pip install eventlet
pip install gunicorn
from flask import Flask, render_template
from flask_socketio import SocketIO
# Initializing the flask object
app = Flask(__name__)
# Initializing the flask-websocketio
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.8/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
const socket = io('http://localhost:5000')
socket.on('connect', () => {
console.log("socket connected");
});
</script>
@anandtripathi5
anandtripathi5 / celery_config.py
Created April 21, 2021 09:00
Celery production ready configuration
broker_url = "{}://{}:{}@{}:{}/{}".format(
broker_protocol,
broker_username,
broker_password,
broker_host,
broker_port,
broker_vhost)
worker_send_task_event = False
task_ignore_result = True
broker_url = "{}://{}:{}@{}:{}/{}".format(
broker_protocol,
broker_username,
broker_password,
broker_host,
broker_port,
broker_vhost)
worker_send_task_event = False
task_ignore_result = True