Skip to content

Instantly share code, notes, and snippets.

Taking a break from development projects to focus other things

James Deathe jdeathe

Taking a break from development projects to focus other things
View GitHub Profile
jdeathe /
Last active Mar 23, 2021
Debug RSyslog on RHEL, CentOS, Oracle Linux (el7/el8 platform)
jdeathe / cloud-config-docker-el7.yml
Last active Apr 6, 2021
Cloud-Init user-data to install Docker on CentOS-7
View cloud-config-docker-el7.yml
timezone: "UTC"
- path: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"
permissions: "0644"
owner: "root:root"
content: |
jdeathe / php-curl-status.php
Last active Feb 8, 2019
Basic health status check using PHP curl
View php-curl-status.php
$responseCode = 500;
$responseCodeOk = 200;
$responseCodeFail = 503;
$url = '';
$ch = curl_init();
jdeathe /
Last active Oct 2, 2018
Linux / Simple File List for Review

Generate a File Listing for Review


  • Last Modified
  • Size (bytes)
  • Relative Path


Replace {{search-path}} with the path to search.

jdeathe /
Last active Sep 25, 2018
Identify PHP FastCGI Process Memory Usage

Identify PHP FastCGI Process Memory Usage

pmap -x $(ps ax \
  | grep php-cgi \
  | grep -v grep \
  | awk '{ print $1 }' \
  | awk -v RS='' '{ gsub("\n", " "); print; }'\
) | grep -E '^(Address|total)'
jdeathe /
Last active Jul 20, 2018
How to Enable MySQL Query Logging at Runtime

How to Enable MySQL Query Logging at Runtime

From the mysql client run:

mysql> SET GLOBAL general_log=true;
mysql> SET GLOBAL general_log_file='general.log';

After this queries will be logged to the named file located in the MySQL data directory. e.g. /var/lib/mysql/general.log.

jdeathe /
Created Jun 8, 2018
Identify Unavailable IUS Packages Between PHP 5.6 and 7.1

Identify Unavailable IUS PHP Packages Between 5.6 and 7.1

For all installed packages prefixed with php56u, check for availability php71u package.

# yum list installed \
| grep -o '^php56u[^ ]*' \
| { \
  mapfile -t packages; \
  for package in "${packages[@]}"; do \
jdeathe /
Created May 30, 2018
BASH one liner to output Apache config files for NameVirtualHosts

The output of apachectl -S is really useful but it's not easy to parse in a script. To make it easier to find the configuration file for a given NameVirtualHost host the following BASH one liner returns lines of output that can be easily parsed.

# apachectl -S 2>&1 \
| sed -rn -e '/NameVirtualHost$/,$ { /NameVirtualHost$/d; $ d; p; }' \
| sed -rn -e 's/^.*(port ([0-9]+) namevhost|alias) ([^ ]*)( )?(\((.*):[0-9]+\)|$)/\2 \6\n\3/p' \
| sed -r -e '/^$/d' -e 's/(.*\.conf$)/\n\1/g' \
| awk -vRS='' '$1=$1' \
| sort -n \
| uniq
jdeathe /
Last active Jul 8, 2020
Installation and Usage of Certbot on CentOS to Obtain a Let’s Encrypt Wildcard TLS/SSL Certificate.

Requesting a Wildcard Certificate with Certbot on CentOS

To request a Let's Encrypt wildcard certificate there are the following prerequisites:

  • The client must support ACME v2 (i.e Certbot >= 0.22.0)
  • The DNS-01 challenge type must be used.
  • The --server option or configuration directive must be changed to the appropriate v2 endpoint.


Install certbot-auto

jdeathe / grow-root.service
Last active Feb 22, 2021
CentOS-7 Systemd Unit File to Grow the Root LVM Disk on AWS EC2 Instances with an ext4 File System.
View grow-root.service
# To install:
# sudo cat grow-root.service > /etc/systemd/system/grow-root.service
# sudo systemctl daemon-reload
# sudo systemctl enable -f grow-root.service
# Start (auto disables after first successful expansion):
# sudo systemctl start grow-root.service
# Debugging:
# sudo systemctl status grow-root.service