Skip to content

Instantly share code, notes, and snippets.

View hungdh9x's full-sized avatar
:octocat:
Not Found

Huy Hùng hungdh9x

:octocat:
Not Found
View GitHub Profile
@hungdh9x
hungdh9x / go-validator-2.go
Last active May 9, 2020 09:58
Custom gin validator error message
// Before init Gin
err := validation.InitValidator()
// In controller or struct validate
err := ctx.ShouldBindJSON(&request)
if err != nil {
for _, fieldErr := range err.(validator.ValidationErrors) {
errMsg := errors.New(fieldErr.Translate(validation.CustomTranslator))
vlog.Error(vgin.GetAppContext(ctx), "Failed to bind request body", errMsg)
csrutil authenticated-root disable;
diskutil mount /Volumes/Macintosh\ -\ Data;
Mount -uv /Volumes/Macintosh\ -\ Data;
cd /Volumes/Macintosh\ -\ Data/System/Library/LaunchAgents;
mkdir tmp;
mv com.apple.ManagedClientAgent.* tmp/;
mv com.apple.mdmclient.* tmp/;
cd ../LaunchDaemons;
mkdir tmp;
mv com.apple.ManagedClient.* tmp/;
@hungdh9x
hungdh9x / ideavimrc.vim
Created February 24, 2023 04:47
Idea vimrc
" Plugin
set easymotion
set surround
set multiple-cursors
set commentary
let mapleader=' '
set hlsearch
set incsearch
@hungdh9x
hungdh9x / initial.sh
Last active May 27, 2025 16:38
VPS setup
#!/bin/bash
# VPS Security Hardening Script for Ubuntu/Debian
# Author: Security Engineer
# Description: Automated security setup for new VPS on Vultr
set -euo pipefail
# Colors for output
RED='\033[0;31m'