Skip to content

Instantly share code, notes, and snippets.

View nguyentienlong's full-sized avatar
💭
I may be slow to respond.

lk nguyentienlong

💭
I may be slow to respond.
  • Vietnam
View GitHub Profile
@nguyentienlong
nguyentienlong / string_input_sanitize_with_blue_monday.go
Last active November 18, 2022 06:02
Sanitize string in complex struct using blue monday lib
//
// this code use the idea from this https://gist.github.com/hvoecking/10772475
// list of xss payload https://github.com/payloadbox/xss-payload-list
package main
import (
"fmt"
"log"
"reflect"
@nguyentienlong
nguyentienlong / .tmux.conf
Created July 21, 2022 06:42 — forked from v-yarotsky/.tmux.conf
Mac OS X tmux config
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH
" better white space
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
let g:strip_whitespace_confirm=0
#!/bin/bash
clion() {
find ~/.config/JetBrains -mindepth 2 -maxdepth 2 -type d -wholename '*CLion*/eval' -exec rm -rf {} \;
find ~/ -mindepth 3 -maxdepth 3 -type d -wholename '*.CLion*/eval' -exec rm -rf {} \;
sed --quiet -i -E -e 's/.*<property.*evlsp.*//g' -e '/^$/d' ~/.config/JetBrains/CLion*/options/other.xml ~/.CLion*/config/options/other.xml 2>/dev/null
}
webstorm() {
find ~/.config/JetBrains -mindepth 2 -maxdepth 2 -type d -wholename '*WebStorm*/eval' -exec rm -rf {} \;
@nguyentienlong
nguyentienlong / longka_vimrc
Created February 4, 2021 03:40
My vimrc file
call plug#begin()
Plug 'fatih/vim-go'
Plug 'fatih/molokai'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'SirVer/ultisnips'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'preservim/nerdtree'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'itchyny/lightline.vim'
@nguyentienlong
nguyentienlong / main.go
Created December 1, 2020 17:45 — forked from montanaflynn/main.go
Gin request timeout middleware and handler
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@nguyentienlong
nguyentienlong / 1_wg_example.go
Last active November 23, 2020 14:08
why wait group faster than channel?
// 1_wg_example.go
package main
import (
"errors"
"fmt"
"sync"
"time"
)
@nguyentienlong
nguyentienlong / README.MD
Last active September 22, 2020 04:18
uprace - get team member stats

prerequisite

python3
requests

If your computer not install requests lib yet

@nguyentienlong
nguyentienlong / demo_optimistic_locking.go
Last active September 14, 2020 13:01
demo optimistic locking in go
/*
credit to this great article
https://www.2ndquadrant.com/en/blog/postgresql-anti-patterns-read-modify-write-cycles/
*/
package main
import (
"fmt"
"github.com/jmoiron/sqlx"
@nguyentienlong
nguyentienlong / add_swap.sh
Created September 6, 2020 06:12 — forked from mommi84/add_swap.sh
Add swap memory on Ubuntu
#!/usr/bin/env bash
#
# USAGE:
# sudo ./add_swap.sh 4G
#
# SOURCE:
# https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/
#
fallocate -l $1 /swapfile
chmod 600 /swapfile