Skip to content

Instantly share code, notes, and snippets.

Thuc Le ledongthuc

Block or report user

Report or block ledongthuc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View _setup_k8s.md

OS: Ubuntu 16.04 or CentOS 7

  1. Install docker
  2. Install cri_o or containerd
  3. Install kubelet, kubeadm, kubectl
@ledongthuc
ledongthuc / Readme.md
Last active Sep 8, 2019
[Github Actions][Go] Check pull requests before merging
View Readme.md

Create template actions that's used to verify Go language pull requests before merging. It's easy to custom the flow, tools with your case.

Put pr_checker.yml or pr_checker_simple.yml to .github/workflows/ and see how it works with your pull requests. Make sure you are allows to use actions of Github.

  • pr_checker.yml is using by mine with full checking tools. It will make sure every Go langauge pull requests will be buildable, testable, passed security checking and error-able code checking.
  • pr_checker_simple.yml is more simpler with buildable, testable.

References:

@ledongthuc
ledongthuc / docker_postgres.sh
Last active Nov 23, 2019
Docker postgres actions
View docker_postgres.sh
# Docker postgres backup data
docker exec -t -e PGPASSWORD={password} {container_name} pg_dump -U {username} --column-inserts --data-only --schema={schema} {database_name} > /path/to/exported/file.sql
# Docker postgres run script from outside
docker cp /host_path.sql captrondb:/container_inside.sql
docker exec -u {login_user} {container_name} psql {database_name} {db_username} -f /container_inside.sql # with continer username
docker exec {container_name} psql {database_name} {db_username} -f /container_inside.sql # without continer username
View centos_logrotate
sudo bash -c "cat <<EOT > /etc/logrotate.d/api
/opt/app/*.log {
missingok
notifempty
compress
size 10k
daily
copytruncate
compress
sharedscripts
View centos_setup_lets_encrypt_with_certbot
sudo yum -y install yum-utils
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
sudo yum install python2-certbot-nginx
sudo certbot --nginx
View centos_setup_nginx
# NGINX
sudo yum install nginx;
sudo setsebool -P httpd_can_network_connect 1;
sudo bash -c "cat <<EOT > /etc/nginx/sites-enabled/default.conf
server {
server_name thuc.com.vn;
listen 80;
location / {
proxy_pass http://localhost:8080;
View centos_create_users
# PLEASE REPLACE <username>, <public_key>, <admin_user>
# Add new user with sudo admin
useradd -m -d /home/<username> -s /bin/bash <username>
mkdir -p '/home/<username>/.ssh/'
touch /home/<username>/.ssh/authorized_keys
echo -n "<public_key>" >> /home/<username>/.ssh/authorized_keys
chown -R <username>:<username> /home/<username>/.ssh
View LC_CTYPE
# warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
sudo bash -c "cat <<EOT > /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
EOT"
View install_kafka.sh
sudo yum install java-1.8.0-openjdk
mkdir /tmp/install_kafka
cd /tmp/install_kafka
curl http://www-eu.apache.org/dist/kafka/1.1.0/kafka_2.11-1.1.0.tgz --output kafka_2.11-1.1.0.tgz
mkdir -p /opt/
cp /tmp/install_kafka/kafka_2.11-1.1.0.tgz /opt/kafka_2.11-1.1.0.tgz
cd /opt/
tar -xzf kafka_2.11-1.1.0.tgz
ln -s /opt/kafka_2.11-1.1.0 /opt/kafka
cd /opt/kafka/
View .vimrc
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
You can’t perform that action at this time.