- 博客(96)
- 收藏
- 关注
原创 echo 输出颜色闪烁控制
echo -e “\033[字背景颜色;字体颜色m字符串\033[控制码”字体背景颜色 40:黑 41:深红 42:绿 43:黄色 44:蓝色 45:紫色 46:深绿 47:白色 字体颜色 5:闪烁 30:黑 31:红 32:绿 33:黄 34:蓝色 35:紫色 36:深绿 37:白色 控制码会改变shell的输出设置最好不要用 控制码
2017-12-13 10:26:58
3972
原创 python基础
1.python数据类型标准数据类型 Numbers(数字) String(字符串) List(列表) Tuple(元组) Dictionary(字典)2.查看变量内存地址a = b = c = 1以上实例,创建一个整型对象,值为1,三个变量被分配到相同的内存空间上。使用print id(var)对三个变量的内存地址进行确认3.中括号使用var="0123
2017-09-21 10:53:56
253
原创 shell编程基础
····shell变量 定义变量 variableName="value" 使用变量 echo ${variableName} 只读变量 readonly variableName 删除变量 unset variableName 变量类型 1)局部变量 仅仅当
2017-06-19 17:47:27
1031
原创 shell特殊变量\shell函数特殊变量
$0 当前脚本的文件名$n 传递给脚本或函数的参数。n 是一个数字,表示第几个参数。例如,第一个参数是$1,第二个参数是$2。$# 传递给脚本或函数的参数个数。$* 传递给脚本或函数的所有参数。$@ 传递给脚本或函数的所有参数。被双引号(" ")包含时,与 $* 稍有不同,下面将会讲到。$? 上个命令的退出状态,或函数的返回值。$$ 当前Shell进程ID。对于 Shell 脚本,
2017-06-14 16:30:55
388
原创 ipython安装
一、python安装 1.下载源码官网下载最新版本wget http://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz2.依赖解决shell# yum install readline-devel *bz* openssl openssl-devel zlib-devel gcc *sqlite* 模块 依赖 说明_bsddb
2017-06-04 09:09:43
4740
原创 mysql5.7-主从设置
一.master配置如下 1.在主服务器上,必须启用二进制日志记录并配置唯一的服务器ID.[mysqld]log-bin=mysql-binserver-id=1(下面的之后弄明白)innodb_flush_log_at_trx_commit=1sync_binlog=12.创建用户用于日志传输mysql> CREATE USER 'repl'@'%.mydomain.com' IDEN
2017-05-31 09:12:15
351
原创 shell-test、[]用法
数值测试参数 说明-eq 等于则为真-ne 不等于则为真-gt 大于则为真-ge 大于等于则为真-lt 小于则为真-le 小于等于则为真例子[ 1 -lt 4 ]test 1 -lt 4 文件测试参数 说明-e 文件名 如果文件存在则为真-r 文件名 如果文件存在且可读则为真-w 文件名 如果文件存在且可写则为真-
2017-05-12 11:35:46
279
原创 Shell语法 条件、循环
if [ expression 1 ]then Statement(s) to be executed if expression 1 is trueelif [ expression 2 ]then Statement(s) to be executed if expression 2 is trueelif [ expression 3 ]then Statement
2017-05-12 11:26:56
344
原创 iptables__防火墙
-A INPUT -s 192.168.102.0/24 -p tcp -m state --state NEW -m tcp --dport 6396 -j ACCEPT-A 追加,规则会表最后一行。可以使用 -I 行号-s 源ip-d 目的ip(省略了)-p 选择协议(tcp,udp,icmp) tcp中常用 --dport --sport udp中常用 --dport -
2017-05-04 11:29:02
259
原创 C-UDP-广播模型
服务端#include <string.h>#include <stdio.h>#include <unistd.h>#include <arpa/inet.h>#include <ctype.h>#include <stdlib.h>#define SERVER_PORT 8000#define CLIENT_PORT 9000#define MAXLINE 1500#define
2017-04-25 09:21:45
459
原创 C-UDP-服务器客户端模型
服务器代码#include <string.h>#include <stdio.h>#include <unistd.h>#include <arpa/inet.h>#include <ctype.h>#define SERV_PORT 8000int main(){ struct sockaddr_in serv_addr,clie_addr; socklen_t cli
2017-04-24 13:37:09
422
转载 C-socket编-线程池
#include <stdlib.h>#include <pthread.h>#include <unistd.h>#include <assert.h>#include <stdio.h>#include <string.h>#include <signal.h>#include <errno.h>/*#include "threadpool.h"*/#define DEFAUL
2017-04-17 17:53:55
1295
原创 C-socket编-epoll反应堆模型
#include <stdio.h>#include <sys/socket.h>#include <sys/epoll.h>#include <arpa/inet.h>#include <fcntl.h>#include <unistd.h>#include <errno.h>#include <string.h>#include <stdlib.h>#include <time
2017-04-10 10:48:07
561
原创 C-socket编-epoll()模型
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/epoll.h>#include <errno.h>#include <ctype.h>#include "wrap.h"#define SERV_PORT
2017-04-10 10:42:08
267
原创 C-socket编-poll()模型
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netinet/in.h>#include <arpa/inet.h>#include <poll.h>#include <errno.h>#include <ctype.h>#include "wrap.h"#define MAXLINE 80#def
2017-04-10 10:38:20
370
转载 linux系统调用、库函数和内核函数关系与区别
看系统调用,还有库函数,以前一直不明白,总是以为 系统调用跟库函数是一样的,但是今天才知道是不一样的。库函数也就是我们通常所说的应用编程接口API,它其实就是一个函数定义,比如常见read()、write()等函数说明了如何获得一个给定的服务,但是系统调用是通过软中断向内核发出一个明确的请求,再者系统调用是在内核完成的,而用户态的函数是在函数库完成的。系统调用发生在内核空间,因此如果在用户空间的
2017-04-01 15:42:26
7405
原创 C-socket编程-多进程版并发服务器
#include <string.h>#include <arpa/inet.h>#include <sys/socket.h>#include <netinet/in.h>#include "wrap.h"int main(){ //创建套接字 int serv_sock = Socket(AF_INET,SOCK_STREAM,0); /
2017-03-21 16:58:06
3153
原创 C-socket编程-Select()模型
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <arpa/inet.h>#include <ctype.h>#include "wrap.h"#define SERV_PORT 6666int main(){ int i,j,n,maxi;
2017-03-21 16:56:25
589
原创 C-socket编程-客户端服务端通信模型
服务端代码#include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/socket.h>#include <netinet/in.h>int main(){ //创建套接字 int serv_sock = socket(AF_INET,SOCK_ST
2017-03-13 13:32:24
663
原创 linux编程-信号讲解
Signal()函数使用简介 signal()是一种系统调用,用于通知运行时系统,当某种特定的“软件中断”发生时调用特定的程序。它的真正的名字应该是“Call_that_routine_when_this_interrupt_Comes_in(当该中断发生时调用那个程序)", 调用signal()函数,并通过参数传递告诉它终端类型以及用于处理中断的程序。
2017-02-07 11:10:20
480
原创 系统函数-文件操作-dup() dup2()
#include <unistd.h> int dup( int oldfd ); int dup2( int oldfd, int targetfd ); dup()函数利用函数dup,我们可以复制一个描述符。传给该函数一个既有的描述符,它就会返回一个新的描述符,这个新的描述符是传给它的描述符的拷贝。这意味着,这两个描述符共享同一个数据结构。例如,如果我们对一个文件描述
2017-01-20 13:38:20
368
原创 系统函数-文件操作-unlink()
unlink#include <unistd.h>int unlink(const char* pathname);描述:删除文件,当文件打开时不能删除,关闭后立即删除返回值:调用成功返回0不成功返回-1.
2017-01-20 13:36:47
431
原创 系统函数-文件操作-truncate()
文件截断或填充truncate#include <unistd.h>int truncate(const char * path, off_t length);int ftruncate(int fd, off_t length);函数说明:truncate()会将参数path 指定的文件大小改为参数length 指定的大小. 如果原来的文件大小比参数length 大, 则超过的部分会被删去.返
2017-01-20 13:35:14
1149
原创 系统函数-文件操作-chown()
描述:修改文件属主,属组chown#include <sys/types.h>#include <unistd.h>int chown(const char * path, uid_t owner, gid_t group);函数说明:chown()会将参数path 指定文件的所有者变更为参数owner 代表的用户,而将该文件的组变更为参数group 组。如果参数owner 或group 为
2017-01-20 13:32:11
513
原创 系统函数-文件操作-chmod()
描述:修改文件权限chmod#include <sys/types.h> #include <sys/stat.h>int chmod(const char * path, mode_t mode);返回值:权限改变成功返回0, 失败返回-1, 错误原因存于errno.
2017-01-20 13:31:04
370
原创 系统函数-文件操作-access()
描述:检测文件是否拥有某种权限int access(const char * pathname, int mode);mode:R_OK:读权限W_OK:写权限X_OK:执行权限F_OK:文件是否存在返回值:通过了检查则返回0值,表示成功,只要有一权限被禁止则返回-1。
2017-01-20 13:26:23
370
原创 系统函数-文件操作-lseek()
描述:设置读写指针lseek#include <unistd.h>off_t lseek(int fd, off_t offset, int whence);SEEK_SET:文件首SEEK_CUR:读写指针当前位置SEEK_END:文件尾返回值:>0:当调用成功时则返回目前的读写位置,也就是距离文件开头多少个字节-1:错误用途:1.获取文件大小。2.扩展文件
2017-01-20 13:24:01
608
原创 系统函数-文件操作-write() read()
READ#include <unistd.h>ssize_t read(int fd, void *buf, size_t count);返回值:>0:读取的字节数count,小于count说明文件到尾了=0:文件已经到尾了-1:读取文件错误WRITE#include <unistd.h>ssize_t write(int fd, const void *buf, size_t coun
2017-01-20 13:21:52
653
原创 系统函数-文件操作-open()
OPEN#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int open(const char *pathname, int flags);int open(const char *pathname, int flags, mode_t mode)int creat(const char *pathname, mod
2017-01-20 13:18:11
382
原创 数据结构-栈的应用
"3*(1-2)-1" 人类习惯的中缀表达式后缀表达是这是计算机所习惯的计算方式规则:从左到右遍历中缀表达式的每个数字和符号,若是数字就输出,即成为后缀表达式的一部分;若是符号,则判断其与栈顶符号的优先级,是右括号或优先级低于找顶符号(乘除优先加减)则栈顶元素依次出找并输出,并将当前符号进栈,一直到最终输出后缀表达式为止。以下是代码实现
2016-12-15 22:10:20
218
转载 数据结构-双向链表
DLinkList.h#ifndef __DLINKLIST_H_#define __DLINKLIST_H_typedef void DLinkList;typedef struct _tag_DLinkListNode{ struct _tag_DLinkListNode* next; struct _tag_DLinkListNode* pre;}DLinkListN
2016-12-15 11:13:48
328
原创 sql server for 使用网络路径创建数据库
sp_configure 'show advanced options',1reconfiguregosp_configure 'xp_cmdshell',1reconfigurego------net Driver ----------net use [挂载盘符] [目标网络位置] [pwd] /user:[username]exec xp_cmdshell 'net use Z:
2016-12-14 13:53:45
921
原创 数据结构-循环链表
CircleList.h#ifndef __CIRCLELIST_H_#define __CIRCLELIST_H_typedef void CircleList;typedef struct _tag_CircleListNode{ struct _tag_CircleListNode *next;}CircleListNode;/*循环链表的创建*/CircleList*
2016-12-14 10:29:17
215
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人