Redis Keys Count by Group (namespace)
redis-cli KEYS "*" | awk -F: '{print $1'} | sort | uniq -c
Count WordPress transient
redis-cli KEYS "*" | grep ":transient:" | wc -l
#!/bin/bash | |
# tested with traefik v2.4.8 | |
ACME_FILE="acme.json" | |
# get jq from https://stedolan.github.io/jq/ | |
SELECTED_DOMAINS=$(jq -r '.letsencrypt.Certificates[].domain.main' "$ACME_FILE" | fzf -m --height '40%' --reverse --border) | |
if [[ -z "$SELECTED_DOMAINS" ]]; then |
#!/bin/bash | |
# parameters | |
CF_API_EMAIL= | |
CF_API_KEY= | |
# specify the id for a zone (domain) | |
# get it via the Cloudflare Dashboard | |
# of via flarectl: https://github.com/cloudflare/cloudflare-go/tree/master/cmd/flarectl | |
CF_ZONE= |
#!/bin/bash | |
# Author: @DrJume | |
# This script lets you backup all mounted volumes of a Docker container | |
# into a .tar.xz archive. | |
# Throw on nonzero exit in pipelines | |
set -e |
//Do not load plugins' scripts and styles on every page - only where they are in use | |
add_filter( 'style_loader_tag', 'sz_stop_loading_unused_styles', 10, 2 ); // *doesn't works with 3 arguments | |
function sz_stop_loading_unused_styles( $tag, $handle) { | |
if (!is_user_logged_in()){// for FE only | |
if (is_singular('post')) {// for Posts only | |
//entire plugin | |
if (str_contains($tag, 'woocommerce')) $tag = ''; | |
//specific handle | |
//Gutenberg | |
if (in_array( $handle, ['wc-blocks-style', 'wp-block-editor', 'wp-editor', 'wp-block-library', 'wp-components'])) $tag = ''; |
// Avoid loading unused assets, both JS and CSS | |
// Removes both CSS and JS | |
// For Full Site Editing Theme! | |
// In a better world block's author makes sure the block's assests are loaded only if block is actually in use (via enqueue_block_assets). For other cases we can do it ourselves | |
// In this example I load Swiper's block assets only where the block is used | |
// TODO: Works for content on Singular content only. if block is elsewhere or it's archive use this https://wordpress.stackexchange.com/questions/392493/find-if-widget-block-is-active | |
add_filter( 'style_loader_tag', 'sz_stop_loading_unused_block_crap', 9999, 3 ); | |
add_filter( 'script_loader_tag', 'sz_stop_loading_unused_block_crap', 10, 3 ); | |
function sz_stop_loading_unused_block_crap( $tag, $handle, $src ) { |
#!/bin/bash | |
# Copyright © 2015 Bjørn Johansen | |
# This work is free. You can redistribute it and/or modify it under the | |
# terms of the Do What The Fuck You Want To Public License, Version 2, | |
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. | |
WP_PATH="/path/to/wp" | |
# Check if WP-CLI is available | |
if ! hash wp 2>/dev/null; then |
Redis Keys Count by Group (namespace)
redis-cli KEYS "*" | awk -F: '{print $1'} | sort | uniq -c
Count WordPress transient
redis-cli KEYS "*" | grep ":transient:" | wc -l
#!/bin/bash | |
# | |
# ############################################################################# | |
# Create new SSH user (Ubuntu) | |
# I use this script whenever I need to add a new SSH user to an Ubuntu machine. | |
# Usage: | |
# 1) Download the "raw" with - wget -O createNewSSHUser.sh https://gist.github.com/raw/4223476 | |
# 2) Make it executable with - chmod a+x createNewSSHUser.sh | |
# 3) Uncomment the last line and edit the user & pwd values | |
# 4) Execute it with : sudo ./createNewSSHUser.sh |
#!/bin/bash | |
# Autor: remontti.com.br | |
#Insert your bot token without the "bot" part in the variable bellow | |
TOKEN="2ef92jfn2;uf9nf2nFUE(U@sadfwewoijfe#$" | |
USER=$1 | |
SUBJECT=$2 | |
MESSAGE=$3 | |
NL=" | |
" |
#!/bin/bash | |
#Reads the date parameter. empty then date is today | |
if [ -z "$1" ] | |
then | |
date=$(date +"%Y-%m-%d") | |
else | |
date=$1 | |
fi |