Skip to content

Instantly share code, notes, and snippets.

View trinhpham's full-sized avatar
🇻🇳
A lot of things here 👯‍♂

Trình Phạm trinhpham

🇻🇳
A lot of things here 👯‍♂
View GitHub Profile
@trinhpham
trinhpham / upgrade.sh
Created September 5, 2023 10:49
moodle upgrade
#!/bin/bash
# 0. Turn on mainternance mode then SSH to server
# 1. Switch to account `prod_onlinetraining`, using onlinetraining password
sudo su prod_onlinetraining
# 2. Move to moodle folder
cd ~/public_html/
# 2.2. Turn off cron job then wait for all cronjob finish
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: lhci-forwarder
spec:
entryPoints:
- web
- websecure
routes:
- kind: Rule
@trinhpham
trinhpham / download.js
Created September 10, 2021 07:07
Download file from URL with pure JJS (jre javascript)
#!/usr/bin/env jjs
var url = new java.net.URL("https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz");
var inStream = new java.io.BufferedInputStream(url.openStream());
var fileOutputStream = new java.io.FileOutputStream("openjdk-11.tar.gz");
inStream.transferTo(fileOutputStream);
@trinhpham
trinhpham / update_mirror.sh
Created August 29, 2021 11:33
Update ubuntu mirror
#!/bin/bash
sudo sed -i 's/http\:\/\/security.ubuntu.com\/ubuntu/mirror\:\/\/mirrors.ubuntu.com\/mirrors.txt/' /etc/apt/sources.list
sudo sed -i 's/http\:\/\/extras.ubuntu.com\/ubuntu/mirror\:\/\/mirrors.ubuntu.com\/mirrors.txt/' /etc/apt/sources.list
sudo sed -i 's/http\:\/\/.*archive.ubuntu.com\/ubuntu/mirror\:\/\/mirrors.ubuntu.com\/mirrors.txt/' /etc/apt/sources.list
@trinhpham
trinhpham / hello-ingress.yaml
Last active April 16, 2022 04:51
Kube Cluster deployment test
kind: Service
apiVersion: v1
metadata:
name: hello
labels:
app: hello
spec:
type: ClusterIP
ports:
- protocol: TCP
@trinhpham
trinhpham / gist:b90f4b2741f01948f9165a13a0cfd986
Last active January 9, 2021 09:22
GlusterFS & NFS Ganesha on Centos 8
echo fastestmirror=1 >> /etc/dnf/dnf.conf
dnf update -y
dnf install centos-release-gluster centos-release-nfs-ganesha30 hostname -y
dnf install glusterfs-server nfs-ganesha nfs-ganesha-gluster -y
systemctl enable --now glusterd
mkdir -p /data/gnfs
@trinhpham
trinhpham / gist:b24e74c4d5e1e141027f5ece838fe0b8
Last active December 12, 2020 17:46
NFS over GlusterFS
https://blogs.oracle.com/linux/migrate-nfs-to-glusterfs-and-nfs-ganesha
mkdir -p /data/gnfs
gluster volume create gnfs db1:/data/gnfs force
gluster volume start gnfs
gluster volume info gnfs
gluster volume status
gluster volume add-brick gnfs replica 2 db2:/data/gnfs force
mkdir /etc/ganesha/exports
#Uninstall old installation
sudo minikube delete --all=true --purge=true
sudo rm -rf ~/.kube
sudo rm -rf ~/.minikube
sudo rm -rf /var/lib/minikube
sudo rm -rf /var/lib/kubelet
sudo rm -rf /var/lib/localkube
sudo rm -rf /data/minikube
sudo rm -rf /var/lib/kubeadm.yaml
rm -rf .*kube
Checking for Perl...found Perl at /usr/bin/perl
Checking for HTTP client...found /usr/bin/wget -nv
[2020-05-22 09:10:57 UTC] [DEBUG] Memory is greater than 1024 MB, which should be sufficient.
[2020-05-22 09:10:57 UTC] [INFO] Started installation log in /root/virtualmin-install.log
[2020-05-22 09:10:57 UTC] [DEBUG] Phase 1 of 3: Setup
[2020-05-22 09:10:57 UTC] [DEBUG] Install mode: minimal
[2020-05-22 09:10:57 UTC] [DEBUG] Product: Virtualmin GPL
[2020-05-22 09:10:57 UTC] [DEBUG] install.sh version: 6.1.1
[2020-05-22 09:10:57 UTC] [DEBUG] Checking for fully qualified hostname...
[2020-05-22 09:10:57 UTC] [DEBUG] Setting hostname to s2.mydomain.com
[HTTP] --> GET /wd/hub/session/381d990a-9003-42a9-996b-030c490ad215/contexts
[HTTP] {}
[debug] [W3C (381d990a)] Calling AppiumDriver.getContexts() with args: ["381d990a-9003-42a9-996b-030c490ad215"]
[debug] [XCUITest] Executing command 'getContexts'
[debug] [iOS] Getting list of available contexts
[debug] [iOS] Retrieving contexts and views
[debug] [XCUITest] Selecting by url: false
[debug] [RemoteDebugger] Sending connection key request
[debug] [RemoteDebugger] Sending '_rpc_reportIdentifier:' message (id: 1)
[debug] [RemoteDebugger] Sending to Web Inspector took 6ms