Skip to content

Instantly share code, notes, and snippets.

View oanhnn's full-sized avatar
🇻🇳

Oanh Nguyen oanhnn

🇻🇳
View GitHub Profile
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 2, 2024 08:41
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.

Keybase proof

I hereby claim:

  • I am oanhnn on github.
  • I am oanhnn (https://keybase.io/oanhnn) on keybase.
  • I have a public key ASBz46P9m49f_0yO5K2NGtyVdTIOlUErX1eGVu1ZhavbmQo

To claim this, I am signing this object:

@oanhnn
oanhnn / crontab -e
Last active March 8, 2024 05:22
Scripts for gitlab and gitlab runner
# Clear Gitlab runner cache (docker) weekly at 17:05 on Saturday (UTC)
5 17 * * 6 sudo /usr/share/gitlab-runner/clear-docker-cache prune-volumes >/dev/null 2>&1
@oanhnn
oanhnn / input-range.scss
Created May 17, 2018 09:24
Styling Cross-Browser Compatible Range Inputs with Sass
// Styling Cross-Browser Compatible Range Inputs with Sass
// Github: https://github.com/darlanrod/input-range-sass
// Author: Darlan Rod https://github.com/darlanrod
// Version 1.4.1
// MIT License
$track-color: #eceff1 !default;
$thumb-color: #607d8b !default;
$thumb-radius: 12px !default;
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana (*)
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@oanhnn
oanhnn / myip.sh
Created July 19, 2023 02:45
Show My IP on MacOS
#!/bin/bash
echo "Public IP:" $(curl -s ifconfig.me)
echo "Private IP:"
echo "- en0:" $(ipconfig getifaddr en0 || echo 'Not connected')
echo "- en5:" $(ipconfig getifaddr en5 || echo 'Not connected')
@oanhnn
oanhnn / how_to.md
Created May 14, 2017 16:47
How to fix composer error "Content-Length Mismatch"

First, run:

$ composer config --list --global        //this will get the composer home path.
[home] /root/.composer                   //it's my composer home path.

And then, edit the config.json in [home] directory, make it like this:

{
  "config": {
 "github-protocols": [
@oanhnn
oanhnn / bash-cheatsheet.sh
Created May 31, 2017 01:40 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@oanhnn
oanhnn / remove-vhost.sh
Last active November 21, 2020 23:11
[Ubuntu 16.04] Setup server using NGINX proxy multi site with SSL (Certbot)
#!/usr/bin/env bash
DOMAIN=${1:-example.local}
APP_SLUG=${2:-example}
service nginx stop
rm -rf /etc/nginx/sites-available/10-${APP_SLUG}.conf /etc/nginx/sites-enabled/10-${APP_SLUG}
echo "[✔] Remove Virtual Host for ${DOMAIN}"
@oanhnn
oanhnn / js.code-workplace
Last active August 27, 2019 09:52
VSCode settings
{
"folders": [
{
"path": "..."
}
],
"settings": {
"emmet.includeLanguages": {
"javascript": "html",
"vue": "html",