Skip to content

Instantly share code, notes, and snippets.

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.
@nabiikaz
nabiikaz / _0__ssl_certbot_letsencrypt.md
Created November 4, 2021 13:19 — forked from maxivak/_0__ssl_certbot_letsencrypt.md
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@nabiikaz
nabiikaz / Config-dnsmasq.sh
Created April 14, 2021 16:44 — forked from kgaut/Config-dnsmasq.sh
Installation et configuration de dnsmasq pour résoudre les .test et .localhost automatiquement vers 127.0.0.1
####################
# Config dnsmasq
####################
# SEE : https://askubuntu.com/questions/1029882/how-can-i-set-up-local-wildcard-127-0-0-1-domain-resolution-on-18-04
sudo apt-get install dnsmasq
sudo vim /etc/NetworkManager/NetworkManager.conf
# Add the line dns=dnsmasq to the end of [main] section
sudo rm /etc/resolv.conf ; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
echo 'address=/test/127.0.0.1' | sudo tee /etc/NetworkManager/dnsmasq.d/dot.test-wildcard.conf
echo 'address=/localhost/127.0.0.1' | sudo tee /etc/NetworkManager/dnsmasq.d/dot.localhost-wildcard.conf
@nabiikaz
nabiikaz / interfaces.mongo-options.interface.ts
Created December 29, 2020 14:12 — forked from AliYusuf95/interfaces.mongo-options.interface.ts
MongoDB driver module for NestJS with dynamic mongo connection creation per request and handling open connections
import { ModuleMetadata, Type } from '@nestjs/common/interfaces'
/**
* Options that ultimately need to be provided to create a MongoDB connection
*/
export interface MongoModuleOptions {
connectionName?: string
uri: string
dbName: string
clientOptions?: any
@nabiikaz
nabiikaz / axios-catch-error.js
Created August 20, 2019 07:21 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨