Skip to content

Instantly share code, notes, and snippets.

View tranghaviet's full-sized avatar

Ha Viet Trang tranghaviet

View GitHub Profile
@tranghaviet
tranghaviet / launch.json
Created August 8, 2023 07:41
Nest.js debugger settings (VSCode)
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach Debug",
@tranghaviet
tranghaviet / exclude folders.py
Last active August 31, 2024 19:47
Everything exclude filters list (Tools > Options > Indexes > Exclude)
$RECYCLE.BIN
# ---- Apps ----
*.vscode\extensions*
*Discord\app-*
# ---- Windows ----
*Windows\*
#*Windows\INF*
#*Windows\SystemApps\*
*\AppData\Roaming\*
@tranghaviet
tranghaviet / install-massa-validator.sh
Last active February 7, 2023 17:14
Install Massa validator node
#!/bin/bash
sudo apt install jq -y
APP_VERSION=$(curl -s https://api.github.com/repos/massalabs/massa/releases/latest | jq -r ".tag_name")
echo "Newest version: $APP_VERSION"
LINK="https://github.com/massalabs/massa/releases/download/${APP_VERSION}/massa_${APP_VERSION}_release_linux.tar.gz"
wget -c "$LINK" -O - | tar -xz -C ./
echo "Enter staking keys password:"
@tranghaviet
tranghaviet / .zshrc
Created November 28, 2022 17:33
ZSH config with git, linux, docker... aliasas
ZSH_THEME="fletcherm"
HIST_STAMPS="dd.mm.yyyy"
HISTSIZE=10000
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
# This compose file defines an Aptos Fullnode deployment.
# Read the README.md files for instruction on how to install aptos-node
version: "3.8"
services:
fullnode:
image: "${VALIDATOR_IMAGE_REPO:-aptoslabs/validator}:${IMAGE_TAG:-testnet}"
networks:
shared:
volumes:
@tranghaviet
tranghaviet / nginxproxy.md
Created October 17, 2021 15:55 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@tranghaviet
tranghaviet / nginx-proxy
Created October 17, 2021 15:55 — forked from danielpereirabp/nginx-proxy
Nginx Proxy - SPA (Vue 2) + API/ADMIN (Laravel 5.6)
server {
listen 80;
server_name domain.com.br;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8181;
@tranghaviet
tranghaviet / install-zsh-windows-git-bash.md
Created April 13, 2021 19:59 — forked from fworks/install-zsh-windows-git-bash.md
Zsh / Oh-my-zsh on Windows Git Bash
@tranghaviet
tranghaviet / -setup-windows-wsl-devenv.md
Created April 8, 2021 01:31 — forked from leodutra/-setup-windows-wsl-devenv.md
Install and Setup Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

Setup Windows Subsystem 2 for Linux

Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

To setup native Linux, see this gist

Preview

Requirements

@tranghaviet
tranghaviet / Handler.php
Created December 16, 2020 09:21
How to custom not found message in laravel instead of "No query results for model"
public function render($request, Throwable $exception)
{
if ($exception instanceof ModelNotFoundException) {
$model = app($exception->getModel());
return \response()->json([
'message' => method_exists($model, 'notFoundMessage') ? $model->notFoundMessage() : 'Resource not found',
], 404);
}
return parent::render($request, $exception);