Skip to content

Instantly share code, notes, and snippets.

View kr4uzi's full-sized avatar

Markus Kraus kr4uzi

  • Switzerland
View GitHub Profile
//
// Intrux Business Rule Validator
// - checks if the referenced SysIDs used in the 'Filter Conditions' point to existing records
// - pure read only: does not alter anthing
//
// Copyright (c) 2025 Intrux GmbH
// All rights reserved.
//
if (['global', 'rhino.global'].indexOf(gs.getCurrentScopeName()) == -1) {
@kr4uzi
kr4uzi / HttpClient.py
Last active August 14, 2025 05:21 — forked from cetteup/HttpClient.py
BF2Hub stats Python ("decompiled" source code)
# uncompyle6 version 3.9.3.dev0
# Python bytecode version base 2.3 (62011)
# Decompiled from: Python 3.8.10 (default, Jul 29 2024, 17:02:10)
# [GCC 9.4.0]
# Embedded file name: /tmp/bf2c/bf2hub/HttpClient.py
# Compiled at: 2014-09-03 19:41:22
import socket, string
from urlparse import urlparse
class HttpClient:
@kr4uzi
kr4uzi / dns.cpp
Created July 30, 2025 07:48
Backup of my gamespy-emulator dns implementation
// the dns implementation was removed from the gamespy-emulator because i found that
// redirecting calls from ::gethostbyname requires less technical boiler plate and
// who'd want to change their dns configuration anyways?
// dns_details.h
#include <string>
#include <cstdint>
#include <vector>
#include <span>
#include <map>
@kr4uzi
kr4uzi / game
Created June 8, 2025 16:18
macos_game_mode
#!/usr/bin/env swift
import Foundation
import AppKit
let handle = dlopen("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", RTLD_NOW)
guard let symConnection = dlsym(handle, "_CGSDefaultConnection"),
let symSetProp = dlsym(handle, "CGSSetConnectionProperty") else {
print("Failed to load CGS symbols")
@kr4uzi
kr4uzi / ServiceNow Java Classes & Methods
Created August 30, 2024 20:47 — forked from chaorace/ServiceNow Java Classes & Methods
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/
@kr4uzi
kr4uzi / servicenow_client_side_date_handling.js
Last active December 2, 2023 07:08
ServiceNow Client Side Date Handling
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var today = new Date();
today.setUTCHours(0, 0, 0, 0);
//
// ServiceNow Date -> JavaScript Date
@kr4uzi
kr4uzi / send_to_mid.js
Created May 7, 2023 22:18
Generate XML and send to Mid Server
var doc = new XMLDocument2();
var importNode = doc.createElement('Import');
createPers(doc, importNode, '12345', 'update', 'Disabled', [{ id: '1', operation: 'delete' }, { id: '2', operation: 'delete' }, { id: '2', operation: 'delete' }]);
createPers(doc, importNode, '23456', 'update', 'Disabled', [{ id: '1', operation: 'delete' }, { id: '2', operation: 'delete' }, { id: '2', operation: 'delete' }]);
createPers(doc, importNode, '34567', 'update', 'Disabled', [{ id: '1', operation: 'delete' }, { id: '2', operation: 'delete' }, { id: '2', operation: 'delete' }]);
sendToMid('helloWorld.xml', doc.toString());
function sendToMid(fileName, fileContent) {
var saveScript = '(function () {'
+ ' try {'