Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

long nguyen nguyentienlong

💭
I may be slow to respond.
View GitHub Profile
View jetbrains-reset-eval.sh
#!/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 {} \;
View longka_vimrc
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'
View gist:449d8fd87f0bcd1d76db4c9d688a5ccd
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCy0QsGcPYRe/ra7ghxewlecR05EAIAVGvaNGaBFD0gtL5+YHW1TUTnmMcIMPuh5DSIuGn7fyMhh9+WSsnF/tTrgG3VZQ0Pp5ZUxf9Ub99GXBQ+HhB2/Cf7C80Kh5AaxbjB8ObWn6cdn5yUrbNrrrF1OcmkU7Vj8VIguqnqLhWA/xz49mh3HM40UfRfc5z9q/Z02JshGij2HHvGLNujj+aShbaDYpHUhy5pPYaC/aafDJQMdZ1Ix07hQCc1u5ECs/b6MYQ5YJxG0M4Bzg7NjZI38UbKvBmL1N0MZ0jfQw4VUdnb7+XFGKy2Cqx9gprBwEiQmK4kFNp6bFL39LS0NIaNWig4QUj20PyDnJAf5HscmYVIuf74/A+XmFzTDkX0WwOQ6sHeo46piYmMFEVwrU6U6iAQyZnkAUwliIndt4iCnJTcaQ8iGGwKrjq9HiNK3EmgcbDBZ9oVm8P789cpLqx5rdwpZDqyARwRsozbzHh9kwB5dF3jSOh95HZHAdp5T/c= longka@Longs-MacBook-Pro.local
@nguyentienlong
nguyentienlong / main.go
Created Dec 1, 2020 — forked from montanaflynn/main.go
Gin request timeout middleware and handler
View main.go
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@nguyentienlong
nguyentienlong / 1_wg_example.go
Last active Nov 23, 2020
why wait group faster than channel?
View 1_wg_example.go
// 1_wg_example.go
package main
import (
"errors"
"fmt"
"sync"
"time"
)
@nguyentienlong
nguyentienlong / README.MD
Last active Sep 22, 2020
uprace - get team member stats
View README.MD

prerequisite

python3
requests

If your computer not install requests lib yet

@nguyentienlong
nguyentienlong / demo_optimistic_locking.go
Last active Sep 14, 2020
demo optimistic locking in go
View demo_optimistic_locking.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 Sep 6, 2020 — forked from mommi84/add_swap.sh
Add swap memory on Ubuntu
View add_swap.sh
#!/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
@nguyentienlong
nguyentienlong / main.go
Last active Aug 13, 2020
Open close principle implemented in golang
View main.go
// https://longka.info/blog/2020/08/13/solid-open-close-principle-implemented-in-golang/
package main
import (
"fmt"
"math"
)
type Shape interface {
@nguyentienlong
nguyentienlong / install.sh
Created Aug 11, 2020
Install ImageMagick's MagickWand on fedora 32
View install.sh
sudo yum install GraphicsMagick GraphicsMagick-devel
sudo dnf install /usr/bin/MagickWand-config