Skip to content

Instantly share code, notes, and snippets.

Avatar
📦
There's a box for that

Brad Wood bdw429s

📦
There's a box for that
View GitHub Profile
View gist:90e982de376177854cb606b0d97ea5d9
<cfscript>
foo = 'bar';
```
<cfset baz = foo>
<cfscript>
bum = baz;
```
<cfdump var="#bum#">
@bdw429s
bdw429s / task.cfc
Created Oct 6, 2021
CommandBox Task Runner for creating Screenshot of website with Microsoft's Playwright lib
View task.cfc
component {
function run( webURL='https://www.ortussolutions.com' ) {
if( !directoryExists( resolvePath( 'lib' ) ) ) {
command( 'install "jar:https://search.maven.org/remotecontent?filepath=com/microsoft/playwright/playwright/1.15.2/playwright-1.15.2.jar"' ).run();
command( 'install "jar:https://search.maven.org/remotecontent?filepath=com/microsoft/playwright/driver-bundle/1.15.2/driver-bundle-1.15.2.jar"' ).run();
command( 'install "jar:https://search.maven.org/remotecontent?filepath=com/microsoft/playwright/driver/1.15.2/driver-1.15.2.jar"' ).run();
command( 'install "jar:https://search.maven.org/remotecontent?filepath=org/netbeans/external/com-google-gson/RELEASE113/com-google-gson-RELEASE113.jar"' ).run();
}
@bdw429s
bdw429s / STIG-CFConfig.json
Created Jan 27, 2020
Here is an example lockdown for a ColdFusion server that can be applied via CFConfig
View STIG-CFConfig.json
{
"adminAllowConcurrentLogin":false,
"adminAllowedIPList":"127.0.0.1,192.168.50.10",
"adminLoginRequired":true,
"adminRDSEnabled":"false",
"adminRDSLoginRequired":"true",
"adminRDSUserIDRequired":false,
"adminRootUserID":"cfadm",
"adminUserIDRequired":true,
"ajaxDebugWindowEnabled":false,
View gist:25db10d3f8a1b4df1826b8eca96e1d8f
176.58.112.34 lucee.org
205.210.189.210 download.lucee.org extension.lucee.org release.lucee.org update.lucee.org
99.84.216.74 cdn.lucee.org
@bdw429s
bdw429s / task.cfc
Created Jan 17, 2019
CommandBox Task Runner to download packages from RiaForge
View task.cfc
/**
* Scrape all the binaries from RiaForge
*/
component {
property name="progressableDownloader" inject="ProgressableDownloader";
property name="progressBar" inject="ProgressBar";
function run() {
directoryCreate( resolvePath( 'downloads' ), true, true );
var projects = deserializeJSON( fileRead( 'http://riaforge.org/index.cfm?event=json.projects' ) );
View byteCodeSize.cfm
<cfscript>
/*
This script will take a relative path to a CFC or CFM file in your application, analyze it's corresponding bytecode and
measure approximately how many Bytes of bytecode were generated for each line of your CFML code. There's not any one-to-one
correlation between CFML code and bytecode. Some lines of your source code generate no bytecode such as comments or whitespace.
Other lines of CFML code may generate hundreds of bytes of code.
This is more for the fun of it. It has been tested on Lucee 5.2.9.31. It will not work on Adobe and may cease to work on
future versions of Lucee if the BCEL library is no longer bundled by default.
*/
View gist:747e993d40ab1af5e7d843fce2fe23f6
component {
function run() {
var terminal = shell.getReader().getTerminal();
var capability = createObject( 'java', 'org.jline.utils.InfoCmp$Capability' );
var keys = createObject( 'java', 'org.jline.keymap.KeyMap' );
var bindingReader = createObject( 'java', 'org.jline.keymap.BindingReader' ).init( terminal.reader() );
keys.bind( capability.key_left.name(), keys.key( terminal, capability.key_left ) );
View gist:42d015efe8270c384ff4cb6ced8d1840
May 07, 2018 10:58:52 AM org.jline.utils.Log logr
FINE: Error creating JNA based terminal: C:\Users\user.name\AppData\Local\Temp\1\jna--337510509\jna1825582816334583471.dll: Access is denied
java.lang.UnsatisfiedLinkError: C:\Users\user.name\AppData\Local\Temp\1\jna--337510509\jna1825582816334583471.dll: Access is denied
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:906)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:881)
@bdw429s
bdw429s / slackFileDelete.cfc
Last active May 22, 2018
This is a CommandBox Task Runner that will delete file from your Slack team that are older than 30 days. Please see the first comment for usage instructions.
View slackFileDelete.cfc
/**
* Delete Slack files older than 30 days
*/
component {
function run( token='', user='' ) {
if( !token.len() ) {
error( 'Need an API token provided. Edit this task or pass it as ":token=foobar".' );
}
View task.cfc
component {
property name='printer' inject='print';
function run() {
var lines = [
// bold text. Bold works on regular output, but not on prompt
'#chr(27)#[1mtest#chr(27)#[0m',
// bold GREEN text. Bold works on prompt but not on regular ouptut!
'#chr(27)#[1m#chr(27)#[32mtest#chr(27)#[0m',