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 / main.go
Last active August 13, 2020 02:50
Open close principle implemented in golang
// 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 August 11, 2020 09:35
Install ImageMagick's MagickWand on fedora 32
sudo yum install GraphicsMagick GraphicsMagick-devel
sudo dnf install /usr/bin/MagickWand-config
@nguyentienlong
nguyentienlong / remove_special_char_in_file_name
Created May 18, 2020 10:19
remove special char in filename
for file in *; do mv "$file" $(echo "$file" | sed -e 's/[^A-Za-z0-9._-]/_/g'); done
@nguyentienlong
nguyentienlong / index.js
Created April 24, 2020 07:07 — forked from miguelmota/index.js
Node.js Winston logger wrapper to display filename
var log = require('./lib/logger')(module);
log.info('foo');
@nguyentienlong
nguyentienlong / Instructions.sh
Created February 28, 2020 04:12 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## 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 February 28, 2020 04:05
php72 installation centos
$ 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 / gist:7b0c899fcd664e5dc78268436dc8ec8f
Created August 3, 2018 04:30
aws cli - copy and flatten nested s3 files structure
aws s3 ls source-bucket-name - recursive | grep -E "\w+\.+" | awk -F" " '{for(i=4; i<=NF; i++){printf "s3://%s", $i}; printf "\n"}' | head -n5 | xargs -I$ aws s3 cp $ s3://destination-bucket-name/
@nguyentienlong
nguyentienlong / coredns.yaml
Created October 9, 2019 18:43 — forked from rothgar/coredns.yaml
CoreDNS for Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
log stdout
health
@nguyentienlong
nguyentienlong / ecr-cred-updater.sh
Created September 29, 2019 15:44 — forked from cablespaghetti/ecr-cred-updater.sh
Automatic Updating Amazon ECR Credentials in Kubernetes
#!/bin/bash
# Get directory of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $# -ne 1 ]]
then
echo "ERROR: This script expects the namespace name to be given as an argument"
echo "e.g. ./ecr-cred-updater.sh my-namespace"
exit 1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-tutorial
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
backend:
serviceName: default-http-backend
servicePort: 80