Skip to content

Instantly share code, notes, and snippets.

Milo Jennings facelordgists

Block or report user

Report or block facelordgists

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Count of files in each sub-directory.sh
# Count of files in each sub-directory
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo "$(find "{}" -type f | wc -l)" {}' \; | sort -nr
## Output example
# 1128 ./wordpress-seo
# 676 ./wp-ses
# 618 ./css-javascript-toolbox
# 423 ./gravityforms
# 394 ./wp-usertrack
View install-plugin-or-theme-wp-cli.sh
## Install from private_html folder
wp plugin install ../private_html/divi-card-factory-1.7.0.zip --activate --force --skip-plugins --skip-themes
wp theme install ../private_html/mydivi-theme-3.8.5.zip --activate --force --skip-plugins --skip-themes
## Install from S3
wp plugin install https://assets.roadsidemultimedia.com/plugins/divi-card-factory/divi-card-factory-1.7.1.zip --activate --force --skip-plugins --skip-themes
wp theme install https://assets.roadsidemultimedia.com/themes/mydivi-theme/mydivi-theme-3.8.5.zip --activate --force --skip-plugins --skip-themes
wp plugin install https://assets.roadsidemultimedia.com/plugins/rsmm-page-cache/rsmm-page-cache-0.3.4.zip --activate --force --skip-plugins --skip-themes
wp plugin install https://assets.roadsidemultimedia.com/plugins/rsmm-page-cache/rsmm-page-cache-0.3.5.zip --activate --force --skip-plugins --skip-themes
View get-all-plugin-data.php
<?php
function get_all_plugin_data(){
$all_plugins = get_plugins();
$list_of_all_plugins = array();
foreach ($all_plugins as $path => $data) {
$parts = explode('/', $path);
$slug = $parts[0];
$list_of_all_plugins[$slug] = array(
'Slug' => $slug,
'path' => $path,
View tmux-session-restore.md

Call it like so manually or periodically from cron (because you might forget):

tmux-session save

It will write to ~/.tmux-session. Restore them after reboot like so:

tmux-session restore

View error-logging-instructions.md

1) Configure the wp-config.php

As follows:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
View docker-tips-tricks-commands.md

1. General Stuff

Terminology

An image is a set of layers. When you start an image, it becomes a running container. You can have many running containers of the same image.

An instance of an image is called a container.

The image is the recipe, the container is the cake. You can make as many cakes as you like with a given recipe. A stopped container is a cake in the freezer.

View list files every 2 seconds.sh
#monitor files in "webserver-access" folder
watch ls -l webserver-access
View sync-saves.sh
#taken from here: https://community.playstarbound.com/threads/synchronize-savegames-between-windows-mac-and-linux.53217/
cd /Users/milojennings/Library/Application\ Support/Steam/steamapps/common/Starbound/storage
ln -s /Users/milojennings/Dropbox/User\ Account\ Settings/Starbound/player player
ln -s /Users/milojennings/Dropbox/User\ Account\ Settings/Starbound/universe universe
View hubspot-blog-post-csv-export-template.md

Modified version of the code found in this post

{% set export = blog_recent_posts('2099729350', 200) %} 
"post_title","post_slug","post_date","post_content","post_thumbnail","post_author","post_category",<br>
{% for content in export %} "{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.name|forceescape }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.slug|forceescape|replace('blog/', '') }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.publish_date_localized|forceescape }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.post_body|replace('"','""')|forceescape|escape_jinjava }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.featured_image }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.blog_post_author }}","{{ $root.DOUBLE_LEFT_CURLY_BRACE }} content.topic_list|forceescape|replace('[', '')|replace(']', '') }}" <br>
{% endfor %}
{% endif %}
@facelordgists
facelordgists / curl-website-from-specific-host.sh
Last active Sep 3, 2019
Curl a website from one server to another within a private network, such as a gateway to appserver or loadbalancer to appserver.
View curl-website-from-specific-host.sh
# -H sets the header
# -v includes the header information
# /dev/null pipes the contents of the page output into a blackhole
curl -v http://<server-host_or_ip>/ -H "Host: domain.com" > /dev/null
# Example
curl -v https://localhost/ -H "Host: www.dentalmanagers.com" > /dev/null
curl -v http://appserver-4/ -H "Host: www.1111dental.com" > /dev/null
curl -v http://appserver-4/ -H "Host: test.roadsidedentalmarketing.com" > /dev/null
You can’t perform that action at this time.