Skip to content

Instantly share code, notes, and snippets.

@cztchoice
cztchoice / custom_git.sh
Last active November 5, 2023 23:09
git 易用配置
# 提供的简易的,有色彩的git lg 选项
git config --global alias.lg "log --color --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
# 支持git status显示中文
git config --global core.quotepath false
@cztchoice
cztchoice / KeyModifier.ahk
Created October 27, 2023 23:05
windows下我当前的快捷键修改方案
; 参考 https://github.com/Vonng/Capslock/blob/master/win/CapsLock.ahk
SetCapsLockState, AlwaysOff
#If GetKeyState("CapsLock", "P")
h::Left
j::Down
k::Up
l::Right
a::Home
@cztchoice
cztchoice / flomo_to_markdown.py
Created October 10, 2023 02:51
flomo 导出文件转markdown,方便导入obsidian
import markdownify
import re
import datetime
from bs4 import BeautifulSoup
with open("index.html") as f:
html = f.read()
soup = BeautifulSoup(html, 'html.parser')
memos = soup.find_all('div', class_='memo')
@cztchoice
cztchoice / const_ref_return.cpp
Created April 12, 2018 23:39
返回stack上变量的const ref
#include <iostream>
#include <memory>
#include <vector>
#include <string>
using namespace std;
class TestVector
{
public:
~TestVector()
@cztchoice
cztchoice / another_read_file.cpp
Last active March 24, 2018 07:30
C++读取文件到string
std::ostringstream fileContentsStream;
fileContentsStream << std::ifstream("MyFile.txt").rdbuf();
std::string fileContents = fileContentsStream.str();
@cztchoice
cztchoice / trace.cpp
Created March 14, 2018 02:42
增加Trace
auto isPinned = __IsPinned();
auto pinStr = ANY_TO_STRING(isPinned);
G::UserTraceService()->LogTraceWithoutEmail("IsPinned", pinStr);
@cztchoice
cztchoice / callDllFunction.cpp
Created March 12, 2018 06:25
windows load function of dll
void CChromeViewSupport::__LoadLib()
{
typedef bool (*createChromeSupport_t)(IChromeSupportLib** ppChrome);
static createChromeSupport_t pFunc = NULL;
if (m_hLib == NULL)
{
HMODULE h = ::LoadLibrary(L"BrowserLib.dll");
if (h)
{
pFunc = (createChromeSupport_t)::GetProcAddress(h, "CreateChromeSupport");
@cztchoice
cztchoice / find_and_delete.cpp
Created March 5, 2018 03:46
C++ vector 查找并删除一个元素
auto iter = std::find(m_mainFormList.begin(), m_mainFormList.end(), form);
if (iter != m_mainFormList.end())
{
m_mainFormList.erase(iter);
}
@cztchoice
cztchoice / find_and_delete.cpp
Created March 5, 2018 03:46
C++ vector 查找并删除一个元素
auto iter = std::find(m_mainFormList.begin(), m_mainFormList.end(), form);
if (iter != m_mainFormList.end())
{
m_mainFormList.erase(iter);
}
@cztchoice
cztchoice / find_and_delete.cpp
Created March 5, 2018 03:46
C++ vector 查找并删除一个元素
auto iter = std::find(m_mainFormList.begin(), m_mainFormList.end(), form);
if (iter != m_mainFormList.end())
{
m_mainFormList.erase(iter);
}