also see Drawing ASCII Boxes
┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌ │ ┤
╣ ║ ╗ ╝ ╚ ╔ ╩ ╦ ╠ ═ ╬
░ ▒ ▓ █ ▄ ▀ ■| import threading | |
| # Based on tornado.ioloop.IOLoop.instance() approach. | |
| # See https://github.com/facebook/tornado | |
| class SingletonMixin(object): | |
| __singleton_lock = threading.Lock() | |
| __singleton_instance = None | |
| @classmethod |
also see Drawing ASCII Boxes
┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌ │ ┤
╣ ║ ╗ ╝ ╚ ╔ ╩ ╦ ╠ ═ ╬
░ ▒ ▓ █ ▄ ▀ ■| license: gpl-3.0 |
| import os | |
| from kafka import KafkaProducer, KafkaConsumer | |
| BOOTSTRAP_SERVERS=os.gentenv("KAFKA_BOOTSTRAP_SERVERS").split(",") | |
| TOPIC_NAME="the-topic" | |
| SASL_USERNAME=os.gentenv("KAFKA_SASL_USERNAME") | |
| SASL_PASSWORD=os.gentenv("KAFKA_SASL_PASSWORD") | |
| def consume(): | |
| consumer = KafkaConsumer(TOPIC_NAME, security_protocol="SASL_SSL", sasl_mechanism="SCRAM-SHA-512", sasl_plain_username=SASL_USERNAME, sasl_plain_password=SASL_PASSWORD, bootstrap_servers=BOOTSTRAP_SERVERS) |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.
You can get all of this information on the command line.
rails generate with no generator name will output a list of all available generators and some information about global options.
rails generate GENERATOR --help will list the options that can be passed to the specified generator.