Skip to content

Instantly share code, notes, and snippets.

View ThijsFeryn's full-sized avatar

Thijs Feryn ThijsFeryn

View GitHub Profile
@ThijsFeryn
ThijsFeryn / gist:3034031
Created July 2, 2012 16:17
Save syntax highlighted PHP source code into an HTML file
$ php -s test.phps > test.html
$
@ThijsFeryn
ThijsFeryn / gist:3034094
Created July 2, 2012 16:26
Using highlight_file to perform syntax highlighting in PHP
<?php
//Echo directly
highlight_file('test.php');
//Store in variable first
$source = highlight_file('test.php', true);
echo $source;
@ThijsFeryn
ThijsFeryn / gist:3034109
Created July 2, 2012 16:30
Using highlight_string to perform syntax highlighting in PHP
<?php
highlight_string('<?php echo "A line of PHP code a day keeps the doctor away";');
@ThijsFeryn
ThijsFeryn / gist:3737009
Created September 17, 2012 12:26
Composer file for Silex & Zend Framework
{
"minimum-stability": "dev",
"require": {
"silex/silex": "1.0.*",
"zendframework/zendframework": "2.0.*"
}
}
@ThijsFeryn
ThijsFeryn / wordpress.vcl
Created October 10, 2012 20:33 — forked from willmot/wordpress.vcl
WordPress Varnish VCL
backend default {
.host = "127.0.0.1";
.port = "8080";
}
acl purge {
"localhost",
"69.195.222.132"
}
sub vcl_recv {
{
"require": {
"symfony/http-foundation": "2.5.3",
"symfony/http-kernel": "2.5.3",
"twig/twig": "1.16.0"
}
}
@ThijsFeryn
ThijsFeryn / joindin_location_count.go
Created June 15, 2015 08:48
Pass the JoindIn speaker id to this program and it will count the amount of talks given at each location
package main
import (
"strconv"
"io/ioutil"
"log"
"net/http"
"fmt"
"encoding/json"
"time"
@ThijsFeryn
ThijsFeryn / gist:b6ae0b6f7ea9b3eda9a1
Created July 14, 2015 14:10
Deflate for old & new versions of Apache
<IfModule filter_module>
<IfVersion >= 2.4>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/css|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/plain|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/xml|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^text/x-component|"
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} =~ m|^application/javascript|"
@ThijsFeryn
ThijsFeryn / varnishusage.go
Last active June 7, 2019 00:33
A Go script that retrieves the Varnish memory consumption and returns it via a RESTful API using GoJi
package main
import (
"strconv"
"net/http"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
"os/exec"
"encoding/json"
)
@ThijsFeryn
ThijsFeryn / varnishv4esi.vcl
Last active November 12, 2015 14:04
VCL snippet that contains the minimum amount of config to support ESI using Surrogate headers
vcl 4.0;
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
set req.http.Surrogate-Capability = "key=ESI/1.0";
}