Skip to content

Instantly share code, notes, and snippets.

View adityamukho's full-sized avatar

Aditya Mukhopadhyay adityamukho

View GitHub Profile
@adityamukho
adityamukho / run-tests.js
Last active March 29, 2019 08:41
Selectively run ArangoDB Foxx tests by specifying file patterns and `grep` expressions. (Tested with ArangoDB 3.4)
//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 August 29, 2015 14:01
Node Box SDK Middleware Example
<!--views/account.ejs-->
<p>ID: <%= user.id %></p>
<p>Name: <%= user.name %></p>
@adityamukho
adityamukho / 90-firewall.conf
Last active February 11, 2021 09:40
Secure an Arch Linux instance to run as a public server.
# /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 April 29, 2021 03:25
Setup a CHROOT jail at `/srv/http` for a public Nginx server on Arch Linux.
#!/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 September 19, 2013 07:49
Minifying + Compressing an AngularJS App
#!/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 December 23, 2015 10:09
BIRT SSO with Drupal 7
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 November 11, 2021 21:41
Passport authentication for Sails.js 0.9.x
/**
* 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) {