Skip to content

Instantly share code, notes, and snippets.

@jrwarwick
jrwarwick / teams_chat_notify.sh
Last active September 15, 2021 20:30
Send a notification Message Card to a MS Teams channel chat from a UNIX/LINUX script
#!/usr/bin/bash
# Send a notification to a MS Teams channel's webhook interface.
# Note: originally crafted in a Solaris 11 env.
# usage: im_notify.sh --envcontext TEST --infocontext "ERP System Patching" --infotask "$0 - Apply vendor patch #1" --infostatus "FAILURE" --message "Patching script encountered error! Attention required."
# usage: im_notify.sh --envcontext DEV --infocontext "Long Process Progress" --infotask "$0 script run" --infostatus "SUCCESS" --message "OK, step complete, ready for next step."
# [email protected] 2021
# TODO: parameter to indicate CC message to syslog as well (with local logger)
#Standard Config
SupportURL="https://support.contoso.com/newIssue"
@jrwarwick
jrwarwick / text_obscurer.js
Created June 1, 2021 18:19
Obscure element by ID automatically on a webpage
//just a little alternative to the eye-ball-icon revealer that is meant for sensitive information on a page (to mitigate shoulder-surfing attacks).
(function() {
document.onmousemove = handleMouseMove;
function handleMouseMove(event) {
var eventDoc, doc, body;
event = event || window.event; // IE-ism
// If pageX/Y aren't available and clientX/Y are,
// calculate pageX/Y - logic taken from jQuery.
@jrwarwick
jrwarwick / hexdump.mod
Created May 19, 2021 19:51
Simple quick and dirty hex dump of a string in VBE for debugging ugly hacks
'Quick and dirty hexdump of a string for debugging stuff
' Convert string to bytes
Dim subjectSring As String
Dim abData() As Byte
'read in suspect string into subjectSring here...
abData = StrConv(subjectSring, vbFromUnicode)
For i = 0 To UBound(abData)
Debug.Print Hex(abData(i)); "='" & Chr(abData(i)) & "'"
Next
@jrwarwick
jrwarwick / AD_User_Lockout_summarizer.gl_txt
Created May 11, 2021 17:00
Graylog Pipeline Rules - Active Directory summaries for a Technical Support Service Desk
rule "AD User Lockout event summarize"
when
has_field("winlogbeat_event_data_TargetUserName")
AND contains(to_string($message.winlogbeat_event_id), "4740")
then
//Build up and add a summary field
let summarized_message = concat(to_string($message.winlogbeat_event_data_TargetUserName), " locked out from domain ");
let summarized_message = concat(summarized_message, to_string($message.winlogbeat_event_data_SubjectDomainName));
let summarized_message = concat(summarized_message, "\n\n Reported from ");
let summarized_message = concat(summarized_message, to_string($message.source));
@jrwarwick
jrwarwick / rhel_supplemental_configuration.sh
Created April 27, 2021 18:30
RHEL handy supplements for an enterprise server build
echo "Reconfigure RHEL Cockpit to use our intranet wildcard SSL cert:"
sudo su -
export DOMAIN="your.intranet.domainname.here"
cd /etc/cockpit/ws-certs.d
scp [email protected].${DOMAIN}:/etc/httpd/custom-cert/star* .
curl -LO https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem
cat DigiCertTLSRSASHA2562020CA1.crt.pem >> star.${DOMAIN}.crt
cat star.${DOMAIN}.crt.key >> star.${DOMAIN}.crt
mv star.${DOMAIN}.crt star.${DOMAIN}.cert
remotectl certificate
@jrwarwick
jrwarwick / hero_condense.js
Created April 16, 2021 17:12
Simple partial collapse/condense of a Hero region in Oracle APEX
//prerequisite: assign a static ID to your hero region.
//gets offset and height for total displacement
var heroRegionStaticID = "#pageNavCards";
var bottomofpageNavCards = $(heroRegionStaticID).offset().top + $(heroRegionStaticID).outerHeight();
$(window).scroll(function(){
if($(window).scrollTop() > bottomofpageNavCards){
$("#t_Body_title h1").fadeOut();
$("#t_Body_title div.t-HeroRegion-col.t-HeroRegion-col--left").fadeOut();
}
@jrwarwick
jrwarwick / ssl_cert_expiry_check.sh
Last active December 9, 2020 19:35
SSL Cert Catalog with Expiry Checking
#!/usr/bin/bash
function monthnumber {
month=$(echo ${1:0:3} | tr '[a-z]' '[A-Z]')
MONTHS="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
tmp=${MONTHS%%$month*}
month=${#tmp}
monthnumber=$((month/3+1))
printf "%02d\n" $monthnumber
}
@jrwarwick
jrwarwick / Downstream-gh-pages-refresh.sh
Last active June 22, 2020 18:29
Recipe to refresh upstream gh-pages branch
pushd `git rev-parse --show-toplevel`
git fetch
git checkout gh-pages
git pull
git branch -vv ; git status -vv
git worktree add ./omaster origin/master
cp -uv omaster/LICENSE .
cp -uv omaster/README.md .
@jrwarwick
jrwarwick / Batch radio-ize.txt
Created June 2, 2020 21:19
Audacity Macro: radio comms effect - *krssht* roger, wilco *krsssht*
Macro_radio-ize:
ExportOgg:
ExportMp3:
@jrwarwick
jrwarwick / jira_ssl_certificate_update.ps1
Created May 7, 2020 18:00
JIRA (on Windows) SSL certificate replacement
#### https://confluence.atlassian.com/adminjiraserver085/running-jira-applications-over-ssl-or-https-981155619.html
#### Doc was helpful, but didn't quite cover all situations. Adapted the following from some tomcat-on-Linux work from the past.
## Assumes you are only updating our issued cert, not the whole CA trust chain.
## keystore password is available to you in some secrets repository
# From Admin Elevated PS session on JIRA server: #
$YYYY = $((get-date).tostring('yyyy'))
$YYYYMMDD = $((get-date).tostring('yyyyMMdd'))
$ENV:PATH += ";C:\Program Files\Atlassian\JIRA\jre\bin\;"
$jirakeystorefile = "C:\Program Files\Atlassian\Application Data\JIRA\jira.jks"
$wildcardcertstorefile = "\\resourceserver\share\path\to\new\Certificates\${YYYY}\wildcard_CAsigned_cert_${YYYY}.pfx"