Skip to content

Instantly share code, notes, and snippets.

@sigmaprojects
sigmaprojects / saveconntrack.lua
Created December 7, 2014 02:56
Simple Lua script to consume the conntrack table from luci and persist it in a MySQL database
#!/usr/bin/lua
--[[
Author: Don Quist
Date: 12/06/14
https://www.sigmaprojects.org/
https://gist.github.com/sigmaprojects
Simple Lua script to consume the conntrack table from luci and persist it in a MySQL database
--]]
function getDBConnection()
// Application.cfc
public boolean function onRequestStart(String targetPage){
if(structKeyExists(url,"ormreload")) {
ORMReload();
}
return true;
}
@sigmaprojects
sigmaprojects / gist:2847936
Created June 1, 2012 01:35
get handler and events
private void function generateAllPossibleNonExistentRules() event=false {
var configStruct = getSettingsBean().getConfigStruct();
var HandlersInvocationPath = configStruct.HandlersInvocationPath;
var RegisteredHandlers = configStruct.RegisteredHandlers;
var HandlerEvents = {};
for(var i = 1; i<=ListLen(RegisteredHandlers);i++) {
var thisHandler = listGetAt(RegisteredHandlers,i);
var thisHandlerPath = HandlersInvocationPath & '.' & thisHandler;
@sigmaprojects
sigmaprojects / gist:7604343
Last active December 29, 2015 02:59
Modified BugLog client plugin for ColdBox,
<cfcomponent hint="Passes Exceptions and Bug Reports to BugLog" extends="coldbox.system.Plugin" output="false" cache="true" cachetimeout="0">
<cffunction name="init" access="public" returntype="BugLog" output="false">
<cfargument name="controller" type="any" required="true">
<cfscript>
super.Init(arguments.controller);
setPluginName("BugLog");
setPluginVersion("1.2");
setPluginDescription("A Coldbox plugin to log errors using BugLog.");
setPluginAuthor("Donaldo DE SOUSA");
setPluginAuthorURL("http://twitter.com/I_TwitIT");
@sigmaprojects
sigmaprojects / gist:7604389
Created November 22, 2013 18:13
An Async Logger appender for BugLogHQ.
<cfcomponent extends="model.loggers.appenders.BugLogHQAppender"
output="false"
hint="This is a simple implementation of a appender that is BugLogHQ based.">
<!--- Init --->
<cffunction name="init" access="public" returntype="DBAppender" hint="Constructor" output="false" >
<!--- ************************************************************* --->
<cfargument name="name" required="true" hint="The unique name for this appender."/>
<cfargument name="properties" required="false" default="#structnew()#" hint="A map of configuration properties for the appender"/>
<cfargument name="layout" required="false" default="" hint="The layout class to use in this appender for custom message rendering."/>
@sigmaprojects
sigmaprojects / gist:7604402
Created November 22, 2013 18:13
A Logger Appender for BugLogHQ
component extends="coldbox.system.logging.AbstractAppender" output="false"
hint="This is a simple implementation of a appender that is BugLogHQ Plugin based" {
public BugLogHQAppender function init(
Required name,
properties = {},
layout = "",
levelMin = 0,
levelMax = 4
server {
listen 443;
server_name www.domain.com domain.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl on;
ssl_certificate /path/to/.crt;
ssl_certificate_key /path/to/.key;
<cfscript>
function boolean is_authorized(username, password) {
if(username == "admin" && password == "password"){
return true;
}
else
return false;
}
function deleteRecord(id) {
<cfscript>
table = "closure_test_table";
dsn = "a-valid-dsn";
try {
queryExecute(sql="
CREATE TABLE #table# (
[id] INT NOT NULL IDENTITY(1, 1),
[val] varchar(13) NOT NULL,
@sigmaprojects
sigmaprojects / ImageManipulation.cfc
Created January 19, 2014 20:06
A collection of image manipulation methods packaged in a ColdBox plugin. Most of the credit goes to Sean Corfield, Ben Nadel, and http://cfsearching.blogspot.com/
<cfcomponent name="ImageManipulation" hint="Image manipulation functions." extends="coldbox.system.plugin" output="false" cache="false">
<cfproperty name="imageObj" type="any" />
<cfset variables.instance = StructNew() />
<cffunction name="init" access="public" returntype="ImageManipulation" output="false">
<cfargument name="controller" type="any" required="true">
<cfset super.Init(arguments.controller) />
<cfset setpluginName("ImageManipulation")>