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 os.path | |
import shutil | |
import openpyxl | |
original_filepath = 'assets/a.xlsx' | |
original_folder = os.path.dirname(original_filepath) | |
original_filename = os.path.splitext(os.path.basename(original_filepath))[0] | |
original_workbook = openpyxl.load_workbook(original_filepath) |
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
const http = require("http"); | |
const hostname = "0.0.0.0"; // 允许局域网内访问 | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
let clientDisplayName = undefined; | |
const userAgent = req.headers["user-agent"]; | |
if (userAgent.includes("MicroMessenger")) { | |
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
#region 必要参数配置 | |
// https://github.com/settings/tokens | |
var accessToken = "ghp_"; | |
/* | |
使用 https://sqlitebrowser.org/ 创建一个 SQLite 数据库文件,并执行以下语句创建表 | |
CREATE TABLE "Stars" ( | |
"Id" INTEGER UNIQUE, | |
"Owner" TEXT NOT NULL, |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" /> | |
<style> | |
.container { |
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
var root = new TreeNode(1) | |
{ | |
Left = new TreeNode(2) | |
{ | |
Left = new TreeNode(4), | |
Right = new TreeNode(5) | |
}, | |
Right = new TreeNode(3) | |
{ |
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
/* | |
Q: 给定一个的目标值,在一个横向有序和纵向有序的二维数组(矩阵 matrix)中找到该目标值的坐标 | |
可以从矩阵的右上角或者左下角开始查找。 | |
假设从右上角开始查询: | |
如果当前元素大于目标值,则可以排除当前元素所在的列,因为这一列都会比目标值大; | |
如果当前元素小于目标值,则可以排除当前元素所在的行,因为这一行都会比目标值小。 | |
通过这种方式,每次都可以排除一整行或者一整列,大大减少了比较的次数,时间复杂度为 O(m+n) | |
*/ |
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
int[] array = { 1,11,21,31,41 }; | |
foreach(int num in array) { | |
Console.WriteLine(BinarySearchMatrix(array, num)); | |
} | |
// 二分查找:在一维数组中找到目标值的索引 | |
int BinarySearch(int[] array,int target) | |
{ | |
// 初始化指针,定义头指针 left、尾指针 right = 二维数组中一维数组的数量-1=4-1,双闭区间 [0, array.Length - 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
const { Resolver } = require('node:dns').promises; | |
const { performance } = require('perf_hooks'); | |
const domain = 'giao.com'; | |
const resolver = new Resolver(); | |
resolver.setServers(['192.168.31.117']); | |
async function main() { | |
const numIterations = 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
// logging.middleware.ts | |
import { Injectable, NestMiddleware } from '@nestjs/common'; | |
import { NextFunction, Request, Response } from 'express'; | |
@Injectable() | |
export class LoggingMiddleware implements NestMiddleware { | |
use(req: Request, res: Response, next: NextFunction) { | |
console.log(`start [${req.method}] ${req.url}`); | |
const oldSend = res.send; | |
res.send = (body: any): any => { |
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 { | |
Injectable, | |
CanActivate, | |
ExecutionContext, | |
HttpStatus, | |
BadRequestException, | |
UnauthorizedException, | |
} from '@nestjs/common'; | |
import { Request } from 'express'; | |
import { ConfigService } from '@nestjs/config'; |
NewerOlder