Skip to content

Instantly share code, notes, and snippets.

View robertmorel-uk's full-sized avatar

Robert Morel robertmorel-uk

  • Robert Morel
  • UK
  • X @NA
View GitHub Profile
@robertmorel-uk
robertmorel-uk / networking-besties.sh
Last active March 4, 2025 09:17
Useful snippets for networking that I use repeatedly
# HSTS status
curl -s -D- https://example.com/ | grep -i Strict
ssh-keygen -t rsa -b 4096 -f ~/.ssh/github_rsa -C "username@hostname"
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/github_ed25519
# Basic add user with SSH
sudo adduser <USER>
sudo su <USER>
ssh-keygen
@robertmorel-uk
robertmorel-uk / mura-stop-bots.cfm
Last active January 22, 2020 15:58
Mura - prevents bots from starting long sessions in Mura /Coldfusion
<!---Place in application.cfc--->
<!--- This checks if a cookie is created, for bots this will return false and use the low session timeout --->
<cfif StructKeyExists(cookie, "cfid" ) or StructKeyExists(cookie, "jsessionid" )>
<cfset this.sessiontimeout=CreateTimeSpan(0,0,30,0) />
1111
<cfelse>
22222
<cfset this.sessiontimeout=CreateTimeSpan(0,0,0,2) />
</cfif>
@robertmorel-uk
robertmorel-uk / mura-if-param-exists.cfm
Created January 17, 2020 12:07
Mura - if param exists in url
<cfif structKeyExists(url, 'subject')>
<div class="form-group">
<input type="hidden" class="form-control" id="Subject" name="subject" value="#URL.subject#">
</div>
<cfelse>
<div class="form-group">
<input type="hidden" class="form-control" id="Subject" name="subject" value="Not specified">
</div>
</cfif>
@robertmorel-uk
robertmorel-uk / wp-add.php
Last active September 18, 2019 19:26
PHP - wp-testing addon
//https://mailme.dev.cc/?x=1&a=1&b=2&c=3&d=4
add_action ('wp_loaded', 'my_custom_redirect');
function my_custom_redirect() {
if(!empty($_GET['x'])){
//set variables from get
$a = sanitize_text_field( $_GET['a'] );
$b = sanitize_text_field( $_GET['b'] );
$c = sanitize_text_field( $_GET['c'] );
$d = sanitize_text_field( $_GET['d'] );
@robertmorel-uk
robertmorel-uk / cfheader.cfm
Created May 29, 2019 19:33
Clear cache in cfheader.cfm
<cfoutput>
<cfheader name="expires" value="#now()#">
<cfheader name="pragma" value="no-cache">
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate">
<!---
The first line says any existing cached items must be expired immediately
The second line informs the browser not to cache
The third line is like telling the browser to do ctrl F5 and always get a fresh copy from the server when loading the page.
--->
</cfoutput>
@robertmorel-uk
robertmorel-uk / cfDumpAll.cfm
Last active May 29, 2019 19:34
Mura - cfdump all the things
<cfdump var="#$.globalConfig().getAllValues()#">
<cfdump var="#$.siteConfig().getAllValues()#">
<cfdump var="#$.content().getAllValues()#">
<cfdump var="#$.currentUser().getAllValues()#">
<cfdump var="#$.event().getAllValues()#">
#$.currentUser().getUsername()#
#$.content().getTitle()#
#$.content().getChildTemplate()#
@robertmorel-uk
robertmorel-uk / customImageAltTag.cfm
Last active May 29, 2019 19:35
Mura set custom alt tag on image with fallback title as alt
<cfscript>
<!---Set alt tag to be user defined or title as fallback--->
function altAltTags(getFileIdVal){
fileid = sub1.getValue('fileid');
if ( sub1.hasImage() ) {
fileMeta = getFileIdVal;
if ( Len(fileMeta.getAltText())){
writeoutput('alt="#fileMeta.getAltText()#"');
}
else{