Skip to content

Instantly share code, notes, and snippets.

@davidkeen
davidkeen / TileLayer.Common.js
Created September 15, 2012 21:17 — forked from mourner/TileLayer.Common.js
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@davidkeen
davidkeen / play.conf
Last active July 6, 2016 07:50 — forked from omphe/gist:8302060
Upstart script for Play Framework 2.2.
description "Play Framework Config"
env USER=username
env GROUP=username
env HOME=/your/project/root
env PORT=8080
env ADDRESS=127.0.0.1
env MEM=1024
env PROJECT=your_play_project

Keybase proof

I hereby claim:

  • I am davidkeen on github.
  • I am davidkeen (https://keybase.io/davidkeen) on keybase.
  • I have a public key whose fingerprint is 3DB2 C0E2 0BF3 B8DB B2BD F169 6BC7 4650 B642 33C2

To claim this, I am signing this object:

@davidkeen
davidkeen / amee
Last active August 29, 2015 14:07
AMEE nginx vhost (http)
upstream amee-platform {
server 127.0.0.1:8888;
}
upstream amee-platform-secure {
server 127.0.0.1:8889;
}
server {
listen 80;
@davidkeen
davidkeen / amee
Created October 8, 2014 08:59
AMEE init script
#!/bin/bash
export RUN_AS_USER=amee
AMEE_HOME=/var/www/apps/amee-platform/current
sh $AMEE_HOME/bin/amee-platform $1
@davidkeen
davidkeen / master_amee_cron
Created October 8, 2014 09:29
AMEE index synchronisation crontab
# Keep the 1 most recent Lucene snapshots every 30 minutes
*/30 * * * * /var/www/apps/amee-platform/current/bin/snapcleaner -N 1 -d /var/www/apps/amee-platform/lucene
# Check the slaves are up to date
0 * * * * /var/www/apps/amee-platform/current/bin/slavecheck -d /var/www/apps/amee-platform/lucene
@davidkeen
davidkeen / jolokia.py
Created October 29, 2014 15:15
Get queue size from jmx
from pyjolokia import Jolokia
import json
# Enter the jolokia url
j4p = Jolokia('http://localhost:8778/jolokia/')
# Put in the type, the mbean, or other options. Check the jolokia users guide for more info
# This then will return back a python dictionary of what happend to the request
data = j4p.request(type = 'read', mbean='org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=sms.in', attribute='QueueSize')
@davidkeen
davidkeen / mvn-gatling.xml
Created November 28, 2014 10:59
Multiple gatling simulations with maven plugin
<profiles>
<profile>
<id>performance</id>
<build>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>2.0.0-RC4</version>
<configuration>
@davidkeen
davidkeen / bad_referers.conf
Last active August 29, 2015 14:23
Block referer spam in Nginx
map $http_referer $bad_referer {
default 0;
"~semaltmedia\.com" 1;
"~100dollars-seo\.com" 1;
"~buttons-for-your-website\.com" 1;
"~best-seo-offer\.com" 1;
}
# Server block
# if ($bad_referer) {
@davidkeen
davidkeen / pom.xml
Last active January 24, 2024 14:03
Disable doclint for Java 8
<profiles>
<profile>
<id>java8</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>