Skip to content

Instantly share code, notes, and snippets.

View latuminggi's full-sized avatar

Aprillio Latuminggi latuminggi

View GitHub Profile
@latuminggi
latuminggi / Add a Disk to Expand Storage of Existing LVM
Last active November 20, 2024 03:59
Add a Disk to Expand Storage of Existing LVM
### This walkthrough has been tested on Ubuntu Linux 22.04 LTS for xfs filesystem
### Reference: https://www.cyberciti.biz/faq/howto-add-disk-to-lvm-volume-on-linux-to-increase-size-of-pool
# df -h | grep -v tmpfs
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG_SERVER-LV_ROOT 45G 7.9G 38G 18% /
/dev/sda2 974M 374M 533M 42% /boot
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
@latuminggi
latuminggi / Informative Linux Terminal with Horizontal Separator
Last active November 4, 2023 03:51
Informative Linux Terminal with Horizontal Separator
### This bash script below has been tested on Oracle Linux 8
### Put these 3 lines in the bottom file of your ~/.bashrc
export SERVER_NAME="[MyServerName] "
export PS0='\[\e[1;33m\]└─ exec @ \D{%F %T%z} $(eval printf %.0s─ '{36..'"${COLUMNS:-$(tput cols)}"\}; echo)\[\e[m\]\n'
export PS1="\n\[\e[1;33m\]┌$(eval printf %.0s─ '{2..'"${COLUMNS:-$(tput cols)}"\}; echo)\n├─ \h ($(eval hostname -I|cut -f1 -d' ')) ${SERVER_NAME}@ \w\n├─ \[\e[1;36m\]\u \\$\[\e[m\] "
### Adjust env SERVER_NAME, save and execute command below
$ source ~/.bashrc
@latuminggi
latuminggi / GMapsDECtoDMS.php
Last active February 10, 2022 13:45
Convert Decimal degrees (DEC) to Degrees, minutes, and seconds (DMS) for Google Maps (bonus Embed URL)
function GMapsDECtoDMS($latitude, $longitude) {
// $latitude and $longitude must be a float value
// e.g. National Monument (-6.175413294875829, 106.82718181252345)
$latitudeDirection = $latitude < 0 ? 'S': 'N';
$longitudeDirection = $longitude < 0 ? 'W': 'E';
$latitudeNotation = $latitude < 0 ? '': '';
$longitudeNotation = $longitude < 0 ? '': '';
@latuminggi
latuminggi / nginx http upstream with fallback
Last active September 3, 2021 09:01
nginx http upstream with fallback if upstream return http error page
### nginx http upstream with fallback if upstream return http error page ###
### https://www.digitalocean.com/community/tools/nginx
# upstream members of soa
upstream soa {
server 11.22.33.41:1234 max_fails=1 fail_timeout=1m;
server 11.22.33.42:1234 max_fails=1 fail_timeout=1m;
server 11.22.33.43:1234 max_fails=1 fail_timeout=1m backup;
server 11.22.33.44:1234 max_fails=1 fail_timeout=1m backup;
}
@latuminggi
latuminggi / Disable weak SSH ciphers in Linux
Last active April 16, 2025 13:37
Disable weak SSH ciphers in Linux
### Disable weak SSH ciphers in Linux ###
# check ssh ciphers, macs, and kexalgorithms
sshd -T | grep "\(ciphers\|macs\|kexalgorithms\)"
# edit sshd_config
nano /etc/ssh/sshd_config
# add following conf lines into most bottom of sshd_config file
Ciphers [email protected],[email protected],aes256-ctr,aes128-ctr
@latuminggi
latuminggi / Disable ICMP Timestamp Response Ubuntu LTS
Created July 27, 2021 09:54
Disable ICMP Timestamp Response Ubuntu LTS
### Disable ICMP Timestamp Response Ubuntu LTS ###
# sysctl disable tcp_timestamps
echo 0 > /proc/sys/net/ipv4/tcp_timestamps && \
echo "net.ipv4.tcp_timestamps = 0" > /etc/sysctl.d/tcp_timestamps.conf && \
sysctl -p && \
sysctl -a | grep "net\.ipv4\.tcp_timestamps"
# open icmp to specified segment
iptables -A INPUT -s 10.10.0.0/16 -p icmp -m icmp --icmp-type 8 -j ACCEPT
@latuminggi
latuminggi / Updating glibc, libstdc++, and gcc on RHEL (CentOS) 6
Last active July 21, 2021 07:08
Updating glibc, libstdc++, and gcc on RHEL / CentOS 6
### Updating glibc, libstdc++, and gcc on RHEL / CentOS 6 ###
# https://code.visualstudio.com/docs/remote/linux#_updating-glibc-and-libstdc-on-rhel-centos-6
# https://serverkurma.com/linux/how-to-update-glibc-newer-version-on-centos-6-x/
# https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174
# https://copr.fedorainfracloud.org/coprs/mosquito/myrepo-el6/
# WARNING !!!
# Do not run this script on anything mission critical without a rollback strategy
# since it does update libraries that other applications depend on.
@latuminggi
latuminggi / COMPILE NGINX 1.20.1 RHEL (CentOS?) 6
Last active July 23, 2021 14:34
COMPILE NGINX 1.20.1 RHEL/(CentOS?) 6
### COMPILE NGINX 1.20.1 RHEL/(CentOS?) 6 ###
# installing dependencies
yum install git yum-utils gcc gcc-c++ pcre-devel zlib-devel make unzip libuuid-devel \
openssl-devel libxml2-devel libxslt-devel libgcrypt-devel libgpg-error-devel \
pcre pcre-devel geoip-devel cpp gd-devel
# install glibc
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm \
https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm \
@latuminggi
latuminggi / COMPILE PHP 8.0 RHEL (CentOS?) 6
Last active May 29, 2024 16:26
COMPILE PHP 8.0 RHEL/(CentOS?) 6
### COMPILE PHP 8.0 RHEL/(CentOS?) 6 ###
# You can find PHP 8.0 repository here:
# https://pkgs.dyn.su/el6-extras/x86_64
# installing dependencies
# https://coderwall.com/p/ggmpfa/php-configuration-error-and-solutions-in-rpm
yum install -y autoconf autotools gmp-devel libcurl-devel postgresql postgresql-devel sqlite sqlite-devel \
libxslt-devel net-snmp-devel readline-devel aspell aspell-devel unixODBC-devel libicu-devel libc-client-devel \
freetype-devel libXpm-devel libpng-devel libvpx-devel enchant-devel libmcrypt-devel libmemcached-devel \
@latuminggi
latuminggi / Install Let's Encrypt with ACME.sh in Nginx
Last active August 19, 2021 01:39
Install Let's Encrypt with ACME.sh in Nginx
### Install Let's Encrypt with ACME.sh in Nginx ###
# clone acme (as root)
git clone https://github.com/acmesh-official/acme.sh.git && \
cd acme.sh && \
./acme.sh --install -m [email protected]
# create cert ----------------------------------------------------------------------
# acme.sh is an alias for /root/.acme.sh/acme.sh