Skip to content

Instantly share code, notes, and snippets.

@kopitar
kopitar / warm.sh
Created May 16, 2023 06:48 — forked from pkdavies/warm.sh
Cache warming script using siege
#!/bin/bash
rm sitemap.xml
wget -q https://www.CLIENT.com/sitemap.xml
sed '/<loc>/!d; s/[[:space:]]*<loc>\(.*\)<\/loc>/\1/' sitemap.xml > links.txt
siege -b -v -c 10 -f links.txt -r once -H 'Accept-Encoding: gzip' 2>/dev/null
@kopitar
kopitar / resize_image.php
Last active June 5, 2020 03:13 — forked from janzikan/resize_image.php
PHP: Resize image - preserve ratio of width and height
/**
* Resize image - preserve ratio of width and height.
* @param string $sourceImage path to source JPEG/PNG image
* @param string $targetImage path to final JPEG/PNG image file
* @param int $maxWidth maximum width of final image (value 0 - width is optional)
* @param int $maxHeight maximum height of final image (value 0 - height is optional)
* @param int $quality quality of final image (0-100)
* @return bool
*/
function resizeImage($sourceImage, $targetImage, $maxWidth, $maxHeight, $quality = 80)
@kopitar
kopitar / gist:e97d35506febcc1ecae68d1adcd894d4
Created September 18, 2018 12:14
PHP: minimal example of SOAP Server and Client
<?php
// server
class MySoapServer
{
public function getMessage()
{
return 'Hello,World!';
}