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
@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
View remove_special_char_in_file_name
for file in *; do mv "$file" $(echo "$file" | sed -e 's/[^A-Za-z0-9._-]/_/g'); done
@nguyentienlong
nguyentienlong / index.js
Created Apr 24, 2020 — forked from miguelmota/index.js
Node.js Winston logger wrapper to display filename
View index.js
var log = require('./lib/logger')(module);
log.info('foo');
@nguyentienlong
nguyentienlong / Instructions.sh
Created Feb 28, 2020 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
View Instructions.sh
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@nguyentienlong
nguyentienlong / php72
Created Feb 28, 2020
php72 installation centos
View php72
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum install yum-utils
$ sudo subscription-manager repos --enable=rhel-7-server-optional-rpms
$ sudo yum-config-manager --enable remi-php72
$ sudo yum update
$ sudo yum search php72 | more
$ sudo yum install php72 php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
@nguyentienlong
nguyentienlong / coredns.yaml
Created Oct 9, 2019 — forked from rothgar/coredns.yaml
CoreDNS for Kubernetes
View coredns.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
log stdout
health
You can’t perform that action at this time.