Skip to content

Instantly share code, notes, and snippets.

View chaorace's full-sized avatar
☠️
You are likely to be eaten by a grue.

Christopher Crockett chaorace

☠️
You are likely to be eaten by a grue.
View GitHub Profile
@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 February 18, 2024 14:05
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 August 21, 2023 17:09
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 englarges 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/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
@chaorace
chaorace / Base Files
Created July 30, 2020 03:39
Linux Civ6 file trees (10.0.3.31)
~/steam/SteamLibrary/steamapps/common/Sid Meier's Civilization VI/steamassets/base/assets λ tree -P '*.xml|*.lua'
.
├── arx
├── benchmark
│   └── saves
├── civ6_22dc49ee484bf6d6.xml
├── civ6_82813892b635e346.xml
├── civ6_829a766ba6fe2e17.xml
├── civ6_88046f9c02be9843.xml
├── civ6_885bb9ad2b28bac3.xml
@chaorace
chaorace / sound-switcher.js
Created June 10, 2020 02:53
Linux pacmd (PulseAudio) output device sink toggler script
#!/usr/bin/node
// You will need node.js installed to run this!
// Invoke this script to toggle between the two configured devices
// Make sure the following is configured in /etc/pulse/default.pa:
// load-module module-stream-restore restore_device=false
// Configure the two devices to toggle between here
// Use "pacmd list-sinks" to find device names to use here, the script won't work if you don't!