自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 资源 (16)
  • 收藏
  • 关注

原创 给老 ubuntu 服务器 (非 root 用户) 安装 vim

由于公司服务器 vim 太老, 而自己想要用新版的 vim, 但没有去 root 权限没法安装, 也没法编译 vim 源码. 于是在虚拟机下安装 vim 再拷贝到服务器.找个与服务器相同的 linux 版本安装到虚拟机上, 如服务器是 ubuntu18.04 的就在虚拟机上安装ubuntu18.04, 然后开始编译源码, 编译源码可以参考Ubuntu 18.04 下编译安装 vim 8.1.编译前要特别注意configure 时, 要配置 `-prefix=` 为服务器上所要拷贝至的路径, 因...

2021-11-06 23:50:08 675

原创 批量解析 android 堆栈脚本

import osimport reimport sysimport subprocesscurrent_path = os.getcwd()aadr2Tool = 'aarch64-linux-android-addr2line'def printTrace(inFile): line_num = 0 # trace num with open(inFile, 'r', encoding='utf-8') as in_fd: line = in_fd.r.

2021-10-30 01:08:17 1325

原创 Ubuntu 18.04 xfce4桌面下命令行下联网

#!/bin/bashnmcli dev wifinmcli dev wifi connect ssidxxx password passxxx重启网络#!/bin/bashsudo service networking restartsudo service network-manager restart

2021-08-01 08:18:56 452

原创 一个解析日志的脚本

#!/usr/bin/env python3#coding=utf-8import unicodedataimport osimport reimport sysimport subprocesscurrent_path = os.getcwd()#print(current_path)with os.popen('find $PWD -maxdepth 1 -type d -name "*chi-cdk"') as chi_fd: chi_path = chi_fd.rea

2021-04-08 11:52:25 139 2

原创 两子数组交集问题

同事刷题:给定一个元素,类型为小写字符串数组, 请计算两个没有相同字符的子数组的长度乘积的最大值, 若果没有符合条件的子数组, 返回0.输入条件: 输入为半角逗号分隔的小写字符串数组, 数组长度[2,100], 字符串长度[0,50]#!/usr/bin/env python3import rearr=[]arr = input('Enter the str: ')# get between [2,100] num of lowcase chars splittd with','whil

2021-04-03 23:42:02 373

原创 python3 中英文标点转换

工作中遇到需要把中文标点转化成英文标点的需求,#coding=utf-8import unicodedataimport osimport redef punctuation_mend(string): #输入字符串或者txt文件路径 table = {ord(f):ord(t) for f,t in zip( u',、。!?【】()%#@&1234567890“”‘’', u',..!?[]()%#@&12

2021-04-03 19:48:26 1378

原创 非root用户安装命令

bash 命令行配置提示符PS1='\[\e[90m\][\[\e[33;1m\]\w\[\e[90m\]]$\[\e[0m\] \[\e[37m\]'工具 The Silver Searcher & ripgrep & vim8.2服务器环境 [~]$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Relea.

2020-10-29 21:15:21 806

原创 FW中写死密码

https://forum.archive.openwrt.org/viewtopic.php?id=37190最简单的是设置好密码后, 把shadow文件里的内容写死到FW里.

2020-09-21 18:35:54 391

原创 openwrt编译sdk是报错“File “/usr/lib/python2.7/subprocess.py“, line 1047, raise child_exception “

问题在编译openwrt的SDK时, 执行 python genimg.py --bootconfig_gen=bootconfig_tool --mbn_gen=nand_mbn_generator.py --configdir=config/ --skip_export --outdir=image/bin --image_name=BOOTCONFIG_IMAGES 包如下错误: Processing ENTRY_SVH01-C1 Using existing directory:.

2020-09-13 18:20:06 4446 2

转载 C++类的成员变量在声明时初始化

能。可能早先的版本不能,但是c++11标准下能。有人说在声明的时候初始化相当于在构造函数中初始化,其实不是的,成员变量初始化的顺序为:先进行声明时初始化,然后进行初始化列表初始化,最后进行构造函数初始化,如下代码:(另外初始化列表中初始化的顺序是和变量声明的顺序一样,而与列表中的顺序无关)#include <iostream>using namespace std;class Test {public: Test() {} Test(int a_) : a(a_) {

2020-08-13 11:13:22 1083

原创 编写一个程序解决选择问题. 令 k = N / 2

数据结构与算法分析ch01.1编写一个程序解决选择问题. 令 k = N / 2, 也就是找第k个最大数.//Exercise 1.1 ://Write a program to solve the selection problem. Let k = n/2. that is find the k_th max num in N array.//Draw a table showing the running time of your program for various values of n

2020-07-20 22:20:59 609

原创 3. 容器的分类与测试 - array

array是一种固定长度的sequence container(顺序容器)/* * @file: container_test.cpp */#include "container.h"int main(int argc, char **argv){ jj01::test_array(); return 0;}辅助测试方法/* * @file: helper.h */#ifndef __HELPER__#define __HELPER__us

2020-07-19 17:05:37 96

原创 C++类型自动推导auto 和 decltype

C++11之前数据类型在编译的时候必须显示指定, 在新版本的C++中, 许多关键字可以让编译器自动推导出数据类型, 虽然这回略微增添编译的时间, 但对最终的程序的运行时间没有任何影响, 这给编写程序带来了很大的便利.auto用于声明变量时, 根据变量的值推导出变量的类型示例1:// C++ program to demonstrate working of auto // and type inference #include <bits/stdc++.h> using names

2020-07-17 20:34:15 132

原创 ubuntu18.04 64位运行32位的arm-openwrt-linux-gnueabi-gcc

问题:在ubuntu18.04上用32位的工具链交叉编译程序是发现工具链不可用:/bin/arm-openwrt-linux-gcc command not found/bin/arm-openwrt-linux-gcc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directoryMakefile:14: recipe for ta..

2020-07-17 19:16:48 1972

原创 已知一系列依赖关系, 求解并输出正常的服务器

am-an(m, n为小于3000的正整数), 表示am依赖于an, 若an损坏, 则am也不能工作,现在输入一系列am-an的依赖关系, 以 ‘,’ 分割, 并输入损坏的部件ax, 按升序输出正常的ay.本题输入输出严格遵循要求, 涉及到字符串处理, 排序等/* * @author: garret * @date: 2020/07/15 * @comipler: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 */#include <stdio.h&

2020-07-15 17:50:46 483

原创 局部跳转和非局部跳转

局部跳转goto虽然很多书籍对goto建议 “谨慎使用, 或者根本不用”, 然而当一个函数的多个分支需要一个统一出口时, goto语句就非常必要了. Linux之父Linus在Linux中大量使用goto, 也是在启示着我们可以合理使用goto语句.在高通的qsdk中的time_genoff_qmi.c就有这么一段code.int time_genoff_operation(time_genoff_info_type *pargs){ if (connect(sock_id, .

2020-07-04 23:09:32 288

原创 C Interfaces and Implementations 资源

c语言接口与实现创建可重用软件的技术资源链接:中文 https://www.52doc.com/detail/3255英文 https://b-ok.cc/book/1269893/492835

2020-07-04 17:07:50 348

原创 vfork fork clone execv

clone是Linux为创建线程设计的(虽然也可以用clone创建进程)。所以可以说clone是fork的升级版本,不仅可以创建进程或者线程,还可以指定创建新的命名空间(namespace)、有选择的继承父进程的内存、甚至可以将创建出来的进程变成父进程的兄弟进程等等。clone和fork的调用方式也很不相同,clone调用需要传入一个函数,该函数在子进程中执行。此外,clone和fork最大不同在于clone不再复制父进程的栈空间,而是自己创建一个新的。fork()是将父进程的全部资源复制给了子进程。而

2020-07-03 20:27:33 202

原创 musl-libc 和 glibc

客户反馈说在编译器下找不到libpthread,libpthread is integrated into musl libc, 在musl-libc中, libpthread库整合到 libc 库中用objdump -Tt libc.so.1 | grep pthread_create确认

2020-07-03 19:53:11 3107 3

转载 nm和readelf命令的区别

一般来说,对于一个so库有两个符号表,一个是“正常的”(在.symtab和.strtab节中)。一个是动态的(.dynsym和.dynstr节中)。如果这个两个表被移除,那么so库就完全没有用了。动态符号表的符号只被用于动态加载器运行时的加载。而“正常”的符号表,一般是用来调试的,里面的函数符号,是没有被导出的(一般是一些静态函数),所以不可能被外部程序使用。“正常”的符号表里面的函数符号,也不会在动态符号表中。可以用 nm -D 和 readelf -s这两个命令来显示一个so文件的动态符号表信息。链接

2020-06-22 14:28:40 1192

原创 目录项和页表项

页目录项中含有指向一个页面表的指针, 页页面表中含有指向一个页面起始地址的指针.每个目录项和页表项都是以4字节(32位机器)的长度存储的数据,由于页面表和页面的起始地址都总是在4K字节的边界上, 这些指针的低12位都永远是0. 这样, 在目录项和页面表中都只要有20位的指针就够了, 余下的12位则可以用于控制或其他的目的.0000 1000 0000 0100 1000 0101 0110 1000可 见,高10位是0000 1000 00, 也就是32, 所以i386CPU就以32位下标去页面目录

2020-06-19 10:55:16 2826

转载 带缓冲的IO和不带缓冲的IO

文件描述符:文件描述符是一个小的非负整数,是内核用来标识特定进程正在访问的文件标准输入/输出/出错:shell为每个程序打开了三个文件描述符,STDIN_FILEON,STDOUT_FILEON,STDERR_FILEON,默认这三个文件描述符都链向终端不带缓冲的IO:函数open read write lseek close提供了不用缓冲的IO。这些函数都使用文件描述符ssize_t read(int fd,void *buf,size_t count)从fd标识的文件中一次读取count字

2020-06-16 12:02:59 442

原创 sync同步

传统的UNIX系统实现在内核中设有缓冲区高速缓存和页高速缓存, 大多数磁盘I/O都通过缓冲区进行. 当我们向文件写入数据时, 内核通常先将数据复制到缓冲区中, 然后排入队列, 晚些的时候再写入磁盘. 这种方式被称为延迟写(delayed write).通常, 当内核需要重用缓冲区来存放其他磁盘数据时, 它会把所有延迟写数据写入磁盘. 为了保证磁盘上实际文件系统与缓冲区中内容的一致性, UNIX系统提供了sync, fsync和fdatasync三个函数.syncsync只是将所有修改过的块缓冲区排

2020-06-16 11:06:53 1210

原创 linux读写api

read write#include <unistd.h>ssize_t read(int fd, void *buf, size_t nbytes); Returns: number of bytes read, 0 if end of file, −1 on errorssize_t write(int fd, const void *buf, size_t nbytes); Returns: number of by.

2020-06-07 01:01:19 146

原创 FILE对象指针(流)和文件描述符相互转换

有时候用open系统调用打开一个文件, 返回一个文件描述符(fd), 然后我们可用用read, write等可以操作文件描述符的API操作这个fd. 但是后面你可能会碰到需要用到这个文件的FILE对象指针的API, 如fwrite, fprintf等, 这时候如果不方便对这个文件关闭后再用库函数fopen打开这个文件以得到FILE对象指针, 那么怎么可以在不关闭fd的情况下得到该文件的FILE对象指针呢? 这时候用fdopen库函数即可,FILE *file = fdopen(fd, "w");反之也可

2020-06-06 15:07:34 812

转载 linux中block和page的区别

What is the difference between pages and blocks?A block is the smallest unit of data that an operating system can either write to a file or read from a file.What exactly is a page?Pages are used by some operating systems instead of blocks. A page i..

2020-06-04 10:02:52 1775

原创 Jetson Nano通过i2c更新NUCLEO FW

开发环境nano dev kit with l4t32.3.1.stm32 NUCLEO-L433RC-P连线NanoNucleoJ41 Pin 27 (SDA)CN7 Pin9 PB7(SDA)J41 Pin 28 (SCL)CN7 Pin1 PB6(SCL)J41 Pin 1 (3.3V)CN5 Pin 7(BOOT0)J41 P...

2020-01-16 17:27:47 722

VTT.to.SRT.Converter.exe

webVTT 字幕转成 srt格式, 批量转换, 选择整个文件夹, 一键操作. A tool for converting Web Video Text Tracks Format (WebVTT) subtitle to srt one. As most of video players support srt subtitles and can't open vtt subtitles, We should convert vtt to srt or sub subtitles but it's not easy to do that.

2020-01-22

ARM驱动学习资料

1 Linux设备驱动开发详解:基于最新的Linux4.0内核 文字版+源码 2 鸟哥的Linux私房菜:基础学习篇 第四版 3 GNULinux Rapid Embedded Programming 4 Linux From Scratch Version 8.2 5 Linux内核实现设计与实现 3nd 6 linux设备驱动程序 7 Mastering Modern Linux 2nd

2018-12-05

C++17 STL Cookbook & Mastering the C++17 STL

C++17 STL Cookbook: Discover the latest enhancements to functional programming and lambda expressions Mastering the C++17 STL: Make full use of the standard library components in C++17 C__17 STL Cookbook.epub C__17 STL Cookbook.mobi C__17 STL Cookbook.pdf 9781787120495_Code.zip Mastering the C++17 STL.epub 源码和文档

2018-01-30

算法导论第三版_中英文版+第一章---第35章完整版答案

一共三个文件 , 原版+中文翻译办+全书各章答案 Introduction to Algorithms Third Edition 算法导论(原书第3版) 平装 – 2012年12月26日 Thomas H.Cormen (作者),‎ Charles E.Leiserson (作者),‎ Ronald L.Rivest (作者),‎ Clifford Stein (作者),‎ 殷建平 (译者), 答案 1--35章 + 附录A--D: Exercise 1.1-1 An example of a real world situation that would require sorting would be if you wanted to keep track of a bunch of people’s file folders and be able to look up a given name quickly. A convex hull might be needed if you needed to secure a wildlife sanctuary with fencing and had to contain a bunch of specific nesting locations. Exercise 35.1-1 We could select the graph that consists of only two vertices and a single edge between them. Then, the approximation algorithm will always select both of the vertices, whereas the minimum vertex cover is only one vertex. more generally, we could pick our graph to be k edges on a graph with 2k vertices so that each connected component only has a single edge. In these examples, we will have that the approximate solution is off by a factor of two from the exact one. Exercise D.1-1 Let C = A + B and D = A − B. Then, since A and B are symmetric, we…..

2018-01-13

A Practical Guide to Linux Commands, Editors, and Shell Programming 4th, ed

格式请手动改成 pdf Practical Guide to Linux Commands, Editors, and Shell Programming, A, 4th Edition By Mark G. Sobell, Matthew Helmke Published Nov 9, 2017 by Addison-Wesley Professional. The Most Useful Tutorial and Reference, with Hundreds of High-Quality Examples for Every Popular Linux Distribution “First Sobell taught people how to use Linux . . . now he teaches you the power of Linux. A must-have book for anyone who wants to take Linux to the next level.” —Jon “maddog” Hall, Executive Director, Linux International Discover the Power of Linux–Covers macOS, too! Learn from hundreds of realistic, high-quality examples, and become a true command-line guru Covers MariaDB, DNF, and Python 3 300+ page reference section covers 102 utilities, including macOS commands

2018-01-01

算法导论 中文版 第三版 高清

完整书签 算法导论(原书第3版) 目录: 第一部分 基础知识 第1章 算法在计算中的作用3 1.1 算法3 1.2 作为一种技术的算法6 思考题8 本章注记8 第2章 算法基础9 2.1 插入排序9 2.2 分析算法13 2.3 设计算法16 2.3.1 分治法16 2.3.2 分析分治算法20 思考题22 本章注记24 .......

2017-12-30

The C++ Programming Language, 4th Edition

C++ 程序设计语言:第1~4部分(第4版) 享誉 C++ 圣经之美名,C++ 之父的经典之作

2017-10-09

Android_Advisor

Android Advisor - (Issue 27 2016) Features 4 Google Home 10 Google Daydream 15 Google Allo and Google Duo 20 Android Wear 2.0 28 How fast is Android N? 56 What are ‘bots’? 62 WhatsApp Messenger tips and tricks

2017-10-06

Neural Network Programming with Java

Alan M. F. Souza, Fabio M. Soares January 2016 Neural networks are very intelligent algorithmic systems. Learn how to create them with Java with this guide dedicated to cutting-edge neural network development

2017-10-06

51的数码管水滴程序

用数码管实现的水滴效果 初学者非常适合

2012-10-06

基于51的数码管贪食蛇程序+文档+详细注释

一.程序功能 利用数码管的动态显示,以模拟贪食蛇。S1、S2、S3、S4分别控制蛇的上、下、左、右的移动,当蛇吃到随机点亮的dp时,则态显示的数码管的亮点个数自动加一,同时作为蛇食物的dp点重新随机点亮一个(注意这里只考虑0~2号前三个数码管的dp点作为食物。第四个数码管的dp点若作为食物,蛇吃后必定撞墙,为了确保蛇能不断长长的可能性,所以第四个数码管的dp不考虑作为食物)。当出现蛇越过数码管的边缘、蛇首尾重合或者蛇的长度(已点亮的数码管点的个数)超过定义的最大长度(程序定义的是6,可以改动)时,游戏结束。 二.程序原理 》》》》》》》》》》》》》》》》 三.关键代码 /******************************************************************* * Copyright (C),2012-2014,764 Studio. * File name: segsnake.c * Author: zzb Version: v1.0 * Date: Mar 30.2012 * Description: 数码管模拟的贪食蛇 * Function List: init(void) 初始化 * gamePlay(void) 游戏启动控制 * createFood(void) 随机选择要点亮的dp * drawFood(void) 点亮已选择的dp作为食物 * drawSnake(void) 点亮蛇身 * touchWall(void) 越过数码管的边缘 * touchSelf(void) 碰到已点亮的点 * gameOver(void) 游戏结束 * moveSnake(void) 按设定的方向移动已亮的点 * oppositeDirection(i16 keyCode) 输入方向与原来方向相反时,不做处理 * foodEat(void) 点亮的dp被吃到 * expandSnake(void) 吃到dp后的蛇变长 * getKey(void) 获取按键信息 * main() 入口函数 ********************************************************************/

2012-10-06

基于51的红外发射接收程序+文档

老师布置的作业 一.程序功能 将待发送的数据调制成一系列的脉冲信号,再通过红外管发送信号。 二.程序原理 2.1 红外发送接收原理 》》》》》 /******************************************************************* * Copyright (C),2012-2014,764 Studio. * File name: ir.c * Author: zzb Version: v1.0 * Date: May.01.2012 * Description: 红外发送程序 * Function List: void SendIRdata(char p_irdata); //发送数据 * void delay(); //延时函数 ********************************************************************/

2012-10-06

空空如也

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

TA关注的人

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