Skip to content

Instantly share code, notes, and snippets.

View benwk's full-sized avatar
🎯
Focusing

Ben Z. benwk

🎯
Focusing
View GitHub Profile
@benwk
benwk / login.js
Created April 19, 2024 10:02
Auth0
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://hive.d3lay.com';
const userID = event.user.app_metadata ? event.user.app_metadata.UserID : null;
@benwk
benwk / ssh.md
Last active September 13, 2023 14:37
Proxy

SSH Proxy

Config

.ssh/config

MacOS

@benwk
benwk / openai-api.js
Created September 12, 2023 06:58
Cloudflare Worker
// const CUSTOM_AUTH_KEY = 'benwk'; // 将此值替换为你选择的自定义密钥
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const apiEndpoint = "https://api.openai.com";
@benwk
benwk / requirement.md
Created September 2, 2023 07:17
Product Design
@benwk
benwk / version.sh
Last active August 27, 2023 06:49
NPM
!#/bin/bash
# get current version
npm pkg get version --workspaces=false --raw | tr -d \"
CURRENT_VERSION=$(npm pkg get version --workspaces=false --raw | tr -d \")
# set bump version
# 'major' for breaking changes, 'minor' for new features, 'patch' for bug fix
VERSION_BUMP=patch
@benwk
benwk / ai-code-review.yml
Last active April 27, 2024 23:40
GitHub Action Workflow
name: Code Reviewer
permissions:
contents: read
pull-requests: write
on:
pull_request:
pull_request_review_comment:
types: [created]