Skip to content

Instantly share code, notes, and snippets.

Aditya Mukhopadhyay adityamukho

View GitHub Profile
@adityamukho
adityamukho / run-tests.js
Last active Mar 29, 2019
Selectively run ArangoDB Foxx tests by specifying file patterns and `grep` expressions. (Tested with ArangoDB 3.4)
View run-tests.js
//Include in your service's scripts folder. Add a reference to it in manifests.json under the "scripts" object.
'use strict';
const manager = require('@arangodb/foxx/manager');
const { get } = require('lodash');
const fs = require('fs');
const Minimatch = require('minimatch').Minimatch;
const isWindows = require('internal').platform.substr(0, 3) === 'win';
const mocha = require('@arangodb/mocha');
@adityamukho
adityamukho / account.ejs
Last active Aug 29, 2015
Node Box SDK Middleware Example
View account.ejs
<!--views/account.ejs-->
<p>ID: <%= user.id %></p>
<p>Name: <%= user.name %></p>
@adityamukho
adityamukho / 90-firewall.conf
Last active Dec 27, 2015
Secure an Arch Linux instance to run as a public server.
View 90-firewall.conf
# /etc/sysctl.d/90-firewall.conf
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 2
@adityamukho
adityamukho / nginx-jail.sh
Last active Dec 21, 2017
Setup a CHROOT jail at `/srv/http` for a public Nginx server on Arch Linux.
View nginx-jail.sh
#!/bin/bash
pacman -S nginx
export JAIL=/srv/http
# Create Necessary Devices
mkdir $JAIL/dev
mknod -m 0666 $JAIL/dev/null c 1 3
mknod -m 0666 $JAIL/dev/random c 1 8
mknod -m 0444 $JAIL/dev/urandom c 1 9
@adityamukho
adityamukho / build.sh
Created Sep 19, 2013
Minifying + Compressing an AngularJS App
View build.sh
#!/bin/bash
ccred=$(echo -e "\033[0;31m")
ccyellow=$(echo -e "\033[0;33m")
ccgreen=$(echo -e "\033[0;32m")
ccend=$(echo -e "\033[0m")
exit_code=0
cd "$(git rev-parse --show-toplevel)"
@adityamukho
adityamukho / AuthFilter.java
Last active Dec 23, 2015
BIRT SSO with Drupal 7
View AuthFilter.java
public class AuthFilter implements Filter
{
private static final boolean debug = false;
// The filter configuration object we are associated with. If
// this value is null, this filter instance is not currently
// configured.
private FilterConfig filterConfig = null;
public AuthFilter ()
@adityamukho
adityamukho / User.js
Last active Mar 7, 2019
Passport authentication for Sails.js 0.9.x
View User.js
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {
You can’t perform that action at this time.