Skip to content

Instantly share code, notes, and snippets.

View navono's full-sized avatar
:octocat:
I may be slow to respond.

Darkness navono

:octocat:
I may be slow to respond.
View GitHub Profile
@navono
navono / .py
Created June 7, 2024 00:53
py 解压中文压缩包
def support_gbk(zip_file: zipfile.ZipFile):
name_to_info = zip_file.NameToInfo.copy()
for name, info in name_to_info.items():
try:
real_name = name.encode('cp437').decode('gbk')
except UnicodeDecodeError:
real_name = name.encode('utf-8').decode('utf-8')
if real_name != name:
info.filename = real_name
@navono
navono / CMakeLists.txt
Created March 22, 2024 00:00
PaddleOCR 的 cpp_infer 的 CMakeLists 修改版
cmake_minimum_required(VERSION 3.14)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(get_platform)
include(CPM)
include(import_library)
project(ppocr LANGUAGES CXX CUDA)
message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
@navono
navono / CMakeLists.txt
Created March 5, 2024 07:12
CMake 工程示例配置文件
################################################## Project ##################################################
cmake_minimum_required(VERSION 3.24)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(utils)
extract_version()
include(get_platform)
include(CPM)
@navono
navono / port-foward.sh
Created February 26, 2024 03:03
将远程机器的端口转发到本机端口
# 将远程 10.30 的 8888 端口转发到本机的 8080 端口
ssh -L localhost:8080:localhost:8888 [email protected]
@navono
navono / XLogger.h
Created February 23, 2024 01:10
spdlog
#pragma once
#include "spdlog/async.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"// or "../stdout_sinks.h" if no color needed
#include "spdlog/spdlog.h"
#include <chrono>
#include <iostream>
#include <memory>
#include <string>
@navono
navono / hash.h
Created December 19, 2023 01:23
hash string then can use it in switch statement
constexpr unsigned int hash(const char* s, int off = 0) {
return !s[off] ? 5381 : (hash(s, off + 1) * 33) ^ s[off];
}
@navono
navono / release.cmd
Created December 19, 2023 00:09
Compile C++ with conan and CMake in Windows Batch
@ECHO ON
set BASEDIR=%~dp0
PUSHD %BASEDIR%
RMDIR /Q /S release
mkdir release
REM for connan
conan install . -if=./release --build=missing -s build_type=Release --profile=default-x86
@navono
navono / test
Created March 24, 2023 09:33
flowchart
{"items":[{"name":"圆角矩形01","uuid":"dce7fa90-ca23-11ed-be30-f7d500738953","x":100,"y":50,"width":200,"height":200,"type":"RoundRect","visible":true,"shapeDataType":"Path","style":{"locked":false,"rotation":0,"cornerRadius":4,"opacity":1,"strokeWidth":1,"lineStyle":"solid","dashArray":[],"bgFillEnable":true,"strokeEnable":true,"bgColor":{"type":"theme","value":"$theme.local.color.bgColor"},"bgMainColor":"#FFFF00","bgGradientColor":"#ffffff","bgGradientFillType":"fill","bgFillType":"purityStyle","strokeColor":{"type":"string","value":"#000000"},"fontFamily":"宋体","fontSize":16,"scaleX":1,"scaleY":1},"layer":{"uuid":"d982d690-ca23-11ed-be30-f7d500738953","name":"图层1","visible":true},"animation":{},"action":{},"scripts":"","shape":{"pathData":"M104.93827,250c-2.72733,0 -4.93827,-2.29598 -4.93827,-5.12821v-189.74359c0,-2.83223 2.21094,-5.12821 4.93827,-5.12821h190.12346c2.72733,0 4.93827,2.29598 4.93827,5.12821v189.74359c0,2.83223 -2.21094,5.12821 -4.93827,5.12821z","componentWidth":162,"componentHeight":156,"compon
@navono
navono / remove node_modules
Last active March 7, 2023 11:30
remove all node_modules
# 递归删除下工程内的所有node_modules
find . -name "node_modules" -type d -exec rm -rf '{}' +
# 命令拆解注释
# . 当前目录
# -name 名字匹配,指定字符串作为寻找文件或目录的范本样式;
# -type 查询文件类型。 -d 就是目录
# -exec 就是匹配后执行一些命令
# rm -rf '{}' 删除匹配到到('{}')
# + 是个骚操作
# 一个-exec只能执行一个命令,而且必须在命令后面加上终结符,终结符有两个:“;”和“+”。
@navono
navono / settings.json
Created August 12, 2022 06:27
vscode settings.json
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll": true
}
}