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 / Unix.md
Last active September 4, 2024 05:19
Dev learning resources

Common knowledge everyone should know

File path

~ (tide)

~ (tide symbol) stand for home directory, this will be different depends on the current user of the current shell. For example on Linux if I logged in as userA, ~ will stand for /home/userA.

So any ~/myfolder is equivalent to /home/userA/myfolder, cd ~ will be equivalent to cd /home/userA.

For macOS the home folder path is /Users/<username>.

Please make sure you are comfortable with using ~ when change directory, remember the full home path name is very cumbersome. Any developer worth their pay need to optimize their workflow.

@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');