Skip to content

Instantly share code, notes, and snippets.

View smokeev-dev's full-sized avatar
🦄

S. smokeev-dev

🦄
  • Europe
View GitHub Profile
@smokeev-dev
smokeev-dev / ! Shell scripts
Created August 25, 2026 00:38 — forked from yohanesgultom/! Shell scripts
Random shell scripts
Random shell scripts
@smokeev-dev
smokeev-dev / delete-traefik-acme-certificates.sh
Created November 26, 2024 13:40 — forked from DrJume/delete-traefik-acme-certificates.sh
Select domains from traefik's acme.json to delete
#!/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
@smokeev-dev
smokeev-dev / backup-container-volumes.sh
Created November 26, 2024 13:40 — forked from DrJume/backup-container-volumes.sh
Backup all mounted volumes in a Docker container into a .tar.gz archive
#!/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
@smokeev-dev
smokeev-dev / stop_loading_blocks_crap_fse.php
Created May 3, 2023 21:34 — forked from sabrina-zeidan/stop_loading_blocks_crap_fse.php
Stop loading block's CSS and JS if the block is not used -- for Full Site Edit themes [WordPress]
// 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 ) {
@smokeev-dev
smokeev-dev / run-wp-cron.sh
Created May 2, 2023 23:52 — forked from bjornjohansen/run-wp-cron.sh
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
#!/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
#!/bin/bash
#Reads the date parameter. empty then date is today
if [ -z "$1" ]
then
date=$(date +"%Y-%m-%d")
else
date=$1
fi
@smokeev-dev
smokeev-dev / rclone-backup-script.sh
Created October 28, 2020 14:01 — forked from donwilson/rclone-backup-script.sh
Back up WWW, MySQL DB and separate content folder to S3 using rclone
#!/bin/bash
###
# Backup Script
###
# Toggle debug mode for CLI output - "YES" or "NO"
DEBUG="YES"
@smokeev-dev
smokeev-dev / block-tor-geoip-nginx.sh
Created August 29, 2020 10:07
How To Block Tor Exit-Nodes with Nginx (GeoIP)
#!/bin/sh
# Download a list of exit-nodes
wget -qO- https://check.torproject.org/torbulkexitlist | sort | awk '{print "" $1 " 1;"}' > /tmp/tor_exit_list.txt
# Prepare a geoip config
echo -e "geo \$isTor {\ndefault 0; \n$(cat /tmp/tor_exit_list.txt) \n}" > /etc/nginx/conf.d/deny-geoip-tor.conf
## Add to virtual host
# location / {
# if ($isTor) {
# return 403;