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 / 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 /
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
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 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
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');
You can’t perform that action at this time.