Skip to content

Instantly share code, notes, and snippets.

View eksiscloud's full-sized avatar

Jakke Lehtonen eksiscloud

View GitHub Profile
@eksiscloud
eksiscloud / cachewarmer.sh
Created May 22, 2021 07:43
Cache Warmer using sitemap
#!/bin/bash
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS:
# from: https://gist.github.com/JPustkuchen/f185bee60c5a36211cdf6f1c8f6deebe
# chmod u+x
DOMAIN='https://www.xyz.com'
wget -q $DOMAIN/sitemap.xml --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read subsite;
do
echo --- Reading sub-sitemap: $subsite: ---
wget -q $subsite --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read line;
do
@eksiscloud
eksiscloud / bash_background.vbs
Created July 17, 2020 21:18 — forked from leonelsr/bash_background.vbs
Run bash (Windows Subsystem for Linux) in background, in order to keep background processes running in WSL
' Windows Devs said on the developer feedback asking for cron, deamons and background tasks:
' "This first release of Bash/WSL doesn’t support background tasks, cron jobs, daemons, etc.
' Currently, when you close your last bash shell console window, we tear-down the Linux process
' chain in order to conserve resources."
'
' That's the workaround for now.
' You can run it on boot, for example, and it'll keep a instance of bash running alone in the background
' allowing background processes to run on WSL.
Set WshShell = CreateObject("WScript.Shell")
<?php
# Check: https://onexa.nl/wordpress/toolbar-link-redis-object-cache/
/**
* Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
*
* @author Hiranthi Herlaar, onexa.nl
*
* @var $wp_admin_bar > https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
@eksiscloud
eksiscloud / cheshire_cat.vcl
Last active July 2, 2020 17:55
Varnish: custom header a la cheshire cat (ascii art)
sub headers_x {
## Add after vcl 4.1;
## include "/etc/varnish/ext/cheshire_cat.vcl";
##
## Add after sub vcl_deliver {
## call header_smiley;
sub header_smiley {
set resp.http.xa = "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀.'\⠀⠀⠀/`.";
set resp.http.xb = "⠀⠀⠀⠀⠀⠀⠀⠀⠀.'.-.`-'.-.`.";
set resp.http.xc = "⠀⠀⠀⠀..._:⠀⠀⠀.-.⠀.-.⠀⠀⠀:_...";
@eksiscloud
eksiscloud / moomin.vcl
Created July 2, 2020 11:40 — forked from katef/cloud.vcl
HTTP Moomin delivery
sub deliver_moomin {
set resp.http.x-moomin0 = "⠀⠀⠀⠀⠀⠀⠀⢠⢦⡀⠀⡰⣩⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀";
set resp.http.x-moomin1 = "⠀⠀⠀⠀⠀⠀⠀⠘⣄⠙⠍⠁⠙⠦⡀⠀⠀⠀⠀⠀⠀⠀⠀";
set resp.http.x-moomin2 = "⠀⠀⠀⠀⠀⠀⠀⠀⡎⠀⠀⡠⠄⠔⠊⠉⠒⠒⠒⢄⠀⠀⠀";
set resp.http.x-moomin3 = "⠀⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⠆⠀⠀";
set resp.http.x-moomin4 = "⠀⠀⢠⢤⠜⡆⠀⢸⠀⠰⣄⠀⠀⠀⠀⠀⠀⠀⣠⠎⠀⠀⠀";
set resp.http.x-moomin5 = "⠀⠀⠱⠤⡁⠈⠑⠇⠀⠀⠀⠉⠒⠤⠤⠄⢖⠊⠀⡐⠧⣄⣀";
set resp.http.x-moomin6 = "⠀⠀⠀⠀⠘⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⡉⠀⣀⣨⡷";
set resp.http.x-moomin7 = "⠀⠀⠀⠀⠀⠈⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠜⠁ ";
set resp.http.x-moomin8 = "⠀⠀⠀⠀⠀⠀⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣸⠱⡀⠀";
@eksiscloud
eksiscloud / functions.php
Created June 6, 2020 15:28
Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
# Check: https://onexa.nl/wordpress/toolbar-link-redis-object-cache/
/**
* Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
*
* @author Hiranthi Herlaar, onexa.nl
*
* @var $wp_admin_bar > https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
**/
function redis_add_toolbar_link( $wp_admin_bar )
{
@eksiscloud
eksiscloud / www.conf
Created June 5, 2020 20:10
/etc/php/7.4/fpm/pool.d/www.conf for 1G/1CPU droplet of DigitalOcean
[www]
listen = /run/php/php7.4-fpm.sock
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 2
pm.process_idle_timeout = 10s
pm.max_requests = 100
@eksiscloud
eksiscloud / wp-config.php
Created June 5, 2020 13:54
Redis and wp-config.php
//define('WP_CACHE', true);
$_SERVER['HTTPS'] = 'on';
//define('DISABLE_WP_CRON', true);
define('WP_REDIS_DATABASE', 1);
$redis_server = array( 'host' => '127.0.0.1', 'port' => 6379, );
define('WP_REDIS_MAXTTL', 900);
define('WP_CACHE_KEY_SALT', 'eksis.dev');
@eksiscloud
eksiscloud / redis.conf
Last active March 19, 2021 11:59
Simplified /etc/redis/redis.conf
bind 127.0.0.1 ::1
protected-mode yes
port 6379
tcp-backlog 511
# unixsocket /var/run/redis/redis-server.sock
# unixsocketperm 700
timeout 0
tcp-keepalive 300
daemonize yes
@eksiscloud
eksiscloud / php.ini
Created June 4, 2020 12:55
Cleaned php7.4.ini (all comments are removed)
[PHP]
;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
;user_ini.filename = ".user.ini"
;user_ini.filename =
;user_ini.cache_ttl = 300