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
# [...] | |
sonarcloud: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting, cf https://sonarcloud.io/project/configuration?analysisMode=GitHubActions |
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
# This script returns the value of the latest enabled revision of the requested secret. | |
# Usage: get-last-active-gcp-secret-revision.sh <secret-name> | |
SECRET_NAME=$1; shift; | |
if [ -z ${SECRET_NAME} ]; then | |
echo "Error: please specify the name of the secret to get." | |
echo "Available secrets:" | |
gcloud secrets list |
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
/// <reference types="node" /> | |
declare namespace NodeJS { | |
export interface ProcessEnv { | |
NODE_ENV: 'development' | 'production' | undefined; | |
} | |
export interface Process { | |
env: ProcessEnv |
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
# source: https://github.com/docker/buildx/pull/535#issuecomment-869022231 | |
e2e: | |
name: End-to-end tests against Docker containers | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: '1' # to enable persistent docker cache | |
COMPOSE_DOCKER_CLI_BUILD: '1' # so docker-compose commands benefits from buildkit/buildx's docker cache | |
steps: | |
- uses: actions/checkout@v2 |
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
steps: | |
- uses: browniebroke/read-nvmrc-action@v1 # Read node version from `.nvmrc` file | |
id: nvmrc | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ steps.nvmrc.outputs.node_version }}' |
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
const ts = require("typescript") | |
/** | |
* Extract the keys of a type defined in a .d.ts file. | |
* @param filename - name of the .d.ts file | |
* @param namespace - namespace where the type is defined | |
* @param typeName - name of the type | |
* @param options - options to pass to the TypeScript parser | |
* @returns an array of keys, expressed as strings | |
*/ |
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
# This configuration file is intended for local use of SonarScanner. | |
sonar.organization=mycompany | |
sonar.projectKey=myproject | |
# relative paths to source directories. More details and properties are described | |
# in https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/ | |
sonar.sources=. | |
sonar.sourceEncoding=UTF-8 | |
sonar.inclusions=app/**/*.* |
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
// (from https://dev.to/busypeoples/notes-on-typescript-recursive-types-and-immutability-5ck1) | |
// Makes a deeply immutable version of Type, using recursion. | |
type MakeReadOnly<Type> = { | |
readonly [Key in keyof Type]: MakeReadOnly<Type[Key]>; | |
}; | |
// Usage / Examples | |
const shape = { |
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
$ echo '{"a":1}' \ | |
| node -e \ | |
"d=[];process.openStdin().on('data',c=>d.push(c)).on('end',()=>console.log(JSON.stringify(JSON.parse(d.join('')),null,2)));" | |
# => | |
# { | |
# "a": 1 | |
# } | |
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 | |
set -e | |
BITWARDEN_ENTRY_ID="TODO" # à remplir depuis `$ bw list items --search name_of_my_entry` | |
echo "🔒 getting ssh password from bitwarden" | |
bw get password ${BITWARDEN_ENTRY_ID} | pbcopy | |
echo "🔑 ssh password can be pasted for 10 seconds, from now" | |
(sleep 10; echo "🧹 clearing password"; echo -n '' | pbcopy)& |