Skip to content

Instantly share code, notes, and snippets.

View mjclemente's full-sized avatar

Matthew J. Clemente mjclemente

View GitHub Profile
@mjclemente
mjclemente / 20190417131115_test-setup.ts
Created July 21, 2020 17:39 — forked from jukkatupamaki/20190417131115_test-setup.ts
Knex.js & TypeScript config example · How to setup Knex.js in a TypeScript project
import * as Knex from 'knex';
export async function up(knex: Knex): Promise<any> {
return knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
return knex.schema.dropTable('test_setup');
@mjclemente
mjclemente / symbolsToASCII.cfm
Created November 15, 2023 20:58 — forked from JamoCA/symbolsToASCII.cfm
Coldfusion UDF to convert Unicode UTF-8 punctuation and symbols to ASCII7 punctuation for natural language processing (NLP).
<cfscript>
/* 20200604 Map Symbols & Punctuation to ASCII
Convert the Unicode punctuation and symbols to ASCII punctuation and symbols is imperative in Natural language processing (NLP) for preserving the original documents.
Based on mapping from Lexical Systems Group: https://lexsrv3.nlm.nih.gov/LexSysGroup/Projects/lvg/2013/docs/designDoc/UDF/unicode/NormOperations/mapSymbolToAscii.html
Blog: https://dev.to/gamesover/convert-symbols-punctuation-to-ascii-using-coldfusion-java-3l6a
TryCF: https://trycf.com/gist/6f35220d47caa7fdbf75eb884ff1cec7 */
string function symbolsToASCII(required string inputString){
var TempContent = javacast("string", arguments.inputString);
TempContent = TempContent.replaceAll("[\u00B4\u02B9\u02BC\u02C8\u0301\u2018\u2019\u201B\u2032\u2034\u2037]", chr(39)); /* apostrophe (') */
TempContent = TempContent.replaceAll("[\u00AB\u00BB\u02BA\u030B\u030E\u201C\u201D\u201E\u201F\u2033\u2036\u3003\u301D\u301E]", chr(34)); /* quotation mark (") */
@mjclemente
mjclemente / app.e2e-spec.ts
Created August 4, 2020 21:30 — forked from firxworx/app.e2e-spec.ts
NestJS Integration/E2E Testing Example with TypeORM, Postgres, JWT
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication, LoggerService } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
class TestLogger implements LoggerService {
log(message: string) {}
error(message: string, trace: string) {}
warn(message: string) {}
debug(message: string) {}
@mjclemente
mjclemente / xss-owasp-cheatsheet
Created May 12, 2016 21:44 — forked from sseffa/xss-owasp-cheatsheet
xss-owasp-cheatsheet
#
# https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
# based on the RSnake original http://ha.ckers.org/xss.html
# Retrieved on 2013-11-20
# Much of this wildly obsolete
#
# XSS Locator 2
'';!--"<XSS>=&{()}
@mjclemente
mjclemente / application.cfc
Created January 18, 2022 14:24
CFML Datasource from AWS Secrets Manager
this.datasource = 'appdsn_exactoritos';
this.datasources["appdsn_exactoritos"] = getDatabaseConfig();
private struct function getDatabaseConfig() {
var sys = CreateObject("java", "java.lang.System");
var db_is_configured = sys.getProperty("com.app.db_is_configured");
if( isNull( db_is_configured ) ) {
var aws = new modules.awscfml.aws();
@mjclemente
mjclemente / task.cfc
Created December 13, 2021 21:35 — forked from bdw429s/task.cfc
Scan a folder of jars recursively for CVE-2021-44228 vulnerability
/**
* Scan all jars in folder recursivley for log4j vuln
*/
component {
property name="progressableDownloader" inject="ProgressableDownloader";
property name="progressBar" inject="ProgressBar";
/**
* @scanPath absolute or relative path to folder to look for jars
*/
@mjclemente
mjclemente / hashify.cfm
Created September 28, 2021 21:26 — forked from homestar9/hashify.cfm
Hashify (UDF)
<cfscript>
/*
Hashify
http://brianflove.com/2015/02/24/hash-any-coldfusion-type/
*/
private string function hashify(required any value) {
//return an empty string for null
if (IsNull(arguments.value)) {
@mjclemente
mjclemente / server.js
Created September 28, 2021 19:42 — forked from eladnava/server.js
Get Facebook Ads Lead Notifications in Realtime with Node.js
const axios = require('axios');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;
// Enter the Page Access Token from the previous step
const FACEBOOK_PAGE_ACCESS_TOKEN = '_______________________________';
@mjclemente
mjclemente / compressHtml
Created February 16, 2017 22:52 — forked from kevindb/compressHtml
ColdFusion Compress HTML
/**
* @hint Removes whitespace from HTML code
Originally authored by Jordan Clark (JordanClark@telus.net)
*/
public string function compressHtml(
required string html,
numeric level = 2
){
local.response = this.trim(arguments.html);
@mjclemente
mjclemente / PrettyJSON.py
Created April 9, 2021 20:02 — forked from brokaw/PrettyJSON.py
A BBEdit text filter to prettify JSON.
#!/usr/bin/env python3
# A text filter for BBEdit. If it encounters a JSON error, it writes an error
# message to stderr (appears in a new BBEdit window) and leaves the original
# text unaltered. c.f.
# http://crisp.tumblr.com/post/2574967567/json-pretty-print-formatting-in-bbedit
# c.f. http://blog.scottlowe.org/2013/11/11/making-json-output-more-readable-with-bbedit/
import json
import sys