Skip to content

Instantly share code, notes, and snippets.

View dbathily's full-sized avatar

Didier Bathily dbathily

View GitHub Profile
@dbathily
dbathily / install-graphite-ubuntu-11.10.sh
Created November 17, 2012 13:22 — forked from Iristyle/install-graphite-ubuntu-11.10.sh
Install Graphite 0.9.9 on Ubuntu 11.10 on EC2 with NGinx, uwsgi, supervisord, statsite, nagios agent
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@(page:Int, pageLength:Int, collectionLength:Int, route:Int => Call, bound:Int = 5)
@lowbound() = @{
((page.toDouble / bound).floor * bound) toInt
}
@highbound() = @{
if ((lowbound() + bound) * pageLength >= collectionLength)
collectionLength / pageLength + 1
else
lowbound() + bound
}
@dbathily
dbathily / Recurly.java
Created January 2, 2013 11:24
Recurly push notification handler in play framework using recurly-java-client
package controllers;
import com.ning.billing.recurly.model.Subscription;
import com.ning.billing.recurly.model.push.Notification;
import com.ning.billing.recurly.model.push.account.BillingInfoUpdatedNotification;
import com.ning.billing.recurly.model.push.account.CanceledAccountNotification;
import com.ning.billing.recurly.model.push.account.NewAccountNotification;
import com.ning.billing.recurly.model.push.payment.*;
import com.ning.billing.recurly.model.push.subscription.*;
import play.Logger;
<?php
require_once __DIR__ . '/../lib/vendor/Silex/silex.phar';
$app = new Silex\Application();
$app['debug'] = true;
// Registering Symfony\Yaml and Symfony\Config
$app['autoloader']->registerNamespace('Symfony', __DIR__.'/../lib/vendor/symfony/src');
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@dbathily
dbathily / gist:6063392
Last active December 20, 2015 03:28
travis playframework 2 sample
language: scala # to trigger the build on JVM worker ('language: java' works the same)
env:
- PLAY_VERSION=2.1-RC2 # Latest 2.1.x
before_script:
- wget http://downloads.typesafe.com/play/${PLAY_VERSION}/play-${PLAY_VERSION}.zip
- unzip -q play-${PLAY_VERSION}.zip
script: play-${PLAY_VERSION}/play test
notifications:
# Email notifications are disabled to not annoy anybody.
# See http://about.travis-ci.org/docs/user/build-configuration/ to learn more
@dbathily
dbathily / gist:6063435
Created July 23, 2013 15:43
cicrle ci playframework 2 sample
machine:
timezone:
UTC
environment:
PLAY_VERSION: 2.1.2
PLAY_HOME: play-$PLAY_VERSION
dependencies:
pre:
- if [[ ! -e $PLAY_HOME ]]; then curl -k -L -o $PLAY_HOME.zip http://downloads.typesafe.com/play/$PLAY_VERSION/play-$PLAY_VERSION.zip && unzip -q $PLAY_HOME.zip; fi
@dbathily
dbathily / Build.scala
Created July 23, 2013 22:24
Upload play framework 2 build to amazon s3
import sbt._
import Keys._
import play.Project._
import com.typesafe.sbt.S3Plugin._
import S3._
object ApplicationBuild extends Build {
val appName = "sample"
val appVersion = "1.0-SNAPSHOT"
@dbathily
dbathily / gist:6098427
Created July 28, 2013 12:34
packer AMI policy
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CreateImage",
"ec2:CreateKeyPair",
"ec2:CreateSecurityGroup",
@dbathily
dbathily / color.sh
Created August 14, 2013 20:49
Colors your echo
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
function red() {
echo -e "$RED$*$NORMAL"
}
function green() {