Skip to content

Instantly share code, notes, and snippets.

@nhahv
nhahv / install.sh
Last active July 9, 2022 04:55
Oh My ZSH Installation
#!/bin/sh
verlte() {
if [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]; then
return 1
else
return 0
fi
}
OS=
@nhahv
nhahv / settings.json
Created April 6, 2022 07:08
VSCode - CygWin - Zsh (Enter current folder)
{
//Enter current folder to ZSH
"terminal.integrated.env.windows": {
"CHERE_INVOKING": "1"
},
"terminal.integrated.profiles.windows": {
"Cygwin": {
"env": {
"CHERE_INVOKING": "1" //(Not working)
},
// 🔴 Error
var hasBarProperty = foo.hasOwnProperty("bar");

// 🟢 Correct 
var hasBarProperty = Object.prototype.hasOwnProperty.call(foo, "bar");
@nhahv
nhahv / redux-saga-typeguard.ts
Created October 21, 2021 04:41 — forked from NoriSte/redux-saga-typeguard.ts
Redux-saga + Typescript: implementing typeguard for Axios AJAX requests
import { AxiosResponse } from "axios";
// the kind of data I expect from the AJAX request...
interface AuthData {
access_token?: string;
refresh_token?: string;
}
// ... a type dedicated to the Axios response...
type AuthResponse = AxiosResponse<AuthData>;
@nhahv
nhahv / Enable snaps on CentOS.md
Last active September 24, 2021 11:15
[Centos] Centos bash libraries #centos #bash #zsh

Enable snaps on CentOS

sudo yum install -y epel-release
sudo yum install -y snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Usage

@nhahv
nhahv / Cygwin.md
Last active September 23, 2021 11:02
Bash

CYGWIN

"c:\cygwin64\bin\sh" -lic "cd ${OLDPWD-.}; zsh"

@nhahv
nhahv / Emoji.md
Last active September 17, 2021 08:46
Favorites

🐞 🍀 🌻 🌼 ⚽ 🏀 🚩🎯 🏁 🏴 🚩 🪐
Weahter ⛅ ☔ 🌂 🌀 🌈 🌍 🌎 🌏 🏭 🏡 ⛪ 🕋 🎪 🎡 🏰 🌄 🌌 🌊 🗻 🌋 Sign 🛑 ⛔ 🚫 🚸 ⛽ 🚥 🚦 🚧 🚨 ⚡ 🚹 🚺 🚻 🚼 🛵 🚗 🚘 🚚 🚛 🚐 🚀 Things 💎 💍 🎀 🔔 ⏰ ⌚ ⌛ 🔑 🔏 🔐 🔒 🔓 🎨 💣 🧨 🎁 🎂 🎫 🎬 🧴 💊 🩸 💉 🩹 🧪 🧫 🔧 🔨 ⛏ 🪓 🧱 🧰 🧲 🪁 🧩 🧯 Tech 📷 📸 📱 📞 📢 📺 📻 💻 🎮 📀 💽 💿 💾 🔋 🔌

@nhahv
nhahv / Expose LoadBalancer Service.md
Last active September 16, 2021 10:01
[Kubenetes] Kubenetes Setup #k8s #setup

Expoise LoadBalancer Service

kubectl --namespace default get service


#NAME                                TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
#kubernetes                          ClusterIP      10.96.0.1       <none>        443/TCP                      19h
#nginx-ingress-xxx                   LoadBalancer   10.102.23.116   <pending>     80:30199/TCP,443:30207/TCP   3m27s
#nginx-ingress-xxx-default-backend   ClusterIP      10.100.69.157   <none>        80/TCP                       3m27s
@nhahv
nhahv / webmin-install.md
Last active September 15, 2021 04:22
Webmin

#Install Webmin on Centos 7

Reference [^ref]

cat <<EOF >> /etc/yum.repos.d/webmin.repo
[Webmin]
@nhahv
nhahv / settings.json
Created August 28, 2021 05:07
My VSCode Settings for Next.JS
{
"adobeScriptRunner.winPhotoshopExe": "C:/Program Files/Adobe/Adobe Photoshop 2020/Photoshop.exe",
"blockman.n03MaxDepth": 20,
"blockman.n05CustomColorOfDepth0": "none",
"blockman.n06CustomColorOfDepth1": "none",
"blockman.n07CustomColorOfDepth2": "none",
"blockman.n08CustomColorOfDepth3": "none",
"blockman.n09CustomColorOfDepth4": "none",
"blockman.n10CustomColorOfDepth5": "none",
"blockman.n11CustomColorOfDepth6": "none",