Skip to content

Instantly share code, notes, and snippets.

View jeaguilar's full-sized avatar

Juan Aguilar jeaguilar

  • LEAF College Savings
View GitHub Profile
@jeaguilar
jeaguilar / DecryptExcelSpreadsheet.cfm
Created April 11, 2019 17:48
Use POI to decrypt a non-XML encrypted Excel spreadsheet
<cfscript>
try {
// --> Source File: /tmp/EncryptedSpreadsheet.xls
// --> Password: S3cr37P@ssw0rd
// <-- Output File: /tmp/UnencryptedSpreadsheet.xls
// Uses poi-4.0.1.jar from cfsimplicity/lucee-spreadsheet installed in /spreadsheetLibrary
// Load an encrypted Excel spreadsheet using the password
jFile = createObject( "java", "java.io.File").init( "/tmp/EncryptedSpreadsheet.xls" );
<cfparam name="attributes.type" default="html">
<cfswitch expression="#thisTag.ExecutionMode#">
<cfcase value="start">
</cfcase>
<cfdefaultcase>
<!--- *************************************************** --->
<!--- Basic Errors --->
<!--- *************************************************** --->
@jeaguilar
jeaguilar / clean-up-boot-partition-ubuntu.md
Created February 7, 2018 16:45 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
component output="false" displayname="SimplePGP" {
public SimplePGP function init(Required String config="PDS") {
variables.logger = application.logbox.getLogger(this);
switch(arguments.config) {
default: {
variables.publicKeyPath = expandPath('/path/to/key.pub');
@jeaguilar
jeaguilar / queryWithMillisecond.cfm
Created June 15, 2017 19:42
When moving from Lucee 4.5.x to Lucee 5.1.x queries that depended on Now() would no longer work. Using a MySQL log, I determined that queries were being sent with a millisecond value, which would not match records stored in a datetime column.
<cfscript>
try {
/*
Create the table which will save the timestamps
Use datetime(3) for a column which will save the millisecond value
CREATE TABLE `test_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@jeaguilar
jeaguilar / eventHandler.cfc
Created February 8, 2017 16:45
BugLogHQ plugin for Mura. Modifications to plugins/BugLogHQ/plugin/eventHandler.cfc
<cfcomponent extends="mura.plugin.pluginGenericEventHandler" output="false">
<cffunction name="onApplicationLoad" returnType="any" access="public" output="false">
<cfif structKeyExists(application,'bugLogService')>
<cfset structDelete(application,'bugLogService') />
</cfif>
<cfset variables.pluginConfig.addEventHandler(this) />
@jeaguilar
jeaguilar / sendgrid-java-lucee.cfm
Created April 8, 2016 17:26
Sendgrid CFML sample using sendgrid-java.jar and tested on Lucee 4.5
<cfscript>
try {
SendGrid = CreateObject("java", "com.sendgrid.SendGrid", expandPath("sendgrid-java.jar")).init('<API KEY>');
Email = CreateObject("java", "com.sendgrid.SendGrid$Email", expandPath("sendgrid-java.jar"));
Email.addTo("<TO ADDRESS>");
Email.setFrom("<FROM ADDRESS>");
Email.setSubject("Hello World, #getTickCount()#");
Email.setHtml("<p>My <strong>first</strong> email with SendGrid Java!</p>");
@jeaguilar
jeaguilar / encryptDecryptWithAWSKMS.cfm
Last active February 23, 2021 05:18
Basic implementation of encryption and decryption in CFML using AWS KMS and the AWS SDK for Java (Tested on Lucee 4.5)
<cfscript>
// Step 1: Download AWS SDK for Java https://aws.amazon.com/sdk-for-java/
// Step 2: Copy [sdk archive]/lib/aws-java-sdk-1.10.47.jar to WEB-INF/lucee/lib
// Step 3: Create IAM User and obtain basic credentials (Access Key ID and Secret Access Key)
// Step 4: Create IAM Encryption Key add "Step 3 IAM User" as a Key User (remove as Key Administrator)
// Step 5: Obtain Key Id for "Step 4 IAM Encryption Key"
// Reference: http://docs.aws.amazon.com/kms/latest/developerguide/programming-top.html
public Any function getBasicAWSCredentials( required string AccessKeyId, required string SecretAccessKey ) {
return CreateObject(
@jeaguilar
jeaguilar / gist:83a3e784d4b02f390887
Last active March 12, 2019 02:52
Mura Settings.ini.cfm documented and undocumented settings