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
| import asyncFs from 'node:fs/promises'; | |
| // More on Unicode BOMs: https://en.wikipedia.org/wiki/Byte_order_mark | |
| // Note: tested with the sample files from: https://github.com/voku/simple-mysqli/tree/master/tests/fixtures | |
| type BomHandler = { | |
| name: string, | |
| encoding?: BufferEncoding, | |
| bytes: number[], | |
| readFile?: (filePath: string) => Promise<string> |
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
| // ref: https://tritonstore.com.au/ean-vs-isbn/ | |
| function checkDigitISSN (value: string): number | 'X' { | |
| let sum = 0; | |
| const len = value.length; | |
| for (let i = 0; i < value.length; i++) { | |
| sum += (parseInt(value.charAt(i)) * ((len - i) + 1)); | |
| } |
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
| import { AtpAgent, AtpSessionEvent, AtpSessionData } from '@atproto/api' | |
| import { FeedViewPost } from '@atproto/api/dist/client/types/app/bsky/feed/defs'; | |
| import { ExternalEmbedView, ImagesEmbedView, VideoEmbedView } from '@atproto/bsky/dist/views/types'; | |
| const identifier = 'myuser.bsky.social'; | |
| const password = 'xxxx-xxxx-xxx-xxxx'; | |
| const bSkyService = 'https://bsky.social'; | |
| const bSkyPublicService = 'https://public.api.bsky.app'; | |
| function displayPost (feedEntry: FeedViewPost) { |
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
| .dropzone.dropzone-active { | |
| box-shadow: 0px 0px 15px 0px rgba(73, 245, 54, 0.75); | |
| } | |
| .dropzone.dropzone-badtype { | |
| cursor: no-drop; | |
| box-shadow: 0px 0px 15px 0px rgba(248, 19, 19, 0.75); | |
| content: url("./white-x-icon.svg"); | |
| } |
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
| import { AnyThreadChannel, Channel, ChannelType, Client, FetchedThreads, ForumChannel, ForumThreadChannel, IntentsBitField, Message, Partials, ThreadChannel } from "discord.js"; | |
| let client: Client; | |
| let botToken = 'xxxxxxxxxx'; | |
| async function getClient (): Promise<Client<boolean>> { | |
| if (!client && botToken) { | |
| // eslint-disable-next-line no-async-promise-executor | |
| client = await new Promise(async (resolve, reject) => { | |
| const intents: number[] = [ |
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
| function removeAccents (text: string) { | |
| return text.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | |
| } | |
| /** | |
| * Converts a string, that may include extended latin characters | |
| * and accents, to the more limited range supported by the English | |
| * alphabet and 128 bit ASCII. | |
| * | |
| * There may be some disagreement in the character mapping, but we |
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
| #!/bin/sh | |
| ## Draft tool to create thumbnails from office documents, since unoconv wasn't working for me. | |
| soffice_cmd="/Applications/LibreOffice.app/Contents/MacOS/soffice" | |
| input_file="$1" | |
| extension="${input_file##*.}" | |
| noext_filepath="${input_file%.*}" | |
| tmp_filepath="${TMPDIR}docthumb-$(date +%s)" |
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
| <template> | |
| <q-card class="markdown-edit" outlined> | |
| <q-toolbar dense> | |
| <q-tabs v-model="mode" align="left" dense > | |
| <q-tab name="edit" :label="$t('label.write')"/> | |
| <q-tab name="preview" :label="$t('label.textPreview')"/> | |
| </q-tabs> | |
| <q-space /> | |
| <q-toolbar v-if="mode === 'edit'"> | |
| <q-space /> |
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
| #!/bin/sh | |
| ## Quick script to convert webp files to mp4. Makes use of webpmux, ImageMagick and ffmpeg | |
| input=$1 | |
| output_base=/tmp | |
| output_file=output.mp4 | |
| regex="Number of frames: ([0-9]+)" | |
| info=`webpmux -info "$1"` |
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
| import axios from 'axios'; | |
| import { Request, Response, NextFunction } from 'express'; | |
| import jwt, { GetPublicKeyOrSecret, Secret } from 'jsonwebtoken'; | |
| import jwksClient, { JwksClient } from 'jwks-rsa'; | |
| import UnauthenticatedError from '../errors/UnauthenticatedError'; | |
| import { getLogger } from './logging'; | |
| const logger = getLogger('openid'); | |
| /** |
NewerOlder