There are at least 2×5×7×3×3×1=630 different things you might unambiguously mean by "parsing" a query string in Javascript: …
Python: Nested in-line "for" statements
You must leave the for
s in the same order as in the code-block form, only popping the inner expression itself to the front:…
WordPress: Restrict MathJax to a class
I write on a variety of topics, only some of which it's appropriate to have mathematical typesetting for. To avoid triggering a math rendering engine on unrelated use of $purious dollar sign$, while activating it when $\text{necessary}\wedge\text{appropriate}$, I decided to restrict them to only <… lang="x-mathjax">. Here's how that's done (for v3): MathJax = { tex: { inlineMath: [ ['$', '$'] ] }, startup: { elements: [':lang("x-mathjax")'] } }; …
ESXi: auto-reboot after Purple Screen of Death
Shamelessly stolen / archived from / hat-tip to this other website, vSkilled, for their post on this. I'm just copying the important details here for when they go under or get consumed by advertisements. esxcfg-advcfg -s 120 /Misc/BlueScreenTimeout # (That's for a two-minute wait; adjust to taste)
Converting SVG to .ico with Python
Just a super rudimentary script that I made which hooks CairoSVG up to Pillow because apparently Firefox doesn't support SVG-formatted browserAction images
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 …
Breaking out of multiple "for" loops in Python
Python doesn't support break some_label;
or break 3;
, but it does support for-else
…
Parsing the HTTP "Date" header in Python
Per RFC 7231 §7.1.1.1
Python: Using "with" with sqlite3 cursor
If you like the assurance that Python's with statement provides, but can't figure out how to properly apply it to individual cursor objects, here's how to do that: import sqlite3 from contextlib import closing con = sqlite3.connect('example.db') with con, closing(con.cursor()) as cur: cur.execute(…)