Chrome拡張で現在のタブ情報を取る方法(v3)

公式に記載のある通りだけど、 少し調べたので、メモをおいておく v3用 Promise const getCurrentTab = async () => { const queryOptions = { active: true, lastFocusedWindow: true }; // `tab` will either be a `tabs.Tab` instance or `undefined`. const [tab] = await chrome.tabs.query(queryOptions); return tab; }; Refs chrome.tabs - Chrome Developers

2023-02-25 ·  2023-02-25 · 1 分 · 43 文字

Serverless で ApiGw のロギングいれようとして、`CloudWatch Logs role ARN must be set in account settings to enable logging` となったのでメモ

問題 Serverless Framework で、以下のようにロギング設定を追加して、以下エラーになった provider: # 省略 logs: restApi: accessLogging: false # Optional configuration which enables or disables access logging. Defaults to true. executionLogging: true # Optional configuration which enables or disables execution logging. Defaults to true. level: ERROR # Optional configuration which specifies the log level to use for execution logging. May be set to either INFO or ERROR. fullExecutionData: false # Optional configuration which specifies whether or not to log full requests/responses for execution logging....

2023-02-13 ·  2023-04-24 · 1 分 · 130 文字

firebase-admin で使用する秘密鍵を SecretManager に登録する

FCM Push用秘密鍵を SecretManager に登録する FCM 秘密鍵を取得 FireBaseへログイン プロジェクトを選択 プロジェクトの設定 サービスアカウント FireBase Admin SDK > 新しい秘密鍵の生成 FCM 秘密鍵を SecretManager に登録 取得した秘密鍵を ./fcm.json で配置する 以下コマンドで登録 aws secretsmanager put-secret-value --secret-id ${SECRET_ID} --secret-string "$(cat<./fcm.json)" 使う SecretManager を扱い易いようにクラス化する 'use strict'; const { SecretsManagerClient, GetSecretValueCommand } = require('@aws-sdk/client-secrets-manager'); const clazz = class Sm { constructor() { this.client = new SecretsManagerClient({ region: process.env.REGION }); // REGION で環境変数へRegionを設定している前提 } async get(key) { const command = new GetSecretValueCommand({ SecretId: key }); const res = await this....

2023-02-13 ·  2023-04-23 · 1 分 · 170 文字

x11 and wayland

docker wayland 転送 - Google 検索 WSLgとdocker composeで全部やる Waylandのソケットは、/mnt/wslg/runtime-dir/wayland-0にあります。 … x11 - How can I run a graphical application in a container under Wayland? - Unix & Linux Stack Exchange LinuxとWSLとDockerとXの仕組み ここで注目すべき(?)はRDPの存在で、これまでのWindowsのリモートデスクトップの枠組みを拡張して(?)、VAILやRAILといった仕組みでデスクトップではなくWindowレベルでの「リモートデスクトップ」を実現しているということです。 この他、Xパケットの転送のみでは実現できなかった「音情報」の転送も組み込んでいます。 Docker on WSL2 on Windows 10? Docker Desktopを企業活動で利用するのが有料になったことから、Docker Desktop を使わずに Windows で Docker する - プログラム の超個人的なメモという魔術が出回るようになりました。このアーキテクチャの場合、TCPでX11 Protocolを書き出しているので、Unix Domain Socketではなく、ポートフォワードで実現するのかなと思います(未確認) 理解しながら動かすGUIアプリ on Docker - Qiita wsl側からホスト側のアドレスは イーサネット アダプター vEthernet (WSL) を探す export DISPLAY=aaa.bbb.ccc.ddd:0 WSL2におけるVcXsrvの設定 - Qiita wsl側からDISPLAYを設定する際のホストの記述方法は mshome....

2023-01-19 ·  2023-04-24 · 1 分 · 98 文字

アクセス制限ポリシーを当てたRoleへスイッチできるユーザをaws cli で作成する

案件で作る機会があったので、さっと IAM.yml AWSTemplateFormatVersion: "2010-09-09" Description: "SampleApp - IAM" Parameters: ProjectName: Description: "Project name" Type: "String" Default: "SampleApp" Resources: IamSampleDeveloperRole: Type: AWS::IAM::Role Properties: RoleName: !Sub ${ProjectName}SampleDeveloper AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: AWS: !Sub arn:aws:iam::${AWS::AccountId}:root Action: sts:AssumeRole ManagedPolicyArns: - arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess IamSampleDeveloperPolicies: Type: AWS::IAM::Policy Properties: PolicyName: IamSampleDeveloperPolicy PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - dynamodb:List* - dynamodb:DescribeReservedCapacity* - dynamodb:DescribeLimits - dynamodb:DescribeTimeToLive Resource: '*' - Effect: Allow Action: - dynamodb:BatchGet* - dynamodb:DescribeStream - dynamodb:DescribeTable - dynamodb:Get* - dynamodb:Query - dynamodb:Scan - dynamodb:BatchWrite* - dynamodb:CreateTable - dynamodb:Delete* - dynamodb:Update* - dynamodb:PutItem Resource: - arn:aws:dynamodb:*:*:table/dev-* - Effect: Allow Action: - s3:ListAllMyBuckets Resource: - arn:aws:s3:::* - Effect: Allow Action: - s3:* Resource: - arn:aws:s3:::*dev* Roles: - Ref: IamSampleDeveloperRole IamSampleDevelopersGroup: Type: AWS::IAM::Group Properties: GroupName: !...

2023-01-06 ·  2023-01-06 · 1 分 · 210 文字