Skip to content

Instantly share code, notes, and snippets.

Shelan Perera shelan

Block or report user

Report or block shelan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shelan /
Created Feb 17, 2015
Sample python code for a autoscaler
import datetime
import boto.ec2.cloudwatch
import boto.ec2.autoscale
import time
import numpy as np
def gradient(foo):
graient_list = []
shelan / cluster-deployment.yml
Created Feb 4, 2016
Deploy Hadoop, Spark and Flink clusters on Amazon EC2 with this
View cluster-deployment.yml
name: HadoopSparkFlinkCluster
region: us-west-2
type: m3.xlarge
branch: master
github: karamel-lab/apache-hadoop-chef
shelan / node_crypto.js
Created Feb 17, 2016 — forked from rojan/node_crypto.js
Encrypt in nodejs and decrypt in php or vice versa
View node_crypto.js
var crypto = require('crypto');
var key = 'MySecretKey12345';
var iv = '1234567890123456';
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
var text = 'plain text';
var encrypted = cipher.update(text, 'utf8', 'binary');
encrypted +='binary');
hexVal = new Buffer(encrypted, 'binary');
shelan /
Created Feb 25, 2016 — forked from suya55/
Open a project in IntelliJ IDEA from your command line! Raw
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
# Setup your working directory. Edit 'work' to your working directory.
working_dir=`ls -1d ~/work/$1 | head -n1`
# were we given a directory?
if [ -d "$1" ]; then
# ---------------------------------------------------------------------------
# - Install Docker
# Copyright 2016, <shelan@Shelans-MacBook-Pro.local>
# All rights reserved.
# Usage: [-h|--help]
# Revision history:
shelan / samplerest.js
Created Apr 9, 2016 — forked from joshbirk/samplerest.js
Sample of using passport w/ mult strategies
View samplerest.js
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')
shelan /
Created Apr 14, 2016 — forked from ekristen/
Bash Script for Nagios to Check Status of Docker Container
# Author: Erik Kristensen
# Email:
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./ _container_id_
# The script checks if a container is running.
# OK - running
# ---------------------------------------------------------------------------
# - installing docker
# Copyright 2016, <shelan@Shelans-MacBook-Pro.local>
# All rights reserved.
# Usage: [-h|--help] [-h|--host hostip] [-i|--interface interface] [-u|--user user]
# Revision history:
shelan / postgresql-set-id-seq.sql
Created Oct 28, 2019 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
View postgresql-set-id-seq.sql
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
You can’t perform that action at this time.