Skip to content

Instantly share code, notes, and snippets.

View IftekharDani's full-sized avatar

Iftekhar Dani IftekharDani

  • Ahmedabad.
View GitHub Profile
@IftekharDani
IftekharDani / install.md
Last active April 20, 2018 11:02
Configure Logwatch in OS X
  1. Download the most current version of logwatch.

  2. Extract : tar xvf logwatch-7.3.6.tar

  3. cd to the logwatch directory created above.

  4. Install the logwatch package: sudo bash install_logwatch.sh

  5. Change location To : /usr/local/logwatch

  6. Copy the conf files and service script files into the new location:

    cp -r conf/* /etc/logwatch/conf/

cp -r scripts/services/* /etc/logwatch/scripts/services

@IftekharDani
IftekharDani / jwt.js
Last active April 10, 2018 11:17
Node Js + express + MongoDb role-based permissions middleware.
const jwt = require('jwt-simple');
const jwtUtil = {};
jwtUtil.getAuthToken = (data) => {
return jwt.encode(data, process.env.JwtSecret);
};
jwtUtil.decodeAuthToken = (token) => {
if (token) {
@IftekharDani
IftekharDani / app.js
Created April 10, 2018 07:25 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection