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
'use client'; | |
import { useState, useCallback, useMemo, Dispatch, SetStateAction } from 'react'; | |
export interface DataArray<R> { | |
data: R[] & { added: R[]; updated: R[]; removed: R[]; initial: R[] }; | |
length: number; | |
isMutated: boolean; | |
isInsert: boolean; | |
isUpdate: boolean; |
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 { lazy, forwardRef, useEffect } from 'react'; | |
export interface PlotlyProps extends HTMLAttributes<HTMLDivElement> { | |
data: Partial<Data>[]; | |
layout?: Partial<Layout>; | |
config?: Partial<Config>; | |
} | |
export const Plotly = lazy( | |
() => |
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
/** | |
* Definition of the animation frame callback function type | |
*/ | |
type AnimationFrameCallback = (time: number) => void; | |
/** | |
* Definition of the cancel function type | |
*/ | |
type CancelFunction = () => void; |
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
curl --location --request POST 'https://grok.com/rest/app-chat/conversations/new' \ | |
--header 'accept: */*' \ | |
--header 'accept-language: en-GB,en;q=0.9' \ | |
--header 'content-type: application/json' \ | |
--header 'origin: https://grok.com' \ | |
--header 'priority: u=1, i' \ | |
--header 'referer: https://grok.com/' \ | |
--header 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Brave";v="126"' \ | |
--header 'sec-ch-ua-mobile: ?0' \ | |
--header 'sec-ch-ua-platform: "macOS"' \ |
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 { z } from 'zod'; | |
import { formDataToObject, createFormDataPaths } from './zod-util'; | |
const schema = z.object({ | |
username: z.string(), | |
location: z.object({ | |
latitude: z.number(), | |
longitude: z.number(), | |
}), | |
strings: z.array(z.object({ value: z.string() })), |
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
# INSERT fail2ban FORWARD for Docker host | |
sudo iptables -I FORWARD -j f2b-postgres | |
# DELETE fail2ban FORWARD for Docker host | |
sudo iptables -D FORWARD -j f2b-postgres | |
# Save | |
sudo iptables-save |
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
#!/bin/bash | |
SHDIR=$(dirname $0) | |
NOWDA=$(date '+%Y%m%d') | |
NOWDT=$(date '+%Y%m%d%H%M%S') | |
BUDIR="/data/backup/docker/compose/$NOWDA" | |
mkdir -p "$BUDIR" | |
find "$SHDIR" -maxdepth 3 -type d 2>/dev/null | while read COMPOSE_DIR |
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
'use client'; | |
import { | |
AlertDialog, | |
AlertDialogContent, | |
AlertDialogDescription, | |
AlertDialogFooter, | |
AlertDialogHeader, | |
AlertDialogTitle, | |
} from '@/components/ui/alert-dialog'; |
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
// app/api/route.ts | |
import { Configuration, OpenAIApi } from 'openai'; | |
export const runtime = 'nodejs'; | |
// This is required to enable streaming | |
export const dynamic = 'force-dynamic'; | |
export async function GET() { | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, |
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
const encoder = new TextEncoder(); | |
const ITERATIONS = 65535; | |
const LENGTH = 64; | |
const ALGORITHM = 'PBKDF2'; | |
const DIGEST = 'SHA-256'; | |
const DERIVED_KEY = { | |
name: 'AES-CBC', | |
length: 256, | |
} as const; | |
const USAGES = { |
NewerOlder