-
Add local domain to
/etc/hosts
:127.0.0.1 my-project.dev
-
Install mkcert
-
Create certificate for this domain:
➜ mkcert my-project.dev
This file contains 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 { readFileSync } from 'fs'; | |
import { builtinModules } from 'module'; | |
import ts from 'typescript'; | |
const tsHost = ts.createCompilerHost( | |
{ | |
allowJs: true, | |
noEmit: true, | |
isolatedModules: true, |
This file contains 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
function namesList(names: string | readonly string[]): string { | |
if (typeof names === 'string') return names; | |
if (names instanceof Array) return names.join(', '); | |
throw new TypeError( | |
`Invalid parameter, expected a string or array of strings, received: ${names}`, | |
); | |
} | |
const nameList2 = (names: string | Iterable<string>) => | |
typeof names === 'string' |
This file contains 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
{ | |
"type": "object", | |
"required": ["Statement"], | |
"additionalProperties": false, | |
"properties": { | |
"Version": { | |
"type": "string", | |
"enum": ["2008-10-17", "2012-10-17"] | |
}, | |
"Id": { |
This file contains 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 type { Handler } from "aws-lambda"; | |
import { Pool } from "pg"; | |
// connection details inherited from environment | |
const pool = new Pool({ | |
max: 1, | |
min: 0, | |
idleTimeoutMillis: 120000, | |
connectionTimeoutMillis: 10000 | |
}); |
This file contains 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 | |
sudo yum install gcc -y | |
sudo yum install openssl-devel -y | |
sudo yum install zlib-devel -y | |
sudo yum install mlocate -y | |
sudo yum install autoconf -y | |
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz | |
tar zxvf openssh-9.1p1.tar.gz | |
cd openssh-9.1p1 | |
./configure --prefix=/usr |
This file contains 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
""" | |
Reorder site-packages ahead of Extras and lib-dynload. | |
Two implementations: | |
1. puts site-packages ahead of stdlib (technically hazardous, | |
but not really an issue). | |
2. is more conservative, only demoting Extras below site-packages. | |
Add this to ~/Library/Python/2.7/lib/python/site-packages/sitecustomize.py | |
""" |
Method:
sudo yum update
sudo yum install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel
sudo yum install asciidoc xmlto docbook2X
sudo yum install gcc autoconf
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
wget https://github.com/git/git/archive/v2.8.4.zip
This file contains 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 python3 | |
import threading | |
from copy import copy | |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer | |
from sys import stdin | |
class ProducerConsumer(): |
This file contains 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
/** | |
* Finds the common directory path prefix for a list of file paths. | |
* Returns a path ending with '/' or empty string if no common prefix exists. | |
* | |
* @param files - An iterable of file paths to process | |
* @returns The common directory prefix ending with '/' or empty string | |
*/ | |
export function findCommonPathPrefix(files: Iterable<string>): string { | |
const iter = Iterator.from(files); |
OlderNewer