Skip to content

Instantly share code, notes, and snippets.

View hn-support's full-sized avatar

Hypernode Support hn-support

View GitHub Profile
@hn-support
hn-support / cache-warmer.py
Last active April 22, 2024 15:59
A threaded cache warmer in python
#!/usr/bin/env python
"""
Warm the caches of your website by crawling each page defined in sitemap.xml.
To use, download this file and make it executable. Then run:
./cache-warmer.py --threads 4 --file /data/web/public/sitemap.xml -v
"""
import argparse
import multiprocessing.pool as mpool
import os.path
import re
# You can whitelist request that should be exempt from the development
# basic auth.
# It's possible to whitelist request based on their IP address, range,
# User-Agent, or by the requested URL.
# Please note though, that google and bing bots will always remain
# blocked on development nodes!
# Both IP addresses and IP ranges can be whitelisted here.
geo $development_exceptions_ip {
default "Development restricted area";
@hn-support
hn-support / blocklist.txt
Last active September 25, 2023 09:52
A curated list of user agents that use lot's of resources but don't cause more conversion or add any value to most of the webshops
360Spider
80legs\.com
ADmantX
Abonti
AcoonBot
Acunetix
AddThis\.com
AhrefsBot
AngloINFO
Antelope
@hn-support
hn-support / cache-warmer.sh
Created January 11, 2017 12:47
A cache warmer in bash using curl
#!/bin/bash
if [ "$#" -ne 1 ] || [ "x$1" == "x" ] ; then
echo "Usage: $0 <sitemap.xml>"
exit 0;
fi
if [ ! -f "$1" ]; then
echo "Sitemap file $1 not found! Exit!"
exit 1
@hn-support
hn-support / env.php
Last active November 4, 2022 22:23
magento2 configuration
<?php
return array (
'backend' => array (
'frontName' => 'webshop_admin',
),
'crypt' => array (
'key' => '355fb68f9e21189d170c1d759616cd58',
),
'db' => array (
vcl 4.0;
import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
backend default {
.host = "localhost";
.port = "8080";
.first_byte_timeout = 600s;
}
acl purge {
@hn-support
hn-support / varnish.vcl
Last active June 24, 2022 13:28
hn support / varnish.vcl
vcl 4.0;
import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
backend default {
.host = "127.0.0.1";
.port = "8080";
}
@hn-support
hn-support / change_magento2_staging_baseurls.py
Last active May 20, 2021 17:15
Copy and adjust your base_urls for Magento 2 staging environment on hypernode
#!/usr/bin/env python
"""
Set the base-urls for your Magento 2 staging environment by copying and adjusting the base-urls from your production site.
To use, download the file and make it executable. Then run:
./change_magento2_staging_baseurls.py
After use, check your base-urls by issuing:
n98-magerun2 sys:store:config:base-url:list
This script requires n98-magerun2.
@hn-support
hn-support / change_magento1_base_urls_to_https.py
Last active March 29, 2021 09:59
Change all base_urls of your Magento 1 live shop to https on hypernode
#!/usr/bin/env python
"""
Set the base-urls for your Magento 1 installation to support only https.
To use, download the file and make it executable. Then run:
./change_magento1_base_urls_to_https.py
After use, check your base-urls by issuing:
n98-magerun sys:store:config:base-url:list
This script requires n98-magerun.
@hn-support
hn-support / content-scan.sh
Created June 1, 2017 10:00
Cleanup scripts for hacked magento shops
#!/bin/bash
# Find files that contain suspicious php code
grep -RE 'preg_replace\(|eval\(|base64_decode\(' --include='*.php' . | cut -d: -f 1 | sort -u | while read line ; do echo $line | cat - $line | less ; done