This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #cloud-config | |
| # Enable automatic package updates and upgrades during cloud-init execution | |
| package_update: true | |
| package_upgrade: true | |
| packages: | |
| # Security and Hardening | |
| - ufw | |
| - fail2ban |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Abort sign off on any error | |
| set -e | |
| # Start the benchmark timer | |
| SECONDS=0 | |
| # Repository introspection | |
| OWNER=$(gh repo view --json owner --jq .owner.login) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as bcrypt from "bcrypt"; | |
| import { createCookieSessionStorage, redirect } from "remix"; | |
| import { db } from "./db.server"; | |
| export type LoginForm = { | |
| username: string; | |
| password: string; | |
| }; |
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'instead ofconst foo = require('foo')to import the package. You also need to put"type": "module"in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)from CommonJS instead ofrequire(…). - Stay on the existing version of the package until you can move to ESM.
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { execSync } = require('child_process') | |
| const { createHash } = require('crypto') | |
| const invertColor = require('invert-color') | |
| const branchName = execSync('git rev-parse --abbrev-ref HEAD') | |
| const hash = createHash('sha256') | |
| hash.update(branchName) | |
| const color = '#' + hash.digest().toString('hex').substring(0, 6) | |
| const invertedColor = invertColor(color, true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # SET THIS TO BE YOUR DESIRED USERNAME | |
| export MY_USER_NAME_FOR_CERT=`whoami` | |
| # This directory is optional, but will use it to keep the CA root key safe | |
| mkdir keys certs | |
| chmod og-rwx keys certs | |
| # Set up a directory that will serve as the pgconf mount |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !! | |
| !! Implementation of JSONPatch (http://jsonpatch.com/) using PostgreSQL >= 9.5 | |
| !! | |
| CREATE OR REPLACE FUNCTION jsonb_copy(JSONB, TEXT[], TEXT[]) RETURNS JSONB AS $$ | |
| DECLARE | |
| retval ALIAS FOR $1; | |
| src_path ALIAS FOR $2; | |
| dst_path ALIAS FOR $3; | |
| tmp_value JSONB; |
NewerOlder