Skip to content

Instantly share code, notes, and snippets.

View xdamman's full-sized avatar
🌍
🌱🌻

Xavier Damman xdamman

🌍
🌱🌻
View GitHub Profile
@xdamman
xdamman / varnish-jsonp.vcl
Last active December 27, 2015 14:29
Make Varnish 3.x handle jsonp requests so that we can cache them (even when jQuery generates random callback function names when using $.getJSON). Inspired by https://gist.github.com/simonw/640331 and adapted for Varnish 3.x.
#<jsonp>
# We go BACK to varnish to get it to generate an ESI template that
# generates a JSON-P response.
backend jsonp_template_backend {
.host = "127.0.0.1";
.port = "80"; # use the port that varnish is listening on
}
# <jsonp>
# How the jsonp_template_backend dispatches to the ESI generating code:
@xdamman
xdamman / top years
Last active December 10, 2015 05:58
235898,1980
32649,2003
297,1987
292,1985
288,1988
287,1981
285,1963
280,1984
276,1983
274,1982
@xdamman
xdamman / top domains
Last active February 23, 2022 20:23
363202,HOTMAIL.COM
187090,GMAIL.COM
99806,SKYNET.BE
60011,TELENET.BE
59293,YAHOO.COM
56286,YAHOO.FR
22528,HOTMAIL.FR
17766,PANDORA.BE
12912,MSN.COM
11061,SCARLET.BE
@xdamman
xdamman / Accept all friends requests.js
Created December 21, 2012 07:13
Facebook friend requests zero I had 236 pending friends requests, so I decided to accept them all as a gesture before the end of the world. I wasn't ready to click on them all so just made that quick script you can run in the console when you are on the page https://www.facebook.com/friends/requests/
var a = document.getElementsByTagName('input');
for(var i=0;i<a.length;i++) if(a[i].getAttribute('value')=='Confirm') a[i].click();
@xdamman
xdamman / upgradeNode.js
Created December 19, 2012 19:19
Upgrade the default Joyent Smart Machine Node Image 1.3.3 to using node 0.8.16 (I don't like the newest 1.4.0 image since it doesn't come with out-of-the box push to a git repo and deploy)
#!/usr/bin/env bash
pkgin -f update
pkgin install gcc-compiler
mkdir src
cd src
curl -O http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz
gtar -xpf node-v0.8.16.tar.gz
cd node-v0.8.16
./configure --with-dtrace --prefix=/opt/nodejs/v0.8.16/
gmake install
@xdamman
xdamman / zemanta source
Created July 10, 2012 17:45
Storify source example Zemanta
{
"_id": {
"$oid": "4e49f6a1b756ba595aae31e5"
},
"name": "zemanta",
"label": "Zemanta",
"icon": "http://zemanta.com/favicon.ico",
"href": "http://zemanta.com",
"status": "",
"defaults": {
;(function() {
Slideshow = function() {
var self = this,
slides = [],
container = $('#elements'),
currentSlide=0,
totalSlides=0,
storify = new Storify(),