Skip to content

Instantly share code, notes, and snippets.

View JPustkuchen's full-sized avatar

Julian Pustkuchen JPustkuchen

View GitHub Profile
@JPustkuchen
JPustkuchen / getMinMaxFromMediaQuery.php
Last active February 12, 2018 16:16
PHP regex extraxt min-width / max-width from CSS MediaQuery
<?php
function getMinMaxFromMediaQuery($mediaQuery) {
$re = '/\d*(min-width|max-width):\s*(\d+\s?)(px|em|rem)/';
preg_match_all($re, $mediaQuery, $matches, PREG_SET_ORDER, 0);
$result = array();
if (!empty($matches)) {
if (count($matches) <= 2) {
foreach ($matches as $match) {
if (count($match) == 4) {
$result[] = [
#!/bin/bash
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS:
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
echo $line:
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
@JPustkuchen
JPustkuchen / README.md
Last active January 9, 2018 15:49
[Docker set default binding IP e.g. for links in portainer] #docker

cd /etc/default/docker (if not existing, create the file)

Add the following line (or the --ip=... part if already existing):

DOCKER_OPTS="--ip=192.168.123.123" (Your docker host IP)

Restart docker: systemctl stop docker