Skip to content

Instantly share code, notes, and snippets.

View adamcin's full-sized avatar

Mark Adamcin adamcin

View GitHub Profile
@adamcin
adamcin / bash_starter.sh
Created May 24, 2022 14:57
bash_starter.sh
#!/bin/bash
# Template for a multi-command bash script with online help by convention
# based on $0-dispatch pattern described here:
# https://www.oilshell.org/blog/2020/02/good-parts-sketch.html#the-0-dispatch-pattern-solves-three-important-problems
set -o nounset
set -o pipefail
set -o errexit
__describe() {
echo "a global description for the tool"
@adamcin
adamcin / functions.php
Created April 3, 2022 21:46
Expired Event SearchWP query mod filter for Event Espresso
<?php
add_filter( 'searchwp\query\mods', function( $mods, $query ) {
global $wpdb;
$today = new DateTime(date('Y-m-d'));
$today = $today->format('Y-m-d H:i:s');
// Retrieve Source name to use with Mod.
$source = \SearchWP\Utils::get_post_type_source_name( 'espresso_events' );
@adamcin
adamcin / pom.xml
Last active July 18, 2019 18:55
oakpal-usage
<plugin>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal-maven-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<checklists>
<checklist>basic</checklist>
<checklist>acs-commons-integrators</checklist>
<checklist>content-class-aem65</checklist>
</checklists>
@adamcin
adamcin / docker-adaptive-java.sh
Last active April 30, 2018 15:54
use in place of $JAVA_HOME/bin/java for java tasks running in ECS. since AWS ECS restricts task placement based on the memory limit settings, this script is better than using -XX:+UseCGroupMemoryLimitForHeap since it incorporates -XX:MaxMetaspaceSize to calculate -XX:MaxHeapSize
#!/usr/bin/env bash
set -eo pipefail
readonly CGROUP_MEM_LIMIT_FILE=/sys/fs/cgroup/memory/memory.limit_in_bytes
readonly MIN_MAXMETASPACESIZE=64m
# filename: docker-adaptive-java.sh
# usage: use in place of $JAVA_HOME/bin/java
# * insert --testlimit <totalMemory> before -jar or classname to override the cgroup limit,
# for testing behavior of this script outside of a cgroup.
# * insert --javacmd <command> before -jar or classname to override JRE_HOME- or JAVA_HOME-relative
# bin/java command
/*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the
@adamcin
adamcin / Sling_Reverse_Proxy.md
Last active October 25, 2016 12:20
Replace Adobe's Dispatcher module for Apache with one built on Sling.

What is Dispatcher?

From Dispatcher - docs.day.com:

"Dispatcher is Adobe Experience Manager's caching and/or load balancing tool. Using AEM's Dispatcher also helps to protect your AEM server from attack. Therefore, you can increase the security of your AEM instance by using the Dispatcher in conjunction with an enterprise-class web server."

Specifically, the Dispatcher module is used to perform these critical functions:

  1. URL-based Security Filter
  2. HTTP Response Cache