## Basic "while" loop in Elixir

Given this Python code: def f(k): n = 2 << k q = 2 i = 1 while q != n: i *= q q <<= 1 return i The Elixir translation is roughly the following: def f(k) do n = 2 <<< k # Remember to add "use Bitwise" at the top of the module q = 2 i = 1 # (Storing the output into a tuple …

## [DRAFT] WHOIS: look up ASN from the command-line

Since Marco d'Itri's whois(1) v5.5.0 released in July 2019, most sysadmins no longer need to do trial-and-error or detectivework to guess which of the 5 RIRs controls the IP attacking you and then hunt down the appropriate WHOIS server—the -I flag will now do that annoying accounting on your behalf

## [DRAFT] U.S. Obscenity Ban: Name & Blame

An 1873 federal bill to ban smut, abortion pamphlets, and sex toys was never found unconstitutional; instead, only the clauses that meaningfully impacted the ability of the American public to be sexually promiscuous were overturned, piecemeal, under the banner of "civil rights". I will attempt to give a breakdown (including partisan affiliation) of the people behind this bill's tortured history.

## Transcript: Dr. Ryan Cole on Vitamin D and COVID

Transcribed from 0:52–24:13 of the Week 8 recording at lgo.idaho.gov/capitol-clarity/

## Javascript: getElementByXPath


function getElementByXPath(path, context=null, _document=undefined) {
if( _document === undefined ) _document = document;
let res = document.evaluate(path, _document, context, XPathResult.FIRST_ORDERED_NODE_TYPE);
if( !res ) return null;
return res.singleNodeValue;
}

## 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 …

## 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(…)

## 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 …