Skip to content

Instantly share code, notes, and snippets.

View chaorace's full-sized avatar

Christopher Crockett chaorace

View GitHub Profile
@chaorace
chaorace / Form + List Compatible Template
Created October 26, 2024 05:21
One-Way Client/Server UI Action
function demoOnClick() {
// CLIENT-SIDE CODE GOES HERE
// DATA STORAGE
var responseData = JSON.stringify(null); // Replace null with real data
if (typeof g_list !== 'undefined' && g_list) {
g_list.filter = responseData;
return g_list.action(undefined, 'sysverb_XXX');
} else {
addHidden(
@chaorace
chaorace / Config: config.lisp
Last active July 7, 2024 01:13
Nyxt extension nx-passt: a pass interface with filename-based username support. See also: https://github.com/atlas-engineer/nyxt/issues/3293
(define-nyxt-user-system-and-load "nyxt-user/nx-passt"
:depends-on (:nx-passt) :components ("passt.lisp"))
@chaorace
chaorace / config.el
Created October 20, 2023 19:19
Sync systemd/D-Bus environment variable updates w/ Emacs daemon
;; Ensures that any change pushed to the systemd environment (e.g.: via dbus-update-activation-environment) immediately applies to the Emacs daemon process without needing to kill it first
;; This is useful for example if you run Emacs as a systemd user service and it happens to start before your WM, since this normally causes DISPLAY / WAYLAND_DISPLAY to be missing
;; Ensuring the variable is synced will fix issues like GUI apps not launching when invoked by emacs (e.g.: via xdg-open/shell mode)
;; Obviously, this code depends on D-Bus!
(dbus-register-monitor
:session
(lambda (&rest args)
(unless (null args)
(mapc
(lambda (var-expression)
@chaorace
chaorace / oneliners.sh
Created July 12, 2023 14:27
Easy Linux OCR Kanji Lookup Oneliners
# These oneliners summon a mouse-based region picker, OCRs the selected area, then sends the text to goldendict. I use these in my linux desktop keybind config files
# NOTE: Goldendict needs to be configured for your target language! For Japanese, see https://jd4gd.com/index.html
# NOTE: Available languages for gazou are "jpn", "chi_sim", and "chi_trad"
# Wayland version
# Requirements: grim (wayland screenshotter), slurp (wayland region picker), gazou (OCR), goldendict (dictionary)
# Arch/Paru requirements install: paru -S community/grim community/slurp aur/gazou-git aur/goldendict
grim -g "$(slurp)" - | gazou -l jpn | xargs -I{} goldendict "{}"
# X11 version
@chaorace
chaorace / ServiceNow Java Classes & Methods
Last active September 3, 2024 07:18
ServiceNow Tokyo Whitelisted Packages
This is a list of all Java classes that are whitelisted for use in global ServiceNow background scripting as of the Tokyo release
Everything is derived from log output of GlideWhiteListManager.get().logMemberWhitelistEntries() and GlideWhiteListManager.get().logClassWhitelistEntries()
Many, but NOT ALL of these should be accessible via the global "Packages" object.
- e.g. The Java string class (java.lang.String) can be accessed as: Packages.java.lang.String
FYI: ServiceNow has deprecated directly accessing Java classes in this way and will REFUSE to support customer code that does this
NOTE: java.* classes will generally be aligned with JDK 7 and are fully documented in the public JavaDocs
- https://docs.oracle.com/javase/7/docs/
@chaorace
chaorace / pa-variations.json
Created May 24, 2022 21:56
NHK Pitch Accent Variations Scrape JSON
{
"アー": [
"ああ(~言う)",
"ああ{嗚呼}"
],
"アイコ": [
"あいこ(勝負なし)",
"愛護"
],
"アイショー": [
@chaorace
chaorace / sn-vimify.user.js
Last active October 19, 2024 11:42
Userscript to enable Vim mode in most ServiceNow script fields. Also dynamically resizes the editor to fit content
// ==UserScript==
// @name SNOW CodeMirror Vim activator & embiggener
// @description Enables vim mode for ServiceNow in most script editor fields. Also enlarges the field!
// @namespace https://gist.githubusercontent.com/chaorace/dc49a18f876a9814c8b27d637bfb4f44/raw/sn-vimify.user.js
// @updateURL https://gist.githubusercontent.com/chaorace/dc49a18f876a9814c8b27d637bfb4f44/raw/sn-vimify.user.js
// @supportURL https://gist.github.com/chaorace/dc49a18f876a9814c8b27d637bfb4f44
// @include http://*.service-now.com/*
// @include https://*.service-now.com/*
// @require https://codemirror.net/3/keymap/vim.js
// @run-at document-idle
@chaorace
chaorace / staticNowMetaTypesMap.ts
Created August 27, 2020 18:31
The table/directory mapping used by the Service Now VSCode extension
export const StaticNowMap: IStaticNowMap = {
// Scriptable files
"SysNamesMap": {
"Data Model": {
"Relationships": "sys_relationship"
},
"Forms & UI": {
"Schedule Pages": "cmn_schedule_page",
"Styles": "sys_ui_style",
"Map Pages": "cmn_map_page",
@chaorace
chaorace / gist:f34db6fbcb273b787089257d77227d29
Last active August 27, 2020 14:34
ServiceNow Babel Helpers
/* eslint-disable */
var babelHelpers = (function() {
var decoratorsApi = {
elementsDefinitionOrder: [["method"], ["field"]],
initializeInstanceElements: function (O, elements) {
["method", "field"].forEach(function (kind) {
elements.forEach(function (element) {
if (element.kind === kind && element.placement === "own") {
this.defineClassElement(O, element);
}
@chaorace
chaorace / gist:c25a18612cbdfbd5cacafcd52f2375c1
Created August 4, 2020 19:15
ServiceNow GlideElement to JS native data conversion function (Global Scope)
/**
* Processes a given GlideElement into the closest available JS type
*
* Will return null if the value is empty or if the field is misconfigured.
* Will return undefined if value is exactly equal to undefined.
*
* Note that journals will only yield HTML output if both preferFullJournal and preferHtml options are true.
*
* @param {GlideElement_proto} value The GlideElement to convert
* @param {Object} [options] Options container. All provided options are off by default