Skip to content

Instantly share code, notes, and snippets.

Avatar

Hypernode Support hn-support

View GitHub Profile
@hn-support
hn-support / content-scan.sh
Created Jun 1, 2017
Cleanup scripts for hacked magento shops
View content-scan.sh
#!/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
View whitelist-development-exception.conf
# 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 / cron-debugger.sh
Last active Dec 26, 2020
Debug script to log all cron output to a logfile
View cron-debugger.sh
#!/bin/bash
# This script is a debug utility for cronjobs as explained in:
# - https://support.hypernode.com/knowledgebase/configure-cronjobs-on-hypernode/
# It logs all output and timing to a log file
#
# To use it, download the script, add the executable bit and put it in your cronjob:
# */5 * * * * /data/web/bin/debug-cron php -f /data/web/public/cron.php
LOGDIR="/data/web/public/var/log/crons"
TIMESTAMP="$( date '+%Y%m%d%H%M' )"
@hn-support
hn-support / blocklist.txt
Last active Oct 14, 2020
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
View blocklist.txt
360Spider
80legs\.com
ADmantX
Abonti
AcoonBot
Acunetix
AddThis\.com
AhrefsBot
AngloINFO
Antelope
@hn-support
hn-support / env.php
Last active Oct 1, 2020
magento2 configuration
View env.php
<?php
return array (
'backend' => array (
'frontName' => 'webshop_admin',
),
'crypt' => array (
'key' => '355fb68f9e21189d170c1d759616cd58',
),
'db' => array (
@hn-support
hn-support / cache-warmer.py
Last active Sep 23, 2020
A threaded cache warmer in python
View cache-warmer.py
#!/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
@hn-support
hn-support / cache-warmer.sh
Created Jan 11, 2017
A cache warmer in bash using curl
View cache-warmer.sh
#!/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 / change_magento1_staging_baseurls.py
Last active Jun 10, 2020
Change your base_urls for Magento 1 staging environment on hypernode
View change_magento1_staging_baseurls.py
#!/usr/bin/env python
"""
Set the base-urls for your Magento 1 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_magento1_staging_baseurls.py
After use, check your base-urls by issuing:
n98-magerun sys:store:config:base-url:list
This script requires n98-magerun.
View searchd-watchdog.py
#!/usr/bin/env python
""" Hypernode searchd cron watchdog
This script checks the pid of the searchd daemon and restarts it when the service is not running
It works for both Magento 1 and Magento 2 and for both live and staging.
To run it, add it to the crontab of your hypernode.
For Magento 1:
* * * * * flock -n ~/.searchd_live /data/web/searchd-watchdog.py --environment live --version 1 (live)
@hn-support
hn-support / server.shopware
Last active Jan 28, 2020
Shopware Nginx configuration
View server.shopware
## Author: Benjamin Cremer
## Shopware nginx rules.
## Heavily Inspired by https://github.com/perusio/drupal-with-nginx/
## Designed to be included in any server {} block.
## Please note that you need a PHP-FPM upstream configured in the http context, and its name set in the $fpm_upstream variable.
## https://github.com/bcremer/shopware-with-nginx
# don't log favicon hits
location = /favicon.ico {
log_not_found off;