Skip to content

Instantly share code, notes, and snippets.

View qoomon's full-sized avatar
🌳
Go for it.

Bengt Brodersen qoomon

🌳
Go for it.
View GitHub Profile
@qoomon
qoomon / gist:700f68ca890edd5802fd768652f231cc
Last active February 22, 2024 13:22
GitHub Actions Commit Identity
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
@qoomon
qoomon / AWSParametersAndSecretsLambdaExtension-Utils.ts
Created October 12, 2023 06:08
AWSParametersAndSecretsLambdaExtension
/**
* @param secretId the ARN or name of the secret.
* @param version the version stage or version id
* @see https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_lambda.html
* @see https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html
*/
export async function getSecretString(secretId: string, version?: SecretManagerSecretVersionStage | string) {
const extensionHttpPortPort = process.env["PARAMETERS_SECRETS_EXTENSION_HTTP_PORT"] ? parseInt(process.env["PARAMETERS_SECRETS_EXTENSION_HTTP_PORT"]) : 2773
const secretManagerRequestUrl = new URL(`http://localhost:${extensionHttpPortPort}/secretsmanager/get`)
@qoomon
qoomon / qoomon.md
Last active October 25, 2023 05:40
qoomon styles

"Combining Long Stroke Overlay" (U+0336) and "Combining Short Stroke Overlay" (U+0335).

qoomon

q̴͈̮o̴̱ọm̶͓̥on͒

Q̶̸O̶̴O̶̴M̶̸O̶̴N̶̸


@qoomon
qoomon / bypass safe links.user.js
Last active March 22, 2023 14:45
Userscript to bypass Safe Links
@qoomon
qoomon / Colima-status.2s.zsh
Created February 13, 2023 16:44
xBar - Colima Status
#!/bin/zsh
# <xbar.title>Colima Status</xbar.title>
# <xbar.author>Bengt Brodersen</xbar.author>
# <xbar.author.github>qoomon</xbar.author.github>
# <xbar.desc>Displays Colima Status - https://github.com/abiosoft/colima</xbar.desc>
source ~/.zprofile
DOCKER_RUNNING_ICON='iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACqgAwAEAAAAAQAAACoAAAAAxiJEngAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0Y
@qoomon
qoomon / template.plugin.zsh
Created February 7, 2023 08:25
ZSH Plugin File Template
#!/bin/zsh
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
echo "${${0:A}/%.plugin.zsh/.zsh}"
@qoomon
qoomon / script.sh
Last active February 9, 2023 16:13
Google Drive - Hide Symbolic Link in Home Directory
# lock and hide Google Drive link
chflags -h uchg,hidden "$HOME/Google Drive"
# undo by following command
# chflags -h nouchg,nohidden "$HOME/Google Drive"
@qoomon
qoomon / parse-body.js
Created October 25, 2022 14:38
Parse http.IncomingMessage body
async function parseBody(res) {
return new Promise((resolve, reject) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => resolve(body));
}).then(body => res.body = body ? JSON.parse(body) : undefined);
}
@qoomon
qoomon / base-vpc.ts
Created September 30, 2022 14:32
AWS CDK - Vpn Construct - Configure default security group according to "CIS AWS Foundations Benchmark controls",
import {Stack} from "aws-cdk-lib";
import {Vpc, VpcProps} from "aws-cdk-lib/aws-ec2";
import {AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId} from "aws-cdk-lib/custom-resources";
import {Construct} from "constructs";
export class BaseVpc extends Vpc {
constructor(scope: Construct, id: string, props: VpcProps) {
super(scope, id, props);
// Configure default security group according to "CIS AWS Foundations Benchmark controls",
// section "4.3 – Ensure the default security group of every VPC restricts all traffic".
@qoomon
qoomon / GitHubBulkOperations.sh
Created July 29, 2022 11:11
GitHub Bulk Operations
# list repos
# gh repo list $owner --json nameWithOwner -q '.[].nameWithOwner'
repos=(
example/example
)
for repo in "${repos[@]}"
do
echo $repo