Skip to content

Instantly share code, notes, and snippets.

View florentb's full-sized avatar

Florent Bourgeois florentb

View GitHub Profile
# Clear all cache
$ varnishadm "ban req.url ~ /"
# or
$ varnishadm "ban req.http.host ~ www.mydomain.com"
# Purge only CSS
$ varnishadm "ban req.http.host ~ www.mydomain.com && req.url ~ .css"
@florentb
florentb / url_title.php
Last active May 3, 2016 13:36
PHP example to create an URL from an accented string
<?php
/**
* Replace accents
*
* Replace accented characters
* by the corresponding unaccented characters
*
* @param string $str the string
* @return string
@florentb
florentb / example.js
Created July 27, 2016 10:26
Sharp example
var fs = require('fs');
var request = require('request');
var sharp = require('sharp');
request.get('https://upload.wikimedia.org/wikipedia/commons/b/bd/Test.svg').pipe(sharp().resize(300).toFormat('png')).pipe(fs.createWriteStream('output.png'));
#!/bin/bash
apt-get update
apt-get install -y nfs-common
echo "$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-0000000.efs.us-west-2.amazonaws.com:/ /efs/data nfs4 defaults" >> /etc/fstab
mkdir /efs
chmod go+rw /efs
mkdir /efs/data
chmod go+rw /efs/data
mount -a
<!-- with HTML attributes -->
<img class="twic" data-src="placeholder:auto" width="300" height="300">
<!-- Same result with CSS -->
<img class="twic" data-src="placeholder:auto" style="width:300px; height:300px;">