Skip to content

Instantly share code, notes, and snippets.

View dipakyadav's full-sized avatar
💭
Open for opportunities

Dipak Yadav dipakyadav

💭
Open for opportunities
View GitHub Profile
>>> from pymongo import MongoClient
>>> client = MongoClient("mongodb+srv://kay:password@clustername.mongodb.net/test?retryWrites=true")
>>> db = client.test_database
>>> collection = db.test_collection
>>> import datetime
>>> post = {"author": "Mike", "text": "My first blog post!", "tags": ["mongodb", "python", "pymongo"], "date": datetime.datetime.utcnow()}
>>> posts = db.posts
>>> post_id = posts.insert_one(post).inserted_id
>>> post_id
ObjectId('5b2070f157a2f413b5d6c668')
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active August 28, 2024 17:26
Using multiple github accounts with ssh keys

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.