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
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));
@shelan
shelan / check_docker_container.sh
Created Apr 14, 2016 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
View check_docker_container.sh
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# The script checks if a container is running.
# OK - running
@shelan
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')
View docker-install.sh
#!/bin/bash
# ---------------------------------------------------------------------------
# docker-install.sh - installing docker
# Copyright 2016, <shelan@Shelans-MacBook-Pro.local>
# All rights reserved.
# Usage: docker-install.sh [-h|--help] [-h|--host hostip] [-i|--interface interface] [-u|--user user]
# Revision history:
View docker-install-old.sh
#!/bin/bash
# ---------------------------------------------------------------------------
# docker-install.sh - Install Docker
# Copyright 2016, <shelan@Shelans-MacBook-Pro.local>
# All rights reserved.
# Usage: docker-install.sh [-h|--help]
# Revision history:
@shelan
shelan / ij.sh
Created Feb 25, 2016 — forked from suya55/ij.sh
Open a project in IntelliJ IDEA from your command line! Raw
View ij.sh
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# 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
@shelan
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 += cipher.final('binary');
hexVal = new Buffer(encrypted, 'binary');
@shelan
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
ec2:
region: us-west-2
type: m3.xlarge
cookbooks:
hadoop:
branch: master
github: karamel-lab/apache-hadoop-chef
spark:
@shelan
shelan / AutoScaler.py
Created Feb 17, 2015
Sample python code for a autoscaler
View AutoScaler.py
import datetime
import boto.ec2.cloudwatch
import boto.ec2.autoscale
import time
import numpy as np
def gradient(foo):
graient_list = []
You can’t perform that action at this time.