Skip to content

Instantly share code, notes, and snippets.

View randy-johnson's full-sized avatar

Randy Johnson randy-johnson

View GitHub Profile
@GAS85
GAS85 / http2_apache2_ubuntu18.04.md
Last active September 29, 2023 12:00
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 18.04

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 18.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

@steveheinsch
steveheinsch / gist:287edd5ce26e608b06b20af384f4cc1e
Last active September 26, 2022 21:53
Function to retrieve all lookup key/values for a Resource/Class in PHRETS 2+
<?php
// Note: $this->server is a "logged in" PHRETS $session
public function getLookupValues($resourceName, $className)
{
$results = array();
// Get Table Metadata for this resource/class
$tableMeta = $this->server->GetTableMetadata($resourceName, $className);
@JamoCA
JamoCA / limiter_UDF.cfm
Last active August 21, 2018 00:25
An update to a ColdFusion-based limiter UDF to throttle requests. Using HTTP status 429, CacheGet/Push (for automatic collection flushing) and cookie filters.
<cffunction name="limiter">
<!---
by Charlie Arehart, charlie@carehart.org, in 2009, updated 2012
http://www.carehart.org/blog/client/index.cfm/2010/5/21/throttling_by_ip_address
- Throttles requests made more than "count" times within "duration" seconds from single IP.
- sends 503 status code for bots to consider as well as text for humans to read
- also logs to a new "limiter.log" that is created automatically in cf logs directory, tracking when limits are hit, to help fine tune
- note that since it relies on the application scope, you need to place the call to it AFTER a cfapplication tag in application.cfm
- updated 10/16/12: now adds a test around the actual throttling code, so that it applies only to requests that present no cookie, so should only impact spiders, bots, and other automated requests. A "legit" user in a regular browser will be given a cookie by CF after their first visit and so would no longer be throttled.
- I also tweaked the cflog output to be more like a csv-format output
@JamoCA
JamoCA / isEmail_java.cfm
Last active September 18, 2019 20:16
Dominic Sayers' is_email() Java integration w/ColdFusion. Adds DNS/MX check. Better validation than ColdFusion's isValid() or any regex.
<cfscript>
/* Copy IsEMail.jar to java path. Download from https://code.google.com/p/isemail/downloads/list */
/* Comparison of methods available at https://gamesover2600.tumblr.com/post/152034073124/clientserver-side-email-validation-compared */
emails = ["test@test.com",
"valid_but_no_mx@fake-domain.com",
"valid_but_no_dns@fake-domain2.com",
"""much.more unusual""@example.com",
"john.smith@example.com(comment)",
"""first\last""@iana.org",
"first.last@com",
@randomweapon
randomweapon / csv.cfc
Created May 8, 2012 23:40
convert a CSV to query in coldfusion
<cfcomponent>
<cffunction name="csvToQuery">
<cfargument name="data" default="">
<cfargument name="cols" default="">
<cfargument name="delimiter" default=",">
<cfscript>