This file contains hidden or 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 bash | |
| # This script converts environment variables to a JSON object. | |
| # Usage: ./env-to-json.sh [.env file path] | |
| set -euo pipefail | |
| ENV_FILE="${1:-.env}" | |
| # Function to escape JSON strings | |
| json_escape() { |
This file contains hidden or 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
| # 1. 安裝 pyenv(用 Homebrew,超簡單) | |
| brew install pyenv | |
| # 2. 加入 pyenv 到你的 shell(zsh,macOS 預設) | |
| echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc | |
| echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc | |
| echo 'eval "$(pyenv init -)"' >> ~/.zshrc | |
| source ~/.zshrc | |
| # 3. 安裝 Python 2.7.18(pyenv 會自動偵測 arm64 並編譯,過程約 2-5 分鐘) |
This file contains hidden or 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 oven/bun:1.3.1 AS build | |
| WORKDIR /app | |
| # Cache packages installation | |
| COPY package.json package.json | |
| COPY bun.lock bun.lock | |
| COPY ./prisma ./prisma | |
| RUN bun install --frozen-lockfile |
This file contains hidden or 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
| DO | |
| $$ | |
| DECLARE | |
| rec RECORD; | |
| BEGIN | |
| -- 更改表 (Tables) | |
| FOR rec IN | |
| SELECT n.nspname, c.relname | |
| FROM pg_class c | |
| JOIN pg_namespace n ON c.relnamespace = n.oid |
This file contains hidden or 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
| async createWaterMark({ | |
| width, | |
| height, | |
| text, | |
| fontSize, | |
| fontColor, | |
| opacity, | |
| }: CreateWaterMarkDto) { | |
| const svg = ` | |
| <svg width="${width}" height="${height}"> |
This file contains hidden or 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 sqlalchemy import MetaData | |
| from sqlalchemy.sql.ddl import CreateTable | |
| import typer | |
| from app.helpers import app_path | |
| from database.connection import engine | |
| app = typer.Typer() | |
This file contains hidden or 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
| check-sonarqube-pr: | |
| stage: check | |
| image: | |
| name: sonarsource/sonar-scanner-cli:11 | |
| entrypoint: [''] | |
| variables: | |
| SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" | |
| GIT_DEPTH: "0" | |
| allow_failure: true | |
| rules: |
This file contains hidden or 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
| /** | |
| * usage measureResourceUsage(async()=>{}, logger, label) | |
| * @param func | |
| * @param logger | |
| * @param label | |
| * @private | |
| */ | |
| async measureUsage<T>( | |
| func: () => Promise<T>, | |
| logger: Logger, |
This file contains hidden or 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
| export const googleLoginActions = { | |
| getAuthUrl: () => { | |
| const query = { | |
| client_id: oauth_google.client_id, | |
| redirect_uri: oauth_google.redirect_uri, | |
| response_type: "code", | |
| scope: oauth_google.scopes, | |
| } | |
| const url = new URL(oauth_google.endpoint) | |
| url.search = new URLSearchParams(query).toString() |
This file contains hidden or 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
| <?php | |
| class BaseDto | |
| { | |
| /** | |
| * Constructor that dynamically sets properties based on the given associative array | |
| * | |
| * @param array $data The data to be used for setting properties | |
| */ | |
| public function __construct(array $data) |
NewerOlder