Skip to content

Instantly share code, notes, and snippets.

View jmathai's full-sized avatar

Jaisen Mathai jmathai

View GitHub Profile
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

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.

@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" = "" ]
@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 / 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 / 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 / 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 / virtualbox-guest-addition-update
Created May 25, 2012 03:04
Upgrades virtualbox to guest additions 4.1.8
wget -c http://download.virtualbox.org/virtualbox/4.1.8/VBoxGuestAdditions_4.1.8.iso
sudo umount /mnt
sudo mount VBoxGuestAdditions_4.1.8.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run
@jmathai
jmathai / fix-tag-counts-openphoto.php
Created May 18, 2012 20:44
Fix tag counts in db
<?php
$host = '***';
$user = '***';
$pass = '***';
$dbname = '***';
$owner = 'user@example.com';
$conn = mysql_connect($host,$user,$pass);
mysql_select_db($dbname);
@jmathai
jmathai / aws-iam-for-openphoto
Created April 24, 2012 00:52
Sample AWS IAM for OpenPhoto
# use the s3:* and/or sdb:* depending on which you'll need
# sdb domain prefix can be any string.
# s3 bucket names are globally unique
# your account id should not have any spaces or dashes
{
"Statement": [
{
"Sid": "StmtNNNNNNNNNNNNN",
"Action": "s3:*",