Skip to content

Instantly share code, notes, and snippets.

Avatar

Jakke Lehtonen eksiscloud

View GitHub Profile
@eksiscloud
eksiscloud / cachewarmer.sh
Created May 22, 2021
Cache Warmer using sitemap
View cachewarmer.sh
#!/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 Jul 17, 2020 — forked from leonelsr/bash_background.vbs
Run bash (Windows Subsystem for Linux) in background, in order to keep background processes running in WSL
View bash_background.vbs
' 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")
View flush-redis-cache.php
<?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 Jul 2, 2020
Varnish: custom header a la cheshire cat (ascii art)
View cheshire_cat.vcl
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 Jul 2, 2020 — forked from katef/cloud.vcl
HTTP Moomin delivery
View moomin.vcl
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 Jun 6, 2020
Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
View functions.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
**/
function redis_add_toolbar_link( $wp_admin_bar )
{
@eksiscloud
eksiscloud / www.conf
Created Jun 5, 2020
/etc/php/7.4/fpm/pool.d/www.conf for 1G/1CPU droplet of DigitalOcean
View www.conf
[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 Jun 5, 2020
Redis and wp-config.php
View 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 Mar 19, 2021
Simplified /etc/redis/redis.conf
View 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 Jun 4, 2020
Cleaned php7.4.ini (all comments are removed)
View php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
;user_ini.filename = ".user.ini"
;user_ini.filename =
;user_ini.cache_ttl = 300