Skip to content

Instantly share code, notes, and snippets.

View bxb100's full-sized avatar
😭
R.I.P, My friends

Lemon bxb100

😭
R.I.P, My friends
View GitHub Profile
@bxb100
bxb100 / system.md
Created July 1, 2023 02:50
操作系统
@bxb100
bxb100 / useUndo.ts
Created February 17, 2024 14:00 — forked from KristofferEriksson/useUndo.ts
A React hook that enhances your components with powerful undo/redo functionality
import { useCallback, useEffect, useRef, useState } from "react";
interface UseUndoHook<T> {
value: T;
onChange: (newValue: T) => void;
undo: () => void;
redo: () => void;
clear: () => void;
canUndo: boolean;
canRedo: boolean;

Comparison of Spring Cloud with Eureka

I feel Consul.io does better in the following area:

  • The focus on scriptable configuration allows for better container management.
    Eureka requires either external Configuration Server or multiple configuration files.

  • The options for securing communications is more advanced.
    Eureka requires creating application with security settings desired. Default will allow HTTP only. Registration of end points assumes http but can be forced to https with code.

@bxb100
bxb100 / Caddyfile
Created April 13, 2024 15:22
Dify Caddyfile
{$dify_host_name} {
header {
# Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
X-Content-Type-Options "nosniff"
# X-Robots-Tag
import { createClient } from 'npm:@1password/sdk';
const decoder = new TextDecoder();
const runCli = async (args: string[] | string) => {
if (typeof args === 'string') {
args = [args]
}
const command = new Deno.Command("op", {
args: [...args],