Skip to content

Instantly share code, notes, and snippets.

View hluker's full-sized avatar

Henry Luker hluker

View GitHub Profile
@hluker
hluker / phpfpm.md
Last active January 16, 2023 03:46
php-fpm good good
useradd -M user
usermod -L -s /bin/false user
usermod -aG user www-data
chown -R user:user /var/www/example.com/public_html/
chmod -R u=rwX,g=rX,o= /var/www/example.com/public_html/ 
chmod -R 400 wp-config.php
sudo cp /etc/php/8.0/fpm/pool.d/www.conf /etc/php/8.0/fpm/pool.d/example.com.conf

[example]

user = user

@hluker
hluker / sql_commands.md
Last active June 5, 2020 10:19
useful sql commands

wordpress - find and replace domains

UPDATE wp_options SET option_value = replace(option_value, 'http://oldsite.com', 'http://newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldsite.com', 'http://newsite.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://oldsite.com', 'http://newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com');

UPDATE wp_posts SET guid = replace(guid, 'http://oldsite.com', 'http://newsite.com');

@hluker
hluker / nagios.md
Last active October 5, 2021 01:22
Installing Nagios onto Debian

Update components

sudo apt update && sudo apt upgrade
sudo apt install -y build-essential apache2 php openssl perl make php-gd libgd-dev libapache2-mod-php libperl-dev libssl-dev daemon wget apache2-utils unzip

Add users and put into groups

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

How to set static resolution on Hyper-V Virtual Machine

  1. In Virtual Machine Connection: unselect View > Enhanced Session
  2. In remote VM, go to display properties > Advanced Display Settings
  3. Click Display adapter properties for Display 1
  4. Click List All Modes
  5. Pick a resolution (only up to 1920x1080)
@hluker
hluker / install_ldm.md
Last active March 22, 2024 03:33
How to install LDM

Make sure root has a password set - GCP doesn't do this by default. You can remove afterwords.

hostnamectl set-hostname x.x.x.x
apt update && apt upgrade
apt install pax gcc build-essential zlib* libxml* sshfs fuse3 net-tools bc dc csh python3-pip ssh openssh-server apt-transport-https curl wget sudo vim git fonts-liberation
pip3 install twisted
cd /tmp
git clone https://github.com/akrherz/pyLDM.git
cd pyLDM

python3 setup.py install

@hluker
hluker / gcsfuse.md
Last active October 13, 2022 01:40
Google Cloud Storage and WordPress

We're assuming here that both your Storage bucket and virtual machine are BOTH hosted in GCP

Make sure that your uploads directory is EMPTY

You can usually change the owner of the folder to root to prevent WordPress's pesky folder creation

create a cloud bucket

  1. Visit Google Cloud Storage
  2. Create bucket
@hluker
hluker / functions.php
Last active January 6, 2020 05:47
Remove various WordPress cruft
<?php
add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
add_filter('xmlrpc_enabled', '__return_false');
remove_action('wp_head', 'rsd_link'); // remove really simple discovery link
remove_action('wp_head', 'wp_generator'); // remove wordpress version
remove_action('wp_head', 'feed_links', 2); // remove rss feed links
remove_action('wp_head', 'feed_links_extra', 3); // removes all extra rss feed links
remove_action('wp_head', 'index_rel_link'); // remove link to index page
remove_action('wp_head', 'wlwmanifest_link'); // remove wlwmanifest.xml (needed to support windows live writer)