Skip to content

Instantly share code, notes, and snippets.

View florentb's full-sized avatar

Florent Bourgeois florentb

View GitHub Profile
<!-- 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;">
#!/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
@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'));
@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
# 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 / Vagrantfile
Last active August 29, 2015 14:09
Vagrant NodeJS + MongoDB + Redis
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.host_name = 'trusty64-nodejs'
@florentb
florentb / Vagrantfile
Last active August 29, 2015 14:07
Vagrant ELK + Collectd
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network "public_network"
end
@florentb
florentb / Vagrantfile
Created October 1, 2014 11:15
Vagrant Ubuntu + graphics libs + Nodejs
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network "public_network"
end
@florentb
florentb / box-sizing.css
Created July 16, 2014 19:44
Easier to change the box-sizing in plugins or other components that leverage other behavior
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@florentb
florentb / html5-template.html
Created July 12, 2014 13:41
This is boilerplate markup (a blank HTML document template) for HTML5-capable web pages.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">