Skip to content

Instantly share code, notes, and snippets.

View saurookadook's full-sized avatar

Andy Maskiell saurookadook

View GitHub Profile
@saurookadook
saurookadook / singleton.py
Created March 13, 2026 22:05 — forked from werediver/singleton.py
A thread safe implementation of singleton pattern in Python. Based on tornado.ioloop.IOLoop.instance() approach.
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
@saurookadook
saurookadook / README.md
Last active July 7, 2025 14:18 — forked from dsample/README.md
ASCII art diagrams

ASCI art characters for creating diagrams

also see Drawing ASCII Boxes

Characters

┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌ │ ┤
╣ ║ ╗ ╝ ╚ ╔ ╩ ╦ ╠ ═ ╬
░ ▒ ▓ █ ▄ ▀ ■
@saurookadook
saurookadook / .block
Created August 20, 2024 14:19 — forked from mbostock/.block
Wrapping Long Labels
license: gpl-3.0
@saurookadook
saurookadook / kafka-cheat-sheet.md
Created January 24, 2023 22:23 — forked from sahilsk/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
@saurookadook
saurookadook / kafka_python_sasl_scram.py
Created January 6, 2023 19:42 — forked from alexlopes/kafka_python_sasl_scram.py
Kafka Python with SASL/SCRAM Authentication Example
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)

Problem

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).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@saurookadook
saurookadook / multiple_ssh_setting.md
Last active June 7, 2022 13:16 — forked from inakiarroyo/multiple_ssh_setting.md
Working with multiples SSH keys

Working with multiple SSH keys

Step 1. Ensure you have an SSH client installed

ssh -V
ls -a ~/.ssh 

Step 2. Set up your identity

You can create a default identity

$ ssh-keygen 
@saurookadook
saurookadook / multiple_ssh_setting.md
Created June 6, 2022 12:29 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

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.

Command Line Generator Info

Reference

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.

@saurookadook
saurookadook / RAILS_CHEATSHEET.md
Created April 12, 2022 11:46 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before