chmod +x fixperms
for i in `ls -A /var/cpanel/users` ; do ./fixperms $i ; done
This file contains 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 langchain_openai import ChatOpenAI | |
from browser_use import Agent | |
from browser_use.browser.browser import Browser, BrowserConfig | |
import os | |
import asyncio | |
async def main(): | |
import time | |
start_time = time.time() |
This file contains 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 default defineNuxtRouteMiddleware((to, from) => { | |
if (import.meta.server) return | |
const nav = useNavStore(); | |
// console.log('middlwae client', nav.clientSide) | |
if (nav.clientSide) { | |
return; | |
} | |
setTimeout(() => { | |
nav.setClientSide(true); |
This file contains 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
import { inferAsyncReturnType, initTRPC, TRPCError } from '@trpc/server'; | |
import * as trpcExpress from '@trpc/server/adapters/express'; | |
import express from 'express'; | |
import dotenv from 'dotenv'; | |
import { appRouter } from './router/server'; | |
import cors, { CorsOptions } from 'cors'; | |
import jsonwebtoken from 'jsonwebtoken'; | |
// import * as functions from 'firebase-functions'; | |
import type { HttpFunction } from '@google-cloud/functions-framework'; |
This file contains 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 useLocal = <T>(field: string, defaultData: T, prefix = 'state.') => { | |
const value = ref(defaultData) | |
const name = `${prefix}${field}` | |
watch(value, (v) => { | |
// console.log('useLocal updated', name, v) | |
localStorage.setItem(name, JSON.stringify(v)) | |
}, { deep: true }) | |
if (typeof window === 'undefined') { | |
return value |
This file contains 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
import { defineComponent, defineProps, defineEmits, defineExpose, ref } from 'vue' | |
export default defineComponent({ | |
props: { | |
}, | |
emits: { | |
update: (value: number) => true, | |
}, | |
setup (props, { emit }) { |
This file contains 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
import * as tiktoken from 'tiktoken' | |
import { TiktokenModel } from 'tiktoken' | |
// @thanks https://stackoverflow.com/questions/76216113/how-can-i-count-tokens-before-making-api-call | |
export const calculateTokenCount = async (text: string, model : TiktokenModel = 'gpt-3.5-turbo') => { | |
try { | |
const tk = await tiktoken.encoding_for_model(model) | |
const encoded = tk.encode(text) | |
return encoded.length | |
} catch (error: any) { |
This file contains 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 | |
// setup .env from $_ENV | |
file_put_contents('/var/www/html/.env', ''); | |
foreach ($_ENV as $key => $value) | |
{ | |
if ( | |
strpos($key, 'PHP_') === 0 || | |
strpos($key, 'NOTIFY_') === 0 || | |
strpos($key, 'HTTP_') === 0 || |
This file contains 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
upgrade: | |
npx ts-node-esm ./upgrade.ts | |
npm update -S |
This file contains 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
import stream from 'stream'; | |
const mime = require('mime-types'); | |
import aws from 'aws-sdk'; | |
import multer from 'multer'; | |
import multerS3 from 'multer-s3'; | |
multer({ | |
//..., | |
storage: multerS3({ |
NewerOlder