Javascript: getElementByXPath

function getElementByXPath(path, context=null, document=null, namespaceResolver=null, first_ordered=true) {
  if (context === null) context = window.document.documentElement;
  if (document === null) document = context.ownerDocument;
  if (namespaceResolver === null) namespaceResolver = document.createNSResolver(context);
  const result = document.evaluate(path, context, namespaceResolver, first_ordered ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_UNORDERED_NODE_TYPE, null);
  return result.singleNodeValue || null;
}

Getting OpenNIC to work with pfSense

If you're using an alternate DNS root server such as OpenNIC, and your network uses a pfSense-based router, you may find that clients are, strangely, unable to resolve unofficial TLDs, getting SERVFAIL or NXDOMAIN. There are 3 ways I can think of to quickly solve this problem for the whole network, listed here in increasing order of complication: 1. Disable the DNS resolver Go to Services > DNS Resolver …

Applying highlight.js to inline code on WordPress

If you're using the plugin Prismatic to apply highlight.js to your code excerpts, but you want it to also affect inline <code> tags (i.e. not only those wrapped in <pre> blocks), simply go Settings > Prismatic > Highlight.js and paste this into the “Init Script” field: hljs.configure({ cssSelector: 'code' }); hljs.highlightAll(); — then be sure to remember to add the language-* classes to your inline <code> tags! You may …

Mandates ARE laws…

I've seen some people online saying variations on “[COVID-19 quarantine] mandates aren't laws! know your rights! [state] legislature didn't sign off on this!” However, these people are usually incorrect. I'll be compiling examples in this post, more to come if I feel like it, starting out with representative examples from each quadrant of the U.S.: AL Code § 22-2-2 (6) [archived] CA HSC § 120130 (c) and (d), and …

Basic JS Async Cookbook

function asleep(delay) { return new Promise(resolve => setTimeout(resolve, delay)); } // Usage: await asleep(1000); function aalert(message) { return new Promise( resolve => resolve(alert(message)) ); } function aconfirm(message) { return new Promise( resolve => resolve(confirm(message)) ); } function aprompt(message, deflt) { return new Promise( resolve => resolve(prompt(message, deflt)) ); } // Usage: await aalert("The task will begin as soon as you press OK.") ; do_task(); aalert("The task will begin as …

Minecraft: switching from Forge to Fabric

The only amenities I needed were increased FPS, NBT Tooltips, Fancy-leaves-on-Fast-graphics, Zoom, and Saturation Display. These are provided on Fabric, respectively, by: Sodium NBT Tooltip Also Sodium (once they fix #233) Cull Leaves, for now WI Zoom AppleSkin I will update this post as I use more stuff. I will cross out, but not delete, mods I no longer use.

[DRAFT] Pleroma on Docker Compose

This testing was done with Pleroma 2.4.1, in environment Rocky Linux 8 (Before starting, be sure docker and docker-compose are installed, as well as git, and NGINX.) Fetch and prepare the source code: git clone -b stable –depth=10 "https://git.pleroma.social/pleroma/pleroma.git" && cd pleroma git fetch –depth=20 "https://git.lain.church/squeegily/pleroma.git" "feature/docker-compose":"feature/docker-compose" && git -c "user.name=Anonymous" -c "user.email=nobody@localhost" merge –no-commit "feature/docker-compose" read -p "Enter your domain name: " pleroma_domain Build it: mkdir -vp uploads …