Skip to content

Instantly share code, notes, and snippets.

View remove-mdm.sh
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/;
@hungdh0x5e
hungdh0x5e / go-validator-2.go
Last active May 9, 2020
Custom gin validator error message
View go-validator-2.go
// 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)
@hungdh0x5e
hungdh0x5e / go-validator.go
Created May 9, 2020
Go-validator custom error message (option 1)
View go-validator.go
// Usage, in controller or validate struct
err := ctx.ShouldBindJSON(&request)
if err != nil {
for _, fieldErr := range err.(validator.ValidationErrors) {
fmt.Println("error", fieldErr)
vgin.BuildErrorResponse(ctx, verrors.NewInvalidRequestFormatError(errors.New(validation.FieldError{fieldErr}.String())))
return // exit on first error
}
}
@hungdh0x5e
hungdh0x5e / idea_action.txt
Created Apr 12, 2020
Intellij action list
View idea_action.txt
-- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
View full_text_search_with_postgresql_rails.rb
# STEP 1
class AddSearchTextToLeads < ActiveRecord::Migration[5.2]
def change
change_table :leads, bulk: true do |t|
t.tsvector :search_text
end
add_index :leads, :search_text, using: :gin
end
end
@hungdh0x5e
hungdh0x5e / .zshrc
Created Jan 4, 2019
configuration oh-my-zsh
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export ANDROID_HOME=/Users/hungdh/Library/Android/sdk
export ANDROID_SDK=/Users/hungdh/Library/Android/sdk
export ANDROID_NDK=/Users/hungdh/Library/Android/ndk-r10e
export LC_ALL='en_GB.UTF-8'
# Path to your oh-my-zsh installation.
export ZSH=/Users/hungdh/.oh-my-zsh
POWERLEVEL9K_MODE='awesome-patched'
View iterm2_profile.json
{
"Right Option Key Sends" : 0,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408,
"Blue Component" : 1
},
@hungdh0x5e
hungdh0x5e / .vimrc
Created Jan 4, 2019
configuration for vim
View .vimrc
" ============= BEGIN BASIC CONFIGURATION =============
set nocompatible
set number
syntax on
filetype plugin indent on
filetype on
filetype indent on
filetype plugin on
set clipboard=unnamed
set backspace=indent,eol,start
View bookTicket.js
var url;
$(function () {
url = $("#url").val();
$(".submitChooseSeat").on("click", function (event) {
var checkFlag = true;
if (checkFlag == true) {
submitChooseSeat(event);
@hungdh0x5e
hungdh0x5e / 00.md
Created Jan 11, 2018 — forked from maxivak/00.md
Sending emails with ActionMailer and Sidekiq
View 00.md

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual: