Skip to content

Instantly share code, notes, and snippets.

Avatar

Adrian J. Moreno iknowkungfoo

View GitHub Profile
@iknowkungfoo
iknowkungfoo / web.config
Created Feb 10, 2020
IIS SQL Injection Request Filtering
View web.config
<filteringRules>
<filteringRule name="SQLInjection" scanQueryString="true">
<appliesTo>
<clear />
<add fileExtension=".asp" />
<add fileExtension=".aspx" />
</appliesTo>
<denyStrings>
<clear />
<add string="@@version" />
@iknowkungfoo
iknowkungfoo / ColdFusion: Array of Structs to XML
Created Jun 6, 2019
ColdFusion function to convert an array of structs to proper XML.
View ColdFusion: Array of Structs to XML
<cffunction name="arrayOfStructsToXML" access="public" output="false" returntype="any">
<cfargument name="data" type="array" required="true">
<cfscript>
var buffer = createObject("java","java.lang.StringBuilder").init('');
var y = arrayLen(arguments.data);
var xData = "";
buffer.append('<games>');
for (local.x = 1; local.x <= local.y; local.x++) {
local.stGame = arguments.data[local.x];
buffer.append('<game>');
View [CF] Get ASCII of characters in a string
<cfoutput>
<cfloop from="1" to="#len(loadFields.body)#" index="q">
[#asc(mid(loadFields.body, q, 1))#]-
</cfloop>
</cfoutput>
View Work .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/adrianmoreno/.oh-my-zsh
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
# Set name of the theme to load. Optionally, if you set this to "random"
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_03.cfm
Last active Oct 6, 2018
Convert BlogCFC blog posts to markdown files, which can then be imported into Jekyll static sites like Github Pages and Gitlab Pages. https://adrianmoreno.com/2018/10/06/converting-blogcfc-posts-to-markdown.html
View blogcfc_to_markdown_03.cfm
<cfsavecontent variable="post">---
layout: post
title: "#blogTitle#"
date: #blog.post_date# #blog.post_time# -0500
categories: #blog.post_categories#
redirect_from:
- /blog/index.cfm/#year(blog.post_date)#/#month(blog.post_date)#/#day(blog.post_date)#/#blog.post_alias#/
- /blog/index.cfm/#year(blog.post_date)#/#month(blog.post_date)#/#day(blog.post_date)#/#blog.post_alias_lower#/
---
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_02.cfm
Last active Oct 6, 2018
Convert BlogCFC blog posts to markdown files, which can then be imported into Jekyll static sites like Github Pages and Gitlab Pages. https://adrianmoreno.com/2018/10/06/converting-blogcfc-posts-to-markdown.html
View blogcfc_to_markdown_02.cfm
<cfoutput>
<cfloop query="blog">
<cfset blogPost = blog.post_more>
<cfif len(blogPost) GT 0>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\/h[0-9]\>", "", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h1\>", "#chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h2\>", "#chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h3\>", "#chr(35)##chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h4\>", "#chr(35)##chr(35)##chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h5\>", "#chr(35)##chr(35)##chr(35)##chr(35)##chr(35)# ", "all")>
View integerListToTable.sql
/*
******* Run on both main and US Soccer databases ********
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION dbo.integerListToTable ( @strString varchar(max))
View ArrayCollection
/**
* @author Adrian J. Moreno
* @website http://iknowkungfoo.com
* @Twitter: @iknowkungfoo
* @hint: A custom JSON render object for ColdFusion queries.
* @Repo: https://github.com/iknowkungfoo/cfquery-to-json
* @version 4.0
* @requirements ColdFusion 9.0+ or Railo 4+
* @BlogPost: http://cfml.us/Ce
*/
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_01.cfm
Last active Oct 6, 2018
Convert BlogCFC blog posts to markdown files, which can then be imported into Jekyll static sites like Github Pages and Gitlab Pages. https://adrianmoreno.com/2018/10/06/converting-blogcfc-posts-to-markdown.html
View blogcfc_to_markdown_01.cfm
<cfquery name="blog" datasource="iknowkungfoo">
SELECT
cte.post_id
, cte.post_title
, cte.post_body
, cte.post_more
, cte.post_date
, cte.post_time
, cte.post_alias
, group_concat(LCASE(cte.post_category) order by cte.post_category separator ' ') as post_categories
@iknowkungfoo
iknowkungfoo / grep_emails_in_files.md
Last active Dec 13, 2018
This will output a list of all emails in a specific file or in a folder.
View grep_emails_in_files.md

File

Find in a single file:

grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" someFile.txt

Folder

You can’t perform that action at this time.