Skip to content

Instantly share code, notes, and snippets.

View JamoCA's full-sized avatar

James Moberg JamoCA

View GitHub Profile
@JamoCA
JamoCA / whitespace.cfc
Last active March 27, 2024 19:39
ColdFusion/CFML function that Identifies and performs trim functions on white space-related characters
component displayname="whitespace" output="false" hint="Identifies and performs trim functions on white space-related characters" {
/*
author: James Moberg <james@ssmedia.com>
date: 2019-01-07
Description: Removes all whitespace-related characters (ie, Zero-Width SPaces (ZWSPs)) from a string... not just characters below U+0020.
.NET Trim() really trims a string - also trimming non-breaking-spaces. This is not the case in Java.
http://www.henrikbrinch.dk/Blog/2013/02/28/java-net-string-gotchas-of-the-day/
https://stackoverflow.com/a/4731164/693068
https://stackoverflow.com/a/4307261/693068
@JamoCA
JamoCA / NordVPN-Server-IP-List.txt
Last active March 27, 2024 16:04
NordVPN Server IP List; 2,590 IPs; 2020-02-04T15:31:55Z
103.120.66.35
103.120.66.51
103.227.255.101
103.60.9.27
103.60.9.75
103.62.49.193
103.62.49.195
103.62.49.198
103.62.49.203
103.62.49.205
@JamoCA
JamoCA / SetCookie.cfm
Last active March 12, 2024 17:10
ColdFusion SetCookie UDF to add support for samesite. 2024-03-12 Updated to CFScript, removed pre-CF2016 rules, add initial support for CHIPS
<cfscript>
/* 9/15/2010 http://www.modernsignal.com/coldfusionhttponlycookie
<cfset SetCookie(name="logintoken", value="sometoken", secure=true, httponly=true)>
11/1/2019 Updated to add preserveCase & samesite support
Replacement for cfcookie that handles httponly & samesite cookies
3/12/2024 Support for CHIPS Partitioned https://developers.google.com/privacy-sandbox/3pcd/chips
https://community.adobe.com/t5/coldfusion-discussions/setting-partition-with-cfcookie/m-p/14484584#M197250 */
void function setCookie(required string name, required string value, any expires="", boolean secure=false, string path="/", string domain="", boolean httpOnly=false, boolean encodeValue=true, boolean preserveCase=false, string samesite="", boolean partitioned=false) output=false hint="Replacement for cfcookie that handles httponly & samesite cookies" {
// None, Strict, Lax
if (request.isFlushed()){
@JamoCA
JamoCA / isCyrillic.cfm
Last active March 8, 2024 01:37
This is a ColdFusion UDF to determine if a text string contains any Cyrillic characters. (Returns boolean Yes/No.) The ColdFusion 9 & 10 Regex function doesn't support UTF, so you need to access Java in order to do it.
<cfscript>
function isCyrillic(input){
return javaCast("string", input).matches("(.*)[\u0400-\u04FF](.*)");
/* Prior method that was used. Slower.
return createObject("java", "java.util.regex.Pattern").compile(javaCast("string", "[\u0400-\u04FF]")).matcher(javaCast("string", input)).find();
*/
}
</cfscript>
@JamoCA
JamoCA / Comment-Spam-Email-Addresses.txt
Last active March 6, 2024 18:02
A list of email addresses (or domains when the username is randomized) that are actively blocked using our internal feedback form and/or comment spam filters. Updated regularly. Last Updated: 2024-03-06 (When comparing, sanitize gmail addresses to remove dots & + https://gist.github.com/JamoCA/6f46af76a3f8b9975ccc0623602a92f1 )
@30secondexplainervideos.com
@3dAnimatedVideos.com
@5cvirtualsolutions.com
@90secondexplainervideos.com
@accurate.com
@acquimail.com
@adkarma.com
@advancefunding.xyz
@advantagecapital.xyz
@affiliatesitemasters.com
@JamoCA
JamoCA / EmulateTyping.ahk
Last active February 29, 2024 18:34
AutoHotKey Script to emulate typing. Use CTRL+SHIFT+V to paste clipboard character-by-character as if typing.
^+v:: ; paste text and emulate typing (CTRL+SHIFT+V)
AutoTrim,On
string = %clipboard%
Gosub,ONLYTYPINGCHARS
StringSplit, charArray, string
Loop %charArray0%
{
this_char := charArray%a_index%
Send %this_char%
Random, typeSlow, 1, 3
@JamoCA
JamoCA / zip-codes.com-database-specifications.md
Created January 3, 2024 16:57
Zip-Codes.com Database Specifications (markdown format)

Zip-Codes.com Database Specifications

Our ZIP Code Database contains over 78,000 precise data records. You can download the database once per month (if needed) for a full year. We have made every effort to provide the most accurate and up to date information.

Field Name Data Type Description

# Field Name Data Type Description
01 ZipCode Char(5) 00000-99999 Five digit numeric ZIP Code of the area.
02 City VarChar(35) Name of the city as designated by the USPS.
@JamoCA
JamoCA / Remove_Google_Ad.user.js
Last active December 15, 2023 03:13
Greasemonkey script to remove Google Ads
// ==UserScript==
// @name GoogleNoAds
// @namespace gist.github.com/JamoCA/99505f3dad38f23d3dcaa73a4eb6d030
// @description Remove inline ads from Google
// @include https://www.google.com/
// @version 1.1
// @grant none
// ==/UserScript==
// ==/UserScript==
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
@JamoCA
JamoCA / quoteFonts
Last active December 8, 2023 02:09
QuoteFonts UDF to use regex to add missing single quotes to font names
<!--- 20231207180156
James Moberg / SunStar Media
This is a ColdFusion UDF that uses regex to adds missing single quotes to font names. (CKEditor doesn't consistently quote inline CSS values.)
Fixes HTML generated with this CKEditor4 shortcoming: https://ckeditor.com/old/forums/CKEditor-3.x/Ckeditor-external-fonts-problem
--->
<cfsavecontent variable="test">
style="font-family:'Times New Roman'; Times New Roman"
style="font-family:Times New Roman"
style="font-family:'Times New Roman'; "
@JamoCA
JamoCA / RenamePDFFields.cfm
Created November 18, 2014 18:16
Using ColdFusion & iText to Rename PDF Form Fields
<cfscript>
/* If merging multiple PDFs and field names are not unique, they will all be bound/edited as a single group.
Use this technique to append a generic suffix to each fieldname to make it unique (then ignore/santize during form processing).
Credit ~2009: http://itext-general.2136553.n4.nabble.com/Problem-Renaming-Fields-with-iText-and-ColdFusion-9-td2141953.html
*/
newFieldSuffix = "_" & randRange(1,10000, "SHA1PRNG"); /* Generate a field suffix to make fieldname unique */
inFile = "c:\generic_input_fields.pdf";
outFile = "c:\unique_input_fields" & newFieldSuffix & ".pdf";
pdfReader = createObject("java", "com.lowagie.text.pdf.PdfReader");