Skip to content

Instantly share code, notes, and snippets.

@geek0x23
geek0x23 / klixui_ultrawide_fixer.lua
Last active September 1, 2018 02:45
Creates a healer, and normal BigWigs profile that cooperates with KlixUI on ultrawide monitors
local E, L, V, P, G = unpack(ElvUI);
local KUF = E:NewModule('Klix_Ultrawide_Fixer');
SLASH_KLIXUWFIXER1 = "/fixklix"
SlashCmdList["KLIXUWFIXER"] = function()
-- fix bigwigs
BigWigs3DB = {
["namespaces"] = {
["BigWigs_Plugins_Victory"] = {
},
@geek0x23
geek0x23 / rules
Last active May 15, 2017 19:24
Ubiquiti EdgeRouter ERPoe-5 Basic NAT
set firewall all-ping enable
set firewall broadcast-ping disable
set firewall ipv6-receive-redirects disable
set firewall ipv6-src-route disable
set firewall ip-src-route disable
set firewall log-martians enable
set firewall receive-redirects disable
set firewall send-redirects enable
set firewall source-validation disable
set firewall syn-cookies enable
@geek0x23
geek0x23 / readme.md
Created May 6, 2014 22:12
Bulwark Synopsis

Bulwark: Node.js + PKCS#11

Bulwark is a native Node.js addon that utilizes the RSA PKCS#11 API (v2.20) to perform cryptographic operations. This module, specifically, acts as a common layer upon which various vendor-specific additions can be made.

Bulwark utilizes tjfontaine's excellent node-addon-layer which provides a nice Node.js add-on interface for C. This allows us to avoid writing the add-on in C++. It also gives us a clean upgrade path forward, when the node-addon-layer is baked into the Node.js core.

Installation

Installation of Bulwark is fairly straightforward. Just use npm:

@geek0x23
geek0x23 / middleware.js
Created February 18, 2013 22:52
browserify middleware with a file whitelist and very rudamentary caching.
"use strict";
var browserify = require("browserify"),
b = browserify(),
bundles = [];
module.exports = {
browserify: function(app) {
return function(req, res, next) {
// whitelist what we bundle.
@geek0x23
geek0x23 / app.js
Created February 15, 2013 04:03
So I wanted to get connect-flash messages to display in my dust templates in Express 3. This feels a bit hacky, but it's the best I could come up with to make things truly dust-friendly and keep my templates clean.
// hook up connect-flash
app.use(require("connect-flash")());
// now hook up middleware that plays nicely with connect-flash and dust.js
app.use(function(req, res, next) {
// dust.js will pass arguments to this function, so we can't use bind
// or a simple proxy because connect-flash will think we're adding a
// message instead of retrieving them
res.locals.flash = function() {
var result = req.flash(), prop, messages = [], count;
@geek0x23
geek0x23 / hash.js
Last active December 13, 2015 18:38
A simple async PBKDF2 hashing library which I wrote based on the ideas behind StackOverflow's implementation. I haven't had the chance to test it yet, but it should be pretty close :)
"use strict";
var crypto = require("crypto"),
saltSize = 16,
hashIterations = 5000;
function generateSalt(iterations, cb) {
if (iterations === undefined) { iterations = hashIterations; }
if (iterations < hashIterations) { throw new Error("iterations cannot be less than " + hashIterations); }
@geek0x23
geek0x23 / app.js
Created January 3, 2012 20:34
simple express routing PoC for error handling
// Includes
var express = require('express'),
errors = require('./errors'),
NotFound = errors.NotFound,
app = module.exports = express.createServer();
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
@geek0x23
geek0x23 / csrf.js
Created December 4, 2011 23:41
A wrapper for the default connect/express csrf middleware that adds ignore support
var express = require('express'),
_ = require('underscore'),
parse = require('url').parse;
exports = module.exports = load;
exports.ignore = ['/api/method1', '/api/method2'];
function load(options) {
var defaultCsrf = express.csrf(options);
@geek0x23
geek0x23 / customer.js
Created November 9, 2011 01:41
A mongoose model that takes advantage of the handy invalidate method to run multiple validations
var mongoose = require('./db-connect'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
uuid = require('node-uuid'),
Validator = require('validator').Validator,
val = new Validator(),
bcrypt = require('bcrypt');
Validator.prototype.error = function(msg) { return false; };