Skip to content

Instantly share code, notes, and snippets.

@toraritte
toraritte / github_issues_to_docx.md
Last active September 12, 2024 22:12
A long and stupid way to save GitHub issues in Word DOCX format

The long and stupid way is listed below, but hoping that someone has a way quicker and nicer solution. (Didn't have time to come up with a proper Node or Deno solution, so I spent better part of the day on this abomination.[quote][1])

  1. "Install" [GitHub CLI][gh] and [Pandoc]

    nix-shell -p gh pandoc
    
  2. Export GitHub issues in JSON

@toraritte
toraritte / nix_pin_version_of_individual_packages.md
Last active March 22, 2024 15:30
(work in progress) State of affairs on how to pin versions of individual Nix packages (or how to refer to a specific package version with Nix)

Yes, there are several ways to do this, but none of them are as direct and simple as git v2.1.2; htop v1.2.3 and come with a lot of caveats.

aside
Specifying versions for programming language packages are possible too, but that topic seems to be even messier. The most promising standardization effort to date is [dream2nix][1].

0. Methods

That is, available at the time of this writing:

0.1 "versioned" attribute paths (if available)

@toraritte
toraritte / azure-managed-identity-MSI.md
Last active March 31, 2023 10:49
What are Azure managed identities (MSI)?

1. Definition

A managed identity (MSI1) is [a special kind of service principal][1] that is assigned to [an Azure resource that supports wielding managed identities][2] to access other Azure services / resources without credentials.

2. Terms

Going to use the following terms (some arbitrarily chosen) here:

  • MSI resource: [an Azure resource that support having (or endowed with) managed identities][2]

Is it a good practice to unset all variables at the end of a shell script?1

(See other opinions in this Unix & Linux thread with the same title.)

It depends on your use case(s) and intention(s) because a shell script can be run in different ways (see "1. Ways to call shell scripts" section below) which affect whether the variables are retained by the origin shell (the shell the script is called from) or not.

For example, a couple of cases for and against unsetting variables:

  • Bad, if the point of the script is to set environment variables3

Then again, this also depends on how the shell script is called (see section 1.).

@toraritte
toraritte / man_nix-install.adoc
Last active February 20, 2023 17:44
Nix install script with optional arguments and documentation

x

@toraritte
toraritte / passwd-sharing-with-keepassxc-and-shamir.adoc
Last active February 14, 2023 21:37
Rudimentary workflow for remotely sharing passwords using KeepassXC and Shamir's secret sharing (SSS)

Rudimentary workflow for remotely sharing passwords using KeepassXC and Shamir’s secret sharing (SSS)

  1. Create a KeepassXC database (i.e., a file with .kdbx extension) with the credentials to be shared.

  2. Put it in a place that is available to everyone who needs access to it.

  3. Generate "secret shares" of the shared database by using Shamir’s secret sharing (SSS) algorithm (by using the online PassGuardian tool, grempe/secrets.js, etc.).

  4. Send the required number of "secret shares" to members of your team through different channels.

What is a bookmarklet?

a small software application stored as a bookmark in a web browser, which typically allows a user to interact with the currently loaded web page in some way.

That is, when the URL field of a bookmark contains JavaScript. This one is for printing internal docs to PDF by simply clicking on a bookmark:

javascript: (() => { let auth_num = document.body.outerHTML.match(/NMED\d{9}/g); let datetime = new Date().toJSON().replace(/[^a-zA-Z0-9]/g, '_'); document.title = `${datetime}_${auth_num}`; window.print(); window.close(); })();
@toraritte
toraritte / for_browser.js
Last active December 21, 2022 00:06
scrape the target weekly ads into a (hopefully) coherent human-readable text (see comments on how to test drive it)
/* ============================================================================= */
function nullToEmptyString(maybeNull) {
return maybeNull ? maybeNull : '';
}
function stripPeriod(itemProperty) {
const notNullItemProperty = nullToEmptyString(itemProperty);
return notNullItemProperty.replace(/\.(\s|\*|†)*$/, '');
}
@toraritte
toraritte / target-location-api-v3-with-location_id.md
Last active December 11, 2022 14:36
Target location API v3 - with location_id

request URL:

https://api.target.com/locations/v3/public/310?key=9ba599525edd204c560a2182ae1cbfaa3eeddca5

(location_id 310 corresponds to Sacramento,CA Riverside Blvd. store)

response:

{