Skip to content

Instantly share code, notes, and snippets.

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

Nguyen Thanh Nguyen (Andy) ntnguyencse

💭
I may be slow to respond.
  • @juyoutech
  • Ho Chi Minh
  • 08:28 (UTC +07:00)
View GitHub Profile
@ntnguyencse
ntnguyencse / docker-compose.yml
Created July 24, 2024 07:32 — forked from kizzx2/docker-compose.yml
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@ntnguyencse
ntnguyencse / HOWTO.md
Created January 24, 2024 05:55 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@ntnguyencse
ntnguyencse / graph.py
Last active January 18, 2024 13:30
graph
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt
t1 = np.arange(0, 30)
mask_start = len(t1)
t2 = np.arange(34, 103)
t = np.concatenate([t1, t2])
emco = []
for x in range(1,100):
@ntnguyencse
ntnguyencse / a.sh
Created January 4, 2024 08:00
connect-to-mysql-Pod
# Connect to MYSQL Database
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -pdbpassword11
# Verify usermgmt schema got created which we provided in ConfigMap
mysql> show schemas;
title Engineering Blogs
published true
description
tags engineering, learning
cover_image

I'm always interested in learning, especially around my roles in engineering and leadership.

@ntnguyencse
ntnguyencse / UpdateFileGithub.go
Created November 2, 2023 08:15
Create or Update File on Github
package main
import (
"context"
"fmt"
github "github.com/google/go-github/v56/github"
)
type GitCOnfig struct {
curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
tar -xf vscode_cli.tar.gz
code tunnel
code tunnel service install
sudo cp ~/.vscode/cli/code-tunnel.service /etc/systemd/system/
systemctl --user daemon-reload
systemctl --user enable code-tunnel.service
systemctl --user status
@ntnguyencse
ntnguyencse / kubernetes1.28.sh
Created August 31, 2023 02:47 — forked from saiyam1814/kubernetes1.28.sh
kubernetes1.28.sh
echo "step1- install kubectl,kubeadm and kubelet 1.28.0"
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "kubeadm install"
sudo apt update -y
sudo apt -y install vim git curl wget kubelet=1.28.0-00 kubeadm=1.28.0-00 kubectl=1.28.0-00
echo "memory swapoff"
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
@ntnguyencse
ntnguyencse / kubernetes1.27.sh
Created August 31, 2023 02:47 — forked from saiyam1814/kubernetes1.27.sh
kubernetes1.27.sh
echo "step1- install kubectl,kubeadm and kubelet 1.27.1"
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "kubeadm install"
sudo apt update -y
sudo apt -y install vim git curl wget kubelet=1.27.1-00 kubeadm=1.27.1-00 kubectl=1.27.1-00
echo "memory swapoff"
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab