Skip to content

Instantly share code, notes, and snippets.

View carehart's full-sized avatar

Charlie Arehart carehart

View GitHub Profile
@carehart
carehart / show_coldfusion_config_env_vars.cfm
Created November 5, 2025 21:05
Show the various ColdFusion system environment variables found to be defined in the current CF instance
<!--- created by Charlie Arehart, as offered at https://gist.github.com/carehart --->
Following are the various ColdFusion system environment variables defined in this CF instance,
which are typically set in the CF startup "java.args" in the CF Admin or jvm.config.<p>
The focus here is on those which would be set that way as starting with "-DColdFusion.", which
some CF updates offer. They're offered here in alpha order.<p>
This code can be useful to confirm if ones you THINK are set HAVE been set (or vice-versa).<p>
(An * precedes those typically preconfigured by CF to exist, setting system paths, etc. But note that some recent CF updates or installers may preconfigure new settings by default as well.)<p>
@carehart
carehart / #CFLock preso demonstration code - readme
Last active October 1, 2024 21:32
CFLock preso demonstration code
This gist contains several files which demonstrate cflock (for Adobe ColdFusion and Lucee).
They're examples I showed in my talk on the topic at https://www.carehart.org/presentations/#cflock .
You could save all the files in a single folder.
Note that there's an Application.cfc (and cfm and OnRequestEnd, for those preferring that).
Otherwise, the files are numbered in the order presented in my talk, and are generally self-explanatory.
@carehart
carehart / TomcateRemoteIPValveForCloudFlare.txt
Last active October 1, 2024 23:13
Tomcat RemoteIPValve using Cloudflare IP CIDR ranges
<!-- for more, see my Aug 15 2024 comment in my post at https://coldfusion.adobe.com/2019/04/get-cf-know-users-real-ip-address-behind-proxy-load-balancer-caching-solution-etc/#comment-48778 -->
<Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="CF-Connecting-IP"
trustedProxies="
^(173\.245\.(?:4[8-9]|5[0-9]|6[0-3])\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(103\.21\.(?:2(?:4[4-7]))\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(103\.22\.(?:2(?:0[0-3]))\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(103\.31\.(?:[4-7])\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(141\.101\.(?:6[4-9]|[7-9][0-9]|1(?:[0-1][0-9]|2[0-7]))\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(108\.162\.(?:1(?:9[2-9])|2(?:[0-4][0-9]|5[0-5]))\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(190\.93\.(?:2(?:4[0-9]|5[0-5]))\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$|^(18
@carehart
carehart / slowsql.sql
Last active December 25, 2017 04:29
SQL to show running requests in SQL Server
-- Who is running what at this instant
SELECT dest.text AS [Command text] ,
der.total_elapsed_time as 'total_elapsed_time (ms)',
DB_NAME(der.database_id) AS DatabaseName ,
der.command , des.login_time , des.[host_name] , des.[program_name] , der.session_id
FROM sys.dm_exec_requests der
INNER JOIN sys.dm_exec_connections dec
ON der.session_id = dec.session_id
INNER JOIN sys.dm_exec_sessions des
ON des.session_id = der.session_id