Skip to content

Instantly share code, notes, and snippets.

View jmathai's full-sized avatar

Jaisen Mathai jmathai

View GitHub Profile
@jmathai
jmathai / phpunit-reinstall.sh
Created June 14, 2012 04:15
Uninstall and reinstall phpunit
pear list -c phpunit | grep stable | awk '{print "phpunit/"$1}' | xargs pear uninstall ; pear install phpunit/phpunit
@jmathai
jmathai / openphoto-triggers
Last active December 14, 2015 23:29
Create triggers to track counts on tags and albums for an OpenPhoto site.
# If you added a prefix to your tables you'll need to add those manually before executing this SQL #
#######################
# Set the delimiter so we can use ;'s in the trigger
#######################
DELIMITER |
#######################
# update counts when a photo is removed from an album
#######################
@jmathai
jmathai / install_pip.sh
Last active December 15, 2015 13:29
Installing pip on Ubuntu
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
# extra
$ sudo pip install gearman
$ sudo pip install boto
$ sudo apt-get install incron
@jmathai
jmathai / random-photo.php
Created April 9, 2013 18:54
Select a random photo from a user's account
// instantiate the API wrapper
$op = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthSecret);
// call the list API with a limit of 1 photo and access the 'totalPages' property
$result = json_decode($op->get('/photos/list.json', array('pageSize' => '1')), 1);
$totalPhotos = intval($result['result'][0]['totalPages']);
// pick a random number between the first and last photo
$randomPage = rand(1, $totalPhotos);
@jmathai
jmathai / setup.sh
Last active August 29, 2015 14:00
trovebox-nas-setup.sh
#!/bin/bash
SCREEN=$(which screen)
if [ "$SCREEN" = "" ]
then
echo "Install screen then rerun"
exit 0
fi
if [ "$STY" = "" ]

Thank you for your interest in contributing to Elodie ("We" or "Us").

The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us. To make this document effective, please follow the instructions at https://cla-assistant.io/.

1. DEFINITIONS

"You" means the Individual Copyright owner who submits a Contribution to Us. If You are an employee and submit the Contribution as part of your employment, You have had Your employer approve this Agreement or sign the Entity version of this document.

"Contribution" means any original work of authorship (software and/or documentation) including any modifications or additions to an existing work, Submitted by You to Us, in which You own the Copyright. If You do not own the Copyright in the entire work of authorship, please contact Us at jaisen@jmathai.com.

var Response = require('joule-node-response');
exports.handler = function(event, context) {
var response = new Response();
response.setContext(context);
var name = event.name || 'World';
var greeting = 'Hello, ' + name + '.';
var result = {
"message": greeting
var response = require('joule-node-response');
var client = require('twilio')();
exports.handler = function(event, context) {
client.messages.create({
body: event.body,
to: event.to,
from: process.env.from
}, function(err, message) {
if(message && message.sid) {

Keybase proof

I hereby claim:

  • I am jmathai on github.
  • I am jaisenmathai (https://keybase.io/jaisenmathai) on keybase.
  • I have a public key whose fingerprint is E411 DF2B 1504 2E6F 97E9 3A35 0E43 CAEB 9251 6011

To claim this, I am signing this object:

var Response = require('joule-node-response');
var JouleNodeDatabase = require('joule-node-database');
exports.handler = function(event, context) {
var response = new Response();
var database = new JouleNodeDatabase();
database.get('hasInvite')
.done(function(data) {
if(typeof(data.hasInvite) === 'undefined' || data.hasInvite !== true) {