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
| #include <iostream> | |
| #include <vector> | |
| #include <type_traits> | |
| // Helper to check if a type is a container (excluding string) | |
| template <typename T, typename = void> | |
| struct is_container : std::false_type {}; | |
| template <typename T> | |
| struct is_container<T, std::void_t<decltype(std::begin(std::declval<T&>())), |
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
| xx () | |
| { | |
| if [[ -z "$1" ]]; then | |
| echo "Usage: $0 <filename.cpp|filename.cc>"; | |
| return 1; | |
| fi; | |
| local src_file=$1; | |
| local file_ext="${src_file##*.}"; | |
| local dest_file="${src_file%.*}.out"; | |
| local CXX_bin=/opt/compiler/gcc-12/bin/g++; |
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
| #!/bin/bash | |
| ### usage : sudo gen_bits_stdcpp | |
| clang_list=( | |
| /opt/homebrew/opt/llvm/include/c++/v1/bits/ | |
| /Library/Developer/CommandLineTools/usr/include/bits/ | |
| /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/bits/ | |
| /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/bits/ | |
| ) | |
| gcc_std_content=$( |
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
| #include <cuda_runtime.h> | |
| #define CUDA_CHECK(call) \ | |
| do { \ | |
| cudaError_t err = call; \ | |
| if (err != cudaSuccess) { \ | |
| fprintf(stderr, "CUDA error %s:%d: %s\n", __FILE__, __LINE__, \ | |
| cudaGetErrorString(err)); \ | |
| exit(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
| #include <random> | |
| #include <chrono> | |
| #include <iostream> | |
| using namespace std::chrono; | |
| class TimeCost { | |
| public: | |
| TimeCost() : _start_time(std::chrono::high_resolution_clock::now()) {} |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>BAT_mini_alignment</key> | |
| <string>left</string> | |
| <key>BAT_mini_color</key> | |
| <string>utilization</string> | |
| <key>Battery_barChart_position</key> | |
| <string>1</string> |
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
| set pagination off # 禁用分页模式,防止 gdb 在输出长信息时暂停 | |
| set print pretty on # 更好地打印结构体、数组等复杂数据结构 | |
| highlight-source on # 启用语法高亮 | |
| set print array on # 打印数组时自动显示所有元素 | |
| set print elements 0 # 显示所有数组元素,默认最多显示200个 |
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
| --- | |
| BasedOnStyle: Google | |
| IndentWidth: 4 | |
| SortIncludes: false | |
| AccessModifierOffset: -4 | |
| ContinuationIndentWidth: 4 | |
| AlignAfterOpenBracket: true | |
| AlignOperands: true | |
| AlignTrailingComments: true | |
| MaxEmptyLinesToKeep: 2 |
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
| alias vb='vi ~/.bashrc' | |
| alias sb='source ~/.bashrc' | |
| alias vv="vi ~/.vimrc" | |
| alias ll="ls -alh --color=auto" | |
| alias grep="grep --color" | |
| alias cd='func() { cd $1; ls;}; func' | |
| alias ccc="cd $HOME/code/cpp_code/test_cpp/" | |
| alias pyy="cd $HOME/code/py_code/" | |
| alias py=python3 |
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
| # in .bashrc | |
| PS1_LINE='\[[\033[01;35m\]\d \t] \[\033[01;36m\]\u@\H\[\033[01;32m\] \w\[\033[00m\]\n\[\033[01;31m\]\$\[\033[00m\] ' | |
| PROMPT_COMMAND=' | |
| LAST_EXIT=$?; | |
| if [ $LAST_EXIT -eq 0 ]; then | |
| export PS1="\[\e[32m\]$LAST_EXIT\[\e[0m\] $PS1_LINE" | |
| else | |
| export PS1="\[\e[31m\]$LAST_EXIT\[\e[0m\] $PS1_LINE" | |
| fi' |
NewerOlder