Skip to content

Instantly share code, notes, and snippets.

View SurpassHR's full-sized avatar
🌴
On vacation

SurpassHR

🌴
On vacation
  • 西安
  • 03:41 (UTC +08:00)
View GitHub Profile
@SurpassHR
SurpassHR / 微信UA.md
Created September 20, 2025 10:23 — forked from stormslowly/微信UA.md
微信UA识别

iPhone 通过微信内置浏览器访问网页时得到 User Agent 是:

Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B329 MicroMessenger/5.0.1

Android 通过微信内置浏览器访问网页时得到 User Agent 是:

Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255
@SurpassHR
SurpassHR / Context.md
Last active August 20, 2023 11:11
NotesToAlgorithms_Robert

B-Trees

Suffix Arrays

Maximum Flow

Search Problems

Reduction

@SurpassHR
SurpassHR / ConfigClangd.md
Last active August 27, 2023 10:39
CodeShare

在 VSCode 中配置 Clangd

  • 安装 clangd 后端
sudo apt-get install clangd
  • 配置 VSCode Clangd
{
@SurpassHR
SurpassHR / stl_algorithm.md
Last active July 5, 2023 13:21
STLFunctions

stl_algorithm

std::equal_range

  • LeetCode 0001. 两数相加

Git LFS(Large File Storage)

# 以 huggingface 为例,先安装 huggingface_cli,以下操作均在 linux-debian ubuntu distro 环境下进行
python -m pip install --upgrade pip && python -m pip install huggingface_hub

#安装 git-lfs
sudo apt-get update && sudp apt-get install git-lfs

# 初始化新 git 本地仓库
  • 1.下面哪种变量定义不当,可能导致堆栈溢出:

    A.静态全局变量

    B.动态全局变量

    C.静态局部变量

    D.动态局部变量

@SurpassHR
SurpassHR / Constructor&Destructor.md
Last active June 24, 2023 15:23
C++ClassRelatedProblems
  • 在 C++ 中,每个有虚函数的类都会维护一个虚函数表(也称为虚方法表),其中存储了该类中所有虚函数的地址。在创建对象时,编译器会在对象的内存布局中添加一个指向虚函数表的指针 vptr,它指向该类所对应的虚函数表。

  • 当我们调用一个虚函数时,编译器会根据对象的类型找到它的虚函数表,并从中查找对应的虚函数地址,然后通过函数指针调用实际的函数代码。

  • 但是,在析构函数中调用其他虚函数时,由于对象已经被销毁,其内部数据成员和虚函数表也随之被释放掉了。这就意味着,即使我们可以通过 this 指针访问到对象本身,但是无法再根据对象的类型找到正确的虚函数表和虚函数地址。因此,在调用虚函数时就有可能出现未定义行为或者崩溃的情况。

  • 例如,假设我们有如下的代码:

class MyBase {
@SurpassHR
SurpassHR / 23-04-21.md
Last active April 22, 2023 07:32
OnlineJudge-Q

16. A-B Problem Plus

题目描述

I have a very simple problem for you again. Given two integers A and B, your job is to calculate the result of A - B.

解答要求

时间限制:1000ms, 内存限制:100MB

@SurpassHR
SurpassHR / 16. A-B Problem Plus.cpp
Last active April 23, 2023 02:17
OnlineJudge-A
#include <iostream>
#include <vector>
using namespace std;
bool isGreaterEqual(string A, string B) {
if (A.size() > B.size()) {
return true;
} else if (A.size() < B.size()) {
return false;
} else {
@SurpassHR
SurpassHR / 23. Merge k Sorted Lists.cpp
Last active February 5, 2023 02:03
LeetCode - Solutions
class Solution {
private:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode* ret, * p1, * p2, * t;
p1 = l1; p2 = l2;
if (p1->val < p2->val) {
ret = p1;
p1 = p1->next;
} else {
ret = p2;