Skip to content

Instantly share code, notes, and snippets.

View RickCogley's full-sized avatar
👻
Migrated eSolia to MS365, implementing ISO 27001 ISMS in Sharepoint.

Rick Cogley RickCogley

👻
Migrated eSolia to MS365, implementing ISO 27001 ISMS in Sharepoint.
View GitHub Profile
@RickCogley
RickCogley / readme.md
Last active January 6, 2024 00:36
Markdown 基礎の基礎

Markdown とは、元々John Gruber氏のこちらのブログで仕様説明が発表されてから色んなシステムが使っています。

検索すれば様々な情報が出ますが、基礎の基礎として:

テキストにボルド体にするには:

**ボルド体**

日本語では珍しいかもしれないけど イタリック体 もあり:

@RickCogley
RickCogley / 1. Readme.md
Last active May 14, 2023 01:17
Append to Dictionary File in nushell

Appending Words to a Dictionary File in Nushell

I call a dictionary file from my nupass.nu password generator command, which is simply a file with one Japanese word or phrase per line. I wanted to be able to easily add words to the dictionary file, followed by a quick git commit, hence this nushell script.

In this case, it's easy to just add those commands to nushell's env.nu instead of having them as a separate script file. Once added, I just reloaded nushell, and then it was just a matter of doing the following to add the words to the file:

> dict add onepiece golgo13 dragonball naruto doraemon 

See the screenshot below for what the output looks like.

@RickCogley
RickCogley / 1. Readme.md
Last active May 3, 2023 00:05
Nushell password generator

Nushell Password Generator "nupass"

This nushell command randomly retrieves a specified number of words from a dictionary file (English with Japanese words added by @rickcogley) less than or equal to a given parameter's length, formats the words randomly with capitalization, then separates the words with some random symbols and numbers to return a password.

To use:

  1. Get the dictionary file to your system using nushell's http:
http get https://raw.githubusercontent.com/RickCogley/jpassgen/master/genpass-dict-jp.txt | save genpass-dict-jp
@RickCogley
RickCogley / 1. Readme.md
Last active February 6, 2023 10:07
Use HTMX to Access DBFlex / Teamdesk REST API JSON data

Use HTMX to Access DBFlex / Teamdesk REST API JSON data

You can access the DBFlex / Teamdesk REST API using HTMX, specifically its "client side templates" extension. Use the API Playground from setup to get the URL to target with hx-get.

DBFlex wraps its json in an array, so if you're using a Mustache template, you need to wrap the field you're accessing like this:

{{#.}} {{ Holiday Name }} {{/.}}
:where(html) {
--gray-0-hsl: hsl(210, 17%, 98%);
--gray-1-hsl: hsl(210, 17%, 95%);
--gray-2-hsl: hsl(210, 16%, 93%);
--gray-3-hsl: hsl(210, 14%, 89%);
--gray-4-hsl: hsl(210, 14%, 83%);
--gray-5-hsl: hsl(210, 11%, 71%);
--gray-6-hsl: hsl(210, 7%, 56%);
--gray-7-hsl: hsl(210, 9%, 31%);
--gray-8-hsl: hsl(210, 10%, 23%);
@RickCogley
RickCogley / 1. Readme.md
Last active May 28, 2023 23:36
Deploy Hugo to Deno Deploy via Github Actions

Background

Deno Deploy is an excellent, performant and cost-effective service geared toward hosting Deno apps at the edge. It can easily host a folder of static HTML files, if you provide an index.ts to launch something like "oak" to serve them (example index.ts below).

(It's important to note that it's still officially considered beta as of May 2023, and there have been some surprising periods of downtime over the past few months... just be sure to keep that in mind)

Hugo is a phenomenally fast-building and mature SSG, which can produce a folder of static files, but requires a build step like hugo --gc --minify --verbose --baseURL=$HUGOBASEURL --ignoreCache to generate them.

Below is a yaml file you would place in your project's .github/workflows folder. If you link your Deno Deploy project using Github Actions instead of specifying an index file, it will defer to what's in this. In this case, the Hugo files generated into public are being serv

@RickCogley
RickCogley / 1. Readme.md
Last active January 7, 2024 11:16
Standard Security Headers

This set of "low-hanging fruit" security headers can be set for most websites to cover a range or potential problems and get a better ranking on https://securityheaders.com/. You should not that this does not cover CORS/CSP headers, because they are not "one size fits all" and require trial and error to set. Among these standard headers, the "Permissions-Policy" (previously "Feature-Policy") header requires a bit of thought, and trial and error, so be sure to review and edit as appropriate.

Generally speaking, although you can set some of these directly in HTML, you usually set security headers on the server side, for example in a .htaccess file on Apache, in a file like vercel.json in the root of your site if you're hosting on Vercel (similar for Netlify and can be done in their config file, see below), or under "web rules, header rules" UI if you're hosting on WP Engine (see screenshot).

It's also super simple to implement a static HTML site deployed on Deno Deploy, and served via Deno Oak. See th

@RickCogley
RickCogley / details-summary.html
Created January 7, 2022 07:46
HTML User Input
<details>
<summary>Click me...</summary>
I just opened without css or javascript.
</details>
@RickCogley
RickCogley / 00 readme.md
Last active February 6, 2021 11:27
Kirby 3 series Install Log of Composer Errors
  • MacOS Big Sur 11.2
  • Composer version 2.0.9 2021-01-27 16:09:27, installed via brew
@RickCogley
RickCogley / action.yml
Last active January 27, 2021 12:13
Apex Up GH action.yml
name: 'Apex Up'
description: 'Deploy & manage Up applications'
inputs:
stage:
description: 'Up stage to deploy'
required: true
verbose:
description: 'Produce verbose output'
required: false
runs: