Skip to content

Instantly share code, notes, and snippets.

View tiendungdev's full-sized avatar

Tien Dung Dao tiendungdev

View GitHub Profile
@minhazulOO7
minhazulOO7 / 0-Cloudflare DDNS using Bash Script with Crontab or Systemd Timer-readme.md
Last active April 23, 2022 01:23
Cloudflare Client API v4 DDNS IP Update Using Bash Script (IPv4/ IPv6)

Cloudflare DDNS using Bash Script with Crontab/ Systemd Timer

This script will check if external IP is changed or not and will update the external IP of A or AAAA record in Cloudflare DNS using API token/ global API key method.

Script Requirements

@bouroo
bouroo / 60-sysctl.conf
Last active June 15, 2025 13:37
Kernel tuning for dedicated linux server. /etc/sysctl.d/60-sysctl.conf
# /etc/sysctl.d/60-sysctl.conf
# Generic Web + DB Server Tuning
# Based on original by Kawin Viriyaprasopsook <[email protected]>
# Apply with: sysctl --system
########################
# Kernel & Memory
########################
# Reduce console noise from kernel messages
kernel.printk = 3 4 1 3
@bouroo
bouroo / cloudflare-add-dns.sh
Last active August 15, 2024 03:42
Cloudflare bash add Sites/DNS record
#!/usr/bin/env bash
# Require curl & jq
hash curl 2>/dev/null || { echo >&2 "I require 'curl' but it's not installed. Aborting."; exit 1; }
hash jq 2>/dev/null || { echo >&2 "I require 'jq' but it's not installed. Aborting."; exit 1; }
# Get domain list
read -e -i 'domains.csv' -p 'Domain list file: ' DOMAIN_FILE
read -e -i 'y' -p 'CF Proxy [Y/n]: ' CF_PROXY
if [[ ${CF_PROXY} =~ ^([yY][eE][sS]|[yY])+$ ]]
@holmberd
holmberd / php-pools.md
Last active April 29, 2025 08:29
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@bjornjohansen
bjornjohansen / maintenance.php
Created August 31, 2017 11:57
Custom WordPress maintenance mode page
<?php
wp_load_translations_early();
$protocol = wp_get_server_protocol();
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 30' );
?>
<!DOCTYPE html>
<html>
@bouroo
bouroo / swap.sh
Last active June 15, 2025 14:24
Create swap on VPS
#!/usr/bin/env bash
#==============================================================================
# title: swap.sh
# description: This script automatically creates a swap size that's 20% of total RAM
# and comments out the old swap device in /etc/fstab.
# author: Kawin Viriyaprasopsook <[email protected]>
# usage: bash swap.sh
# notes: need `sudo dd sed` packages
#==============================================================================
@keesiemeijer
keesiemeijer / wp-update
Last active April 7, 2025 20:14
A bash script to update everything WordPress (core, plugins, themes and comments).
#!/usr/bin/env bash
# =============================================================================
#
# *** WARNING: THIS SCRIPT IS NO LONGER MAINTAINED ***
#
# use https://github.com/keesiemeijer/wp-update instead
#
# =============================================================================
/**
* My Account
*/
.woocommerce-account .woocommerce-MyAccount-navigation {
width: 20%;
}
.woocommerce-account .woocommerce-MyAccount-content {
display: inline-block;
@wpexplorer
wpexplorer / gist:a3f58b5f32026e7fb106
Created February 24, 2016 20:22
Total theme custom archive.php template file example
<?php
/* Example custom archive template file */
// Get header
get_header(); ?>
<div id="content-wrap" class="container clr">
<?php wpex_hook_primary_before(); ?>
@fevangelou
fevangelou / my.cnf
Last active June 6, 2025 04:40
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated September 2024 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#