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 | |
| # zai.sh — load Anthropic API vars and run Claude if ready | |
| # Usage: $ source zai.sh | |
| # Note: sh zai.sh or ./zai.sh doesn't work, only source inherits PATH | |
| # Installation: ensure your .env is set with: | |
| # ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic | |
| # ANTHROPIC_AUTH_TOKEN=(get your api token from z.ai) | |
| # --- Load from .env if it exists --- |
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
| sudo apt install postgresql-15-pgvector | |
| sudo -u postgres psql | |
| CREATE EXTENSION vector; |
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 | |
| if (! function_exists('get_sql_from_eloquent')) { | |
| /** | |
| * A Function to dump SQL query out from an Eloquent object. | |
| * | |
| * @param \Illuminate\Database\Eloquent\Builder $query The Eloquent object. | |
| * @return string The SQL query. | |
| * | |
| * Usage: dd(get_sql_from_eloquent(\App\Models\User::query())); |
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
| // Made by @charlestehio: https://x.com/charlestehio | |
| // Usage: https://abc.workers.dev/?query=your%20embedding%20query | |
| import { Ai } from './vendor/@cloudflare/ai.js'; | |
| export default { | |
| async fetch(request, env) { | |
| // Parse the URL to get query parameters | |
| const url = new URL(request.url); | |
| var query = url.searchParams.get('query'); |
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 | |
| // This function converts a normal currency amount to a Stripe-compatible amount. | |
| // To be used on creating Stripe Checkout Stations | |
| // e.g. USD 10.00 to 1000 | |
| if (! function_exists('convert_normal_to_stripe_amount')) { | |
| function convert_normal_to_stripe_amount($currency, $amount) | |
| { | |
| $stripe_amount = $amount; |