goto linode dashboard > node
1st, setting > shutdown watchdog > disable
second, boot into rescue mode
disclaimer: i'm not responsible for any problems with your system (but you may contact me)
mkdir /mnt/r
version: "3.2" | |
services: | |
logrotate: | |
image: blacklabelops/logrotate | |
restart: unless-stopped | |
volumes: | |
- "/home/yourpathtolog:/log" | |
- "./logrotate-status:/logrotate-status" | |
environment: | |
- "LOGS_DIRECTORIES=/log" |
module.exports = { | |
root: true, | |
env: { | |
browser: true, | |
node: true | |
}, | |
parser: 'vue-eslint-parser', | |
parserOptions: { | |
'parser': '@typescript-eslint/parser', | |
'ecmaVersion': 2017, |
exports = function(changeEvent) { | |
console.log("changed", changeEvent.operationType, JSON.stringify(Object.keys(changeEvent))) | |
//allows replace and create | |
if(changeEvent.operationType == "update") { | |
let keys = Object.keys(changeEvent.updateDescription.updatedFields) | |
console.log("changed", JSON.stringify(Object.keys(changeEvent.updateDescription.updatedFields))) | |
if(keys.indexOf('created_at') > -1 || keys.indexOf('updated_at') > -1 || keys.length == 0) { | |
//changed fields contains created_at or updated_at | |
// on $set, it will trigger "update" | |
console.log("ignoring change") |
const auth: any = context.auth || {} | |
if (!auth || !auth.uid) { | |
//not logged in | |
} | |
let authUser = await admin.auth().getUser(auth.uid) |
goto linode dashboard > node
1st, setting > shutdown watchdog > disable
second, boot into rescue mode
disclaimer: i'm not responsible for any problems with your system (but you may contact me)
mkdir /mnt/r
const { find2 } = require('../controllers/category') | |
module.exports = { | |
definition: ` | |
type Category2 { | |
id: ID! | |
created_at: DateTime! | |
updated_at: DateTime! | |
Title: String | |
Icon: String |
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({ |
upgrade: | |
npx ts-node-esm ./upgrade.ts | |
npm update -S |
<?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 || |
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) { |