Skip to content

Instantly share code, notes, and snippets.

View ejhari's full-sized avatar

Hari John Kuriakose ejhari

View GitHub Profile
@ejhari
ejhari / .vimrc
Created May 29, 2021 05:50
vimrc
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" Any valid git URL is allowed for plugin
" Shorthand notation for plugin
Plug 'morhetz/gruvbox'
" Initialize plugin system
call plug#end()
@ejhari
ejhari / load_test.js
Created March 26, 2018 21:23
Load Testing using K6 + InfluxDB + Grafana
// REF: https://medium.com/codeinsights/how-to-load-test-your-node-js-app-using-k6-74d7339bc787
//
// brew tap loadimpact/k6
// brew install k6 grafana influxdb
// k6 run load_test.js
// k6 run --out influxdb=http://localhost:8086/resultsdb load_test.js
//
// To have launchd start grafana now and restart at login:
// brew services start grafana
// Or, if you don't want/need a background service you can just run:
@ejhari
ejhari / logger.py
Last active March 6, 2017 07:34
Quick and Simple Logger
import logging
import logging.handlers
LOG_FILE = '/var/log/my_app/server.log'
# Set up a specific logger with our desired output level
logger = logging.getLogger('my_app')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger.setLevel(logging.DEBUG)
# Add the log message handler to the logger
@ejhari
ejhari / default_image.ejs
Created December 8, 2016 03:43
Default Image for Broken Links
<object class="profile-pic" data="<%= profile_pic_url %>">
<img class="profile-pic" src="/img/default_profile_pic.png" alt="" height="32">
</object>
@ejhari
ejhari / batch_script.cmd
Created September 16, 2016 01:02
Batch Script
:: Name: batch_script.cmd
:: Purpose: A helper tool.
::
:: References:
:: http://steve-jansen.github.io/guides/windows-batch-scripting/
:: http://www.vectorsite.net/tsbatch.html
:: http://ss64.com/nt/
:: To turn off printing (ECHO’ing) of each batch file line.
:: The @ is a special operator to suppress printing of the command line.
@ejhari
ejhari / gulpfile.js
Last active September 6, 2016 03:41
NodeJS + Express + Gulp + Browsersync
var gulp = require('gulp');
var gulpif = require('gulp-if');
var argv = require('yargs').argv;
var autoprefixer = require('gulp-autoprefixer');
var sass = require('gulp-sass');
var csso = require('gulp-csso');
var buffer = require('vinyl-buffer');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
@ejhari
ejhari / socketio_client.js
Last active September 9, 2017 15:54
SocketIO Setup
/*
* Javascript SocketIO Client v1.4.5
*
*/
// Setup SocketIO to connect to server at
// given path on given namespace.
var socket = io(window.SERVER_URL + '/karma', {
query: 'email='+window.email,
path: '/api/socket.io'
@ejhari
ejhari / redis_dlm.js
Last active September 4, 2016 23:15
Redis Distributed Lock Management
// REF: http://redis.io/topics/distlock
var redis = require('redis');
var Redlock = require('redlock');
var lock_client = redis.createClient(port, host, { db: 1 });
var lock_duration = 300000;, // in ms
var redlock = new Redlock(
@ejhari
ejhari / nginx_php.txt
Created July 28, 2016 16:27
Nginx with PHP
REF
---
http://stackoverflow.com/questions/23390531/access-denied-403-for-php-files-with-nginx-php-fpm
http://stackoverflow.com/questions/21909860/access-denied-on-nginx-and-php
https://www.digitalocean.com/community/questions/php-fpm-security-limit_extension-issue
@ejhari
ejhari / rest_api_doc.sh
Created July 12, 2016 09:51
REST API Documentation
#! /bin/bash
#
# Currently using 'swagger' to create the api doc.
#
# REF: https://github.com/fsbahman/apidoc-swagger
# REF: https://github.com/swagger-api/swagger-ui
#
# ################################################