brew install pyenv
brew install zlib
brew install sqlite
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
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
-
-
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':
-
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
- wget https://dl.bintray.com/rabbitmq/community-plugins/3.6.x/rabbitmq_auth_backend_ip_range/rabbitmq_auth_backend_ip_range-20180116-3.6.x.zip
- unzip content to /usr/lib/rabbitmq/lib/rabbitmq_server-3.x/plugins
- Enable plugin:
rabbitmq-plugins enable rabbitmq_auth_backend_ip_range
import boto3 | |
from botocore.exceptions import ClientError | |
class BotoBackoff(object): | |
""" | |
Wrap a client for an AWS service such that every call is backed by exponential backoff with jitter. | |
Examples: | |
>>> ecs = BotoBackoff('ecs') | |
>>> ecs.list_tasks(cluster='my-cluster') |
# Copyright (c) 2018 Bao Nguyen <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
The twelve-factor app Checklist Explained
| ✓ | Factors | Status | Remarks | |----|-----------------------------------------------
I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.
So it might be really unintuitive at first but lambda functions have three states.
- No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
- VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
- VPC with NAT, The best of both worlds, AWS services and web.
sudo yum -y update | |
sudo yum -y localinstall https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-ami201503-96-9.6-2.noarch.rpm | |
sudo yum -y install postgresql96 postgresql96-server | |
sudo su - postgres -c "/usr/pgsql-9.6/bin/initdb" | |
sudo service postgresql-9.6 start | |
curl https://install.citusdata.com/community/rpm.sh | sudo bash | |
sudo yum install -y pg_cron_96 | |
sudo -u postgres echo "shared_preload_libraries = 'pg_cron'" >> /var/lib/pgsql/9.6/data/postgresql.conf |
# fun stuff | |
alias lenny='echo \_(ツ)_/¯ | pbcopy' | |
alias tuxsay='cowsay -f tux ' | |
alias fortunes='sh ~/.fortunes.sh' | |
alias life='figlet 42 | lolcat' | |
alias lol='while true; do sl; done;' | |
alias starwars='telnet towel.blinkenlights.nl' | |
alias fancy='figlet $@' | |
# to make people confused xD |