Skip to content

Instantly share code, notes, and snippets.

View aeros281's full-sized avatar

Trần Lê Tuấn Anh aeros281

View GitHub Profile
@aeros281
aeros281 / 0.README.md
Last active July 2, 2024 10:40
Multiple github accounts using SSH keys

Here is the general step requires to automatically switch to different accounts of GitHub based on the current working directory:

  1. Create a different set of private-public key using ssh-keygen command.
  2. Add the new public key to the other Github account's SSH keys.
  3. If there's no ~/.gitconfig file presented, create a new file with content that will be described in later section.
  4. Create extend config for git that will only applied when go to a specific folder, the content will be described in later section.
  5. Clone the fork repository, then add new remote using git remote add command.
@aeros281
aeros281 / decorators.py
Last active May 19, 2022 02:05
Django Auth0
import jwt
from functools import wraps
# Create your views here.
def get_token_auth_header(request):
"""Obtains the access token from the Authorization Header
"""
auth = request.META.get("HTTP_AUTHORIZATION", None)
var jwt = require('jsonwebtoken');
var UnauthorizedError = require('./errors/UnauthorizedError');
var unless = require('express-unless');
var async = require('async');
var set = require('lodash.set');
var DEFAULT_REVOKED_FUNCTION = function(_, __, cb) { return cb(null, false); };
module.exports = function(options) {
if (!options || !options.secret) throw new Error('secret should be set');