自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

idealcitier's Daily life

小白的日常学习

  • 博客(122)
  • 资源 (3)
  • 收藏
  • 关注

原创 TO DO LIST

TO DO LIST见评论

2019-12-12 09:20:43 539 116

原创 delete a mutex while it is locked

[1] https://stackoverflow.com/questions/34030156/deleting-a-mutex-that-is-locked[2] https://en.cppreference.com/w/cpp/thread/mutex/~mutex

2023-02-03 10:02:33 157 1

原创 常用的环境变量PATH,LD_LIBRARY_PATH,LIBRARY_PATH

PATH,LD_LIBRARY_PATH,LIBRARY_PATH环境变量经常使用,但经常忘记,遂记录下。

2022-12-08 16:50:19 503

原创 signal

信号提供一种机制,告诉用户进程发生了那些异常。

2022-11-28 10:39:47 278

原创 exit order

【代码】exit order。

2022-11-03 16:24:43 187 4

原创 visit

【代码】visit。

2022-10-13 19:41:17 77

原创 bfs广度优先遍历

bfs

2022-09-18 11:02:37 211

原创 CMake 获取clang 版本

通过cmake set设置CMAKE_C_COMPILER/CMAKE_ASM_COMPILER/CMAKE_CXX_COMPILER,CMake 中与 clang相关的变量如下,但都是系统clang相关的,与前面设置clang无关:可以通过下面的命令获取自定义的clang的版本[1] https://stackoverflow.com/questions/16150888/cmake-branch-on-clang-version...

2022-07-14 16:33:49 1513

原创 C语言嵌入汇编Extended ASM

Extended ASM在程序中可能需要对寄存器进行操作,而使用C/C++无法直接对寄存器进行操作,这就要用到嵌入汇编。基本语法嵌入汇编的基本语法如下:asm asm-qualifiers ( "AssemblerTemplate" // 汇编指令,使用\n分割,可写多行 : OutputOperands // 输出 : InputOperands // 输入 : Clobbers // 汇编代码更改的寄存器,使用','分割,具

2022-05-10 23:20:11 389

原创 dlopen 和函数属性 __attribute__((constructor))& __attribute__((destructor))

dlopen 和函数属性 attribute((constructor))& attribute((destructor))Shared objects may export functions using the__attribute__((constructor)) and __attribute__((destructor))function attributes. Constructor functions are executed beforedlopen() returns,

2022-01-18 11:51:42 698

原创 cmake demo

hello world with cmake编写源文件// hello/main.cpp#include <iostream>int main(int argc, char** argv){ std::cout << "Hello World" << std::endl; return 0;}编写cmake文件创建文件CMakeList.txt,文件内容project(HelloWorld)cmake_minimum_required(VERSI

2022-01-14 10:00:49 288

原创 c++ string bugfix

#include <iostream>#include <algorithm>#include <string>#include <vector>std::vector<std::string> spiltStringBySemicilon(std::string str) { std::vector<std::string> eles; while (int pos = str.find(";") != st

2021-12-27 15:46:51 449

原创 删除string首尾以及中间的空格

删除string首尾以及中间的空格对char*字符串进行操作,删除其中的空格,十分的繁琐。若代码为c++代码可以借助标准库算法,可对字符串首尾以及中间的空格进行删除。#include <iostream>#include <algorithm>#include <string>int main() { std::string content = " 11223 3344 "; content.erase(remove(content.b

2021-12-27 14:57:08 682

原创 string&c_str()的使用

C语言中对字符串(char*)操作的方法较少,在c++ 中可将(char*)转换为string类进行操作。c++中可使用的c_str() 方法将string转换为const char *。 但使用该方法要注意使用场合,如使用不当,极易出现各种问题。#include <iostream>#include <string>using namespace std;const char *GetName(const char *nameAndID) { if (nameAnd

2021-12-23 21:27:34 539

原创 迭代过程中删除指定元素

迭代过程中删除指定元素总结4中在迭代过程删除list中指定元素方法1#include <iostream>#include <list>using namespace std;int main() { list<int> lst = {1,2,3,4,5}; auto it = lst.begin(); while(it != lst.end()) { if (*it == 4) { it =

2021-12-11 15:01:08 838

原创 生成core dump文件进行gdb调试

环境No LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 18.04.2 LTSRelease: 18.04Codename: bionic生成core dump文件ulimit -c unlimitedecho 1 > /proc/sys/kernel/core_uses_pid添加如下内容到/etc/sysctl.conf文件夹中,生成的coredump文

2021-11-30 16:42:40 198

原创 ubuntu tab 自动补全失效

现象没有修改.bashrc文件,共用一台机器的小伙伴也没有对系统的bashrc文件的进行修改。tab的自动补全功能莫名其妙的失效。使用tab自动补全时,显示如下内容(仅粘贴部分内容)+ _init_completion+ local exclude= flag outx errx inx OPTIND=1+ getopts n:e:o:i:s flag+ COMPREPLY=()+ local 'redir=@(?([0-9])<|?([0-9&])>?(>)|&gt

2021-10-26 20:51:17 1678 1

原创 atexit,exit

exit任何一个线程调用exit都会导致进程结束(进程一旦结束,进程中的所有线程都会结束)atexit通过atexit注册的方法,可以在程序正常退出(exit)时进行执行。注册的方法为无参数、无返回值的方法。atexit最多可以注册32个方法。exit函数调用后,执行顺序和注册的顺序相反,也就是说最后注册的方法先执行。同一个方法注册多次会执行多次demo// gcc demo.cpp -lpthread#include<pthread.h>#include<std

2021-06-18 15:40:06 105

原创 tmux常用设置和常用命令

tmuxtmux自定义快捷键默认prefix为ctrl + b, 这个设计对于我个人不方便,修改为ctrl+x// ~/.tmux.confunbind C-bset -g prefix C-x基本思路session→windows→panesSessiontmux可以创建多个sessiontmux new -s sessionNamesessionName为自定义的session的名字查看所有的sessiontmux lssession外选择指定打开的sessiontm

2020-11-21 21:03:46 1724

原创 linux 常用命令

linux 常用命令查看文件夹下所有的软链接ls -alR | grep ^l

2020-10-29 21:43:37 99

原创 windows-terminal设置

// For documentation on these settings, see: https://aka.ms/terminal-documentation{ "$schema": "https://aka.ms/terminal-profiles-schema", "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "theme": "dark", "confirmCloseAllTabs": f

2020-10-26 19:07:29 157

原创 arm汇编

arm汇编寄存器sp: (Stack Pointer),栈顶寄存器,用于保存栈顶地址fp(x29): (Frame Pointer)为栈基址寄存,用于保存栈底地址lr(x30): (Link Register) ,保存调用跳转指令 bl 指令的下一条指令的内存地址zr(x31): (Zero Register),xzr/wzr分别代表 64/32 位,其作用就是 0,写进去代表丢弃结果,读出来是 0pc: 保存将要执行的指令的地址(有操作系统决定其值,不能改写)。指令add将某一寄存器的值

2020-10-22 20:46:09 970 1

原创 linux下文件解压

rar文件解压到当前文件夹(Extract files to current directory. Does not create any subdirectories.)rar e file.rar创建同名目录,解压到同名目录下(Extract files with full path.)rar x file.rar

2020-09-25 09:28:52 183

原创 c++单例模式

#include <iostream>using namespace std;class Singleton{public: static Singleton &GetSingleton() { static Singleton instance; return instance; } void Print() { std::cout << "我的实例内存地址是:" << this &

2020-08-17 19:21:24 83

原创 [flag] Resolved ‘***‘ using previous resolution.

error: could not apply ****... ******hint: after resolving the conflicts, mark the corrected pathshint: with 'git add <paths>' or 'git rm <paths>'hint: and commit the result with 'git commit'Resolved '***********' using previous resolution.

2020-07-29 14:09:46 798 3

原创 c++长字符串换行

#include<iostream>using namespace std;int main(){ string str1 = "congrat" "ulation"; string str2 = "congrat" \ "ulation"; string str3 = "congrat \ ulation"; cout << str1

2020-07-28 10:31:04 992

原创 [flag] c++ 花式打印

#include<iostream>using namespace std;std::ostream &log() { return std::cout;}int main() { string str; log() << "hello"; return 0;}

2020-07-27 21:04:14 238

原创 emacs常用

常用功能键常用功能键有ctrl键和meta键(在类unix终端该键对应于esc, 其实在大部分设备对应于alt键, 没有办法确定的话, 那就尝试下呗).组合键的使用C-x C-c表示同时按下ctrl与x键,松开后再同时按下Ctrl与c键C-x o表示同时按下ctrl键与x键,松开后再按下o键基本操作帮助操作C-h t 入门指南C-h v 查看变量C-h f 查看函数C-h ? 查看帮助列表文件操作C-x C-f 打开文件C-x C-s 保存文件C-x C-w 存

2020-07-25 15:21:19 124

原创 aoti使用注意,越界问题以及Segmentation fault问题

官方解释:Interprets an integer value in a byte string pointed to by str.Discards any whitespace characters until the first non-whitespace character is found, then takes as many characters as possible to form a valid integer number representation and convert

2020-06-19 20:24:57 920 1

原创 C/C++ 返回局部变量-error

还是举一个例子,将str = strTmp 掉,对比前后输出的变化。#include <iostream>#include <string>#include <vector>using namespace std;void foo(char **str) { char *strTmp[4] = {nullptr}; strTmp[0] = reinterpret_cast<char *>('a'); str = strTmp

2020-06-13 12:00:41 184

原创 java-内部类,成员类,局部类,匿名类

内部类, innerClass成员类, memberClass局部类, localClass匿名类, anonymousClass下面举一个例子,来简单的介绍各种类public class Hello { class IsMemberClass { // member class } public static void main(String[] args) { class IsLocalClass { // local class .

2020-06-13 10:14:56 163

原创 static关键字

#include <iostream>using namespace std;void fn();int main(){ fn(); fn(); fn();}void fn(){ static int n = 10; cout << n << endl; n++;}101112

2020-06-03 19:32:59 108 1

原创 static_cast 和 reinterpret_cast区别

C++中类型之间的转换,可以分为隐式类型转换和显式类型转换隐式类型转换是自动执行的,无需显式的进行操作。 隐式类型转换发生在很多地方,比如函数实参到形参的类型转换、函数返回值类型的自动转换,在此不进行进一步的介绍。C++ 提供四种转换操作符来实现显式类型转换(强类型转换),static_cast, reinterpret_cast, const_cast 和 dynamic_castconst_cast 和 dynamic_cast后面的两种中,const_cast用于去除除对象的const或者vo

2020-05-25 15:04:12 530

原创 xargs, sed,grep 组合使用

xargsxargs可以捕获一个命令的输出,然后传递给另外的一个命令。例如find /bin -name bash | xargs ls -al-rwxr-xr-x 1 root root 1113504 Jun 7 2019 /bin/bashfind /bin -name bash 的输出传递给ls -al上面的例子中find /bin -name bash 只有一个输出,直接传递给ls -al。若前面的命令有多个输出,挨个将输出传递给xargs后面的命令;假若xargs后面无命令,

2020-05-23 09:54:35 2083 1

原创 leetcode-3.无重复字符的最长子串

给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。示例 1:输入: “abcabcbb”输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例 2:输入: “bbbbb”输出: 1解释: 因为无重复字符的最长子串是 “b”,所以其长度为 1。示例 3:输入: “pwwkew”输出: 3解释: 因为无重复字符的最长子串是 “wke”,所以其长度为 3。请注意,你的答案必须是 子串 的长度,“pwke” 是一个子序列,不是子串。#inclu.

2020-05-18 21:02:34 107

原创 leetcode-373. 查找和最小的K对数字&自定义优先队列的顺序(C++)

给定两个以升序排列的整形数组 nums1 和 nums2, 以及一个整数 k。定义一对值 (u,v),其中第一个元素来自 nums1,第二个元素来自 nums2。找到和最小的 k 对数字 (u1,v1), (u2,v2) … (uk,vk)。示例 1:输入: nums1 = [1,7,11], nums2 = [2,4,6], k = 3输出: [1,2],[1,4],[1,6]解释: 返回序列中的前 3 对数:[1,2],[1,4],[1,6],[7,2],[7,4],[11,2],[7,6

2020-05-18 00:03:52 220

原创 LeetCode-165.比较版本号

比较两个版本号 version1 和 version2。如果 version1 > version2 返回 1,如果 version1 < version2 返回 -1, 除此之外返回 0。你可以假设版本字符串非空,并且只包含数字和 . 字符。. 字符不代表小数点,而是用于分隔数字序列。例如,2.5 不是“两个半”,也不是“差一半到三”,而是第二版中的第五个小版本。你可以假设版本号的每一级的默认修订版号为 0。例如,版本号 3.4 的第一级(大版本)和第二级(小版本)修订号分别为 3.

2020-05-10 23:29:59 139

原创 leetcode-678.有效的括号字符串

给定一个只包含三种字符的字符串:( ,) 和 *,写一个函数来检验这个字符串是否为有效字符串。有效字符串具有如下规则:任何左括号 ( 必须有相应的右括号 )。任何右括号 ) 必须有相应的左括号 ( 。左括号 ( 必须在对应的右括号之前 )。“*”可以被视为单个右括号 ) ,或单个左括号 ( ,或一个空字符串。一个空字符串也被视为有效字符串。示例 1:输入: “()”输出: True示例 2:输入: “(*)”输出: True示例 3:输入: “(*))”输出: True#i.

2020-05-10 22:38:17 169 1

原创 leetcode-1094. 拼车

假设你是一位顺风车司机,车上最初有 capacity 个空座位可以用来载客。由于道路的限制,车 只能 向一个方向行驶(也就是说,不允许掉头或改变方向,你可以将其想象为一个向量)。这儿有一份乘客行程计划表 trips[][],其中 trips[i] = [num_passengers, start_location, end_location] 包含了第 i 组乘客的行程信息:必须接送的乘客数量;乘客的上车地点;以及乘客的下车地点。这些给出的地点位置是从你的 初始 出发位置向前行驶到这些地点所需的.

2020-05-08 23:34:48 225

原创 LeetCode-5.3.下一个更大元素 II

给定一个循环数组(最后一个元素的下一个元素是数组的第一个元素),输出每个元素的下一个更大元素。数字 x 的下一个更大的元素是按数组遍历顺序,这个数字之后的第一个比它更大的数,这意味着你应该循环地搜索它的下一个更大的数。如果不存在,则输出 -1。示例 1:输入: [1,2,1]输出: [2,-1,2]解释: 第一个 1 的下一个更大的数是 2;数字 2 找不到下一个更大的数;第二个 1...

2020-05-06 20:45:07 125 1

树莓派-vscode

可以在树莓派上进行使用vs code进行带的编写的,简单易用。

2018-10-11

Head_First_Python(中文影印版)

Head_First_Python(中文影印版),很清晰。Head_First系列丛书语句通俗易懂。

2017-09-28

简明python教程

简明python教程,高清pdf,非扫描。人生苦短,就学python~

2017-09-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除