![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Linux Programming & Tools
Linux programming and tools
LUCKY-LIVING
这个作者很懒,什么都没留下…
展开
-
singleton模式 C++
singleton 模式 C++基本形态#include <iostream>#include <string>class TestSingleton{public: static TestSingleton *create_instance(void) { if (instance_ == nullptr) { instance_ = new TestSingleton();原创 2022-05-02 12:46:37 · 787 阅读 · 0 评论 -
the difference between unique_lock and lock_guard
the difference between unique_lock and lock_guardunique_lock 和 lock_guard 都提供RAII style的编程方式,就是在构造函数中加锁,在析构函数中解锁。lock_guard 只有构造函数和析构函数,不提供其他成员方法。unique_lock 提供成员函数形式的lock和unlockcondition_varible的lock参数必须是unique_locklock_guard#include <thread>原创 2022-04-12 11:57:26 · 232 阅读 · 0 评论 -
c++ bind函数
bind () 函数原创 2022-04-06 17:46:38 · 5984 阅读 · 0 评论 -
有名管道操作
有名管道fifo的读端阻塞,写端关闭后,读端返回0,表示写端结束。当写端没有关闭时,无数据时,读端阻塞。fifo读端非阻塞时,read 返回Resource temporarily unavailable 错误。原创 2021-11-30 20:00:47 · 123 阅读 · 0 评论 -
AVL Tree
AVL Tree头文件/* * PacketBB handler library (see RFC 5444) * Copyright (c) 2010 Henning Rogge <hrogge@googlemail.com> * Original OLSRd implementation by Hannes Gredler <hannes@gredler.at> * All rights reserved. * * Redistribution and use i原创 2021-07-08 19:41:44 · 152 阅读 · 0 评论 -
进程间传递文件描述符
进程间传递文件描述符原创 2021-07-07 19:42:53 · 884 阅读 · 3 评论 -
ubus 源码解析
ubus 源码解析1. ubus 安装2. ubusdubus 是使用epoll 来处理IO的很好的例子。ubus_main.c 中int main(int argc, char **argv){ const char *ubus_socket = UBUS_UNIX_SOCKET; int ret = 0; int ch; signal(SIGPIPE, SIG_IGN); signal(SIGHUP, sighup_handler); openlog("ubusd", LOG原创 2021-07-05 11:33:36 · 2679 阅读 · 0 评论 -
flex&bison 高级计算器
flex&bison 高级计算器fb3_2.h#ifndef _FB3_2_H_#define _FB3_2_H_extern int yylineno;void yyerror(char *s, ...);#define NHASH 9997enum bifs { B_sqrt = 1, B_exp, B_log, B_print,};struct ast { int nodetype; struct ast *l;原创 2021-03-03 12:45:49 · 431 阅读 · 0 评论 -
freetype字体描边
最近需要用到描边字体。freetype官网给出了一份描边sample, 不过这份代码是C++的。还好csdn有兄弟用c对这个重写了一份。使用这份代码前需要了解freetype里边的一些主要概念。下面记录主要记录下这个过程。参考https://www.freetype.org/freetype2/docs/tutorial/step1.html...原创 2020-07-09 11:04:55 · 3261 阅读 · 0 评论 -
开源小工具记录
开源小工具记录进程管理工具perpperp原创 2020-09-02 10:51:34 · 105 阅读 · 0 评论 -
OTA 升级中的跟文件系统切换
OTA 升级中跟文件系统切换贴脚本#!/bin/shkill -9 -1echo 3 > /proc/sys/vm/drop_cachessync#/tmp/是新的最小文件系统#创建相应目录mkdir /tmp/bin/mkdir /tmp/sbin/mkdir /tmp/proc/mkdir /tmp/dev/mkdir /tmp/sys/mkdir /tmp/lib/mkdir /tmp/root/#拷贝必要的库cp /lib/libc* /tmp/lib原创 2020-11-23 14:09:58 · 355 阅读 · 1 评论 -
系统内存统计曲线图
系统内存统计曲线图使用下面的脚本运行生成文本信息#!/bin/shfile=`date +"%x"`filename=${file}.txtwhile truedosleep 2cat /proc/stat | sed -n 1p |awk '{print $2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8}' >> $filenamecat /proc/meminfo | sed -n 2p | awk '{print $2}' >>原创 2020-08-27 16:20:57 · 802 阅读 · 0 评论 -
top中查看线程信息
top 中查看线程信息在top 运行起来后,按h键,会显示线程信息。原创 2019-10-25 17:40:33 · 4391 阅读 · 1 评论 -
graphviz画数据结构关系图
graphviz画数据结构关系图模板整理一下用到了node的属性有:shapelabel 加{ }表示field竖向排列,不加表示横向排列。colorstyle用到了edge的属性有:dirlabeldigraph snd_config { node [shape=record]; rootconfig [label=&amp;amp;quot;{&amp;amp;amp;lt;e1&amp;amp;amp;原创 2018-10-14 21:35:45 · 3691 阅读 · 1 评论 -
Linux上常用工具记录
Linux上常用工具记录原创 2018-10-14 21:37:56 · 195 阅读 · 0 评论 -
gnuplot 画图
gnuplot 画图plot styleslinesplot “right.txt" with linespointsplot “right.txt” with pointslinespointplot “right.txt” with linespointboxesplot “right.txt” with boxes参考:gnuplot.pdf...原创 2018-11-16 10:23:07 · 264 阅读 · 0 评论 -
git 使用整理
git 使用整理git stash参考:https://www.cnblogs.com/tocy/p/git-stash-reference.html不断添加中。。。。。。。。。。。。原创 2018-11-30 09:23:09 · 126 阅读 · 0 评论 -
gdb使用整理
gdb使用整理coredump 配置使用kernel[Config Kernel settings] -> [General setup] -> [Configure standard kernel features(except users)] -> [Enable ELF core dumps],打开该选项编译后在image目录下多一个 vmlinuz.img.al...原创 2018-12-05 17:50:46 · 189 阅读 · 0 评论 -
linux终端定制
linux终端定制使用terminater,zsh,tmux,spf13-vim定制自己的linux终端。首先安装terminater: sudo apt-get install terminater。terminater是一个终端软件,安装后他会替换默认的终端,按快捷键出来的就是terminater。terminater可以进行分屏,但是多终端分屏还是推荐tmux,tmux可以运行在ter......原创 2019-01-14 16:42:10 · 976 阅读 · 0 评论 -
Makefile 知识点记录
Makefile 知识点记录1. 依赖类型:normal Prerequisites,order-only prerequisitesnormal Prerequisites:标准依赖具有两层含义的声明,一 它声明了方法运行的顺序,所有依赖的的方法必须在对象的方法运行之前运行完。二 它声明了对象的依赖关系,如果有任何依赖比对象新,那么目标对象就认为是过期的,必须要重建。order-only ......原创 2019-01-30 11:19:26 · 633 阅读 · 1 评论 -
xargs 和管道的区别
xargs 和管道的区别经典用法 find -name “*.a" | xargs -i cp {} ~/lib简单说就是管道把内容送到标准输入, xargs 是把管道送来的内容转成后边命令的参数。参考:https://www.cnblogs.com/wangqiguo/p/6464234.html...原创 2019-03-20 15:49:57 · 357 阅读 · 0 评论 -
fakeroot
fakeroot简介fakeroot ubuntu manpage的解释如下fakeroot - run a command in an environment faking root privileges for file manipulationfakeroot建立一种环境,在里边运行的命令可以以假的root权限操作文件。 读完上面这一句还是不太明白它有什么用,到底怎么用。下面又有...原创 2019-03-13 16:09:08 · 9243 阅读 · 0 评论 -
vim 使用技巧记录
命令模式命令:edit使用:edit 命令再vim中打开文件。可视block模式ctrl-v进入可视block模式操作列。原创 2019-04-10 17:16:47 · 123 阅读 · 0 评论 -
使用Vim+Ctags+Cscope阅读源代码
因为所有设计思想、内部机制都是以代码的形式实现,所有的资料也都是为了更好的诠释代码。那么一个好的阅读工具,能够提高阅读的效率和效果。• "Cscope"[4]为终端下的代码阅读工具,资源消耗少,对那些忠于命令行的行操作的人,使用起来更加方便、灵活。这也是这篇文章推荐使用的一个重要原因。也有人把Cscope和Emasc绑定阅读源码。当然工具的选取,也取决于个人习惯。Vim+C转载 2015-01-03 14:49:09 · 399 阅读 · 0 评论