Skip to content

Instantly share code, notes, and snippets.

View restump's full-sized avatar

Reuben Stump restump

  • Philadelphia, PA
View GitHub Profile
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
makeAssignments(reqItem, assignments, rule_variables, loggers);
/** Context contains
* reqItem - request item (sc_req_item) that the rule is running against
* assignments - name/value pairs set by previous rule assignments - assigning values to variables of the request item
* rule_variables - name/value pairs set by previous rule assignments with temporary values that do not persist after the rule finishes making assignments
* loggers - collection of logging functions, to use:
* loggers.log(msg, loggers.executor);
* loggers.logError(msg, loggers.executor);
* loggers.logWarning(msg, loggers.executor);
@restump
restump / AnsibleRegexSearchHTML.yml
Last active August 10, 2023 08:39
Example demonstrating string extraction from HTML content in Ansible with regex_search filter plugin
---
- hosts: localhost
connection: local
tasks:
- uri:
url: https://rstumph2.service-now.com/stats.do
return_content: yes
register: response
@restump
restump / ISODateTimeToGlideDateTime.js
Last active June 4, 2025 09:59
ServiceNow javascript function to convert ISO8601 DateTime strings to GlideDateTime objects
/* function : ISODateTimeToGlideDateTime()
Convert ISO8601 DateTime string to GlideDateTime object
*/
function ISODateTimeToGlideDateTime(s) {
if ( (s == '') || (s == null) ) {
return null;
}
// GlideDateTime constructor expects date format: 'YY-MM-DD HH::MM::SS'
parts = s.split(/[-TZ:+]/g);