- 博客(19)
- 收藏
- 关注
原创 Redis Sentinel Failover判定 源码探寻
前言Redis sentinel设计初衷是保证Redis服务集群的稳定可用服务。其核心逻辑: 假设有Redis实例采用主从备份机制,如果master机器由于一些原因挂掉不可访问,sentinel可以自动识别出来,并且从master的slaves中选择出一个promote为master,从而保证服务可用。详细文档,参见官网。
2016-08-29 19:11:59
871
原创 wrk(压测工具)源码笔记
常用压测工具wrk(多线程并发、可定制script分析)源码分析。github项目地址: https://github.com/wg/wrk
2016-08-19 15:36:41
5616
原创 由sqlmap学到的python杂烩
由sqlmap学到的python杂烩 1. global 2. hasattr 和 dict.xxx的区别 global: 声明变量为全局变量,此关键字为跨函数的,但不跨文件。如果要跨文件,还是得用from XXX import XXX 例如: config = Noned
2014-12-06 17:03:54
590
原创 sqlmap源码阅读之optparse
sqlmap.py中命令行参数适配今天抽空来看看命令行参数的适配,以下是sqlmap.py中的代码 # Store original command line options for possible later restoration cmdLineOptions.update(cmdLineParser().__dict__) init
2014-12-04 20:36:19
832
原创 sqlmap源码阅读之基础(dict,sys)
1.sys模块之stdout,stderr 查阅以下python文档可知:任何object及其派生类只要重写了write()方法,均可以替换sys.stdout,sys.stderr.所以sys.stdinsys.stdoutsys.stderr File objects corresponding to the interpreter’s standard input,
2014-12-02 16:51:07
1551
原创 SQLMAP源码阅读之盖览sqlmap.py
整体上代码结构是这样的:1.检查python运行版本:version 介于 2.6~3之间from lib.utils import versioncheck2.设置根目录路径及程序运行中所需要的一些存放运行信息的目录(包括输出目录等的配置)paths.SQLMAP_ROOT_PATH = modulePath()setPaths()
2014-11-22 13:37:35
1815
原创 sqlmap源码阅读笔记---LOGGER
安装方法:git clone https://github.com/sqlmapproject/sqlmap.git
2014-11-17 11:21:37
1873
转载 Linux Signal实现代码分析
本文介绍了Linux信号处理的基本流程。关于信号处理的具体细节可以看ULK第三版第11章。1. 基本数据结构1.1 task_struct中信号相关的域struct signal_struct * signal; // Pointer to the process's signal descriptorstruct sighand_str
2014-09-10 10:30:45
1545
转载 字符串哈希函数
基本概念所谓完美哈希函数,就是指没有冲突的哈希函数,即对任意的 key1 != key2 有h(key1) != h(key2)。设定义域为X,值域为Y, n=|X|,m=|Y|,那么肯定有m>=n,如果对于不同的key1,key2属于X,有h(key1)!=h(key2),那么称h为完美哈希函数,当m=n时,h称为最小完美哈希函数(这个时候就是一一映射了)。在处理大规模字符串数据时,
2014-09-09 20:48:23
418
转载 Linux平台下的service程序编写指南
Linux平台下的service程序编写指南Hu Dennis Sep 24, 2010转载注明出处http://blog.youkuaiyun.com/gobitan 摘要:本文主要介绍了如何编写一个service服务所涉及的两个主要方面。1)将一个普通程序装成daemon程序;2)编写service方式的shell脚本。并以C语言为例,基于Red hat 企业版5.3平台演示了一个servic
2014-09-09 10:14:23
771
原创 Reverse Words in a String
Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the
2014-09-05 21:59:08
635
原创 Merge Sorted Array
Merge Sorted Array内容:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of
2014-02-13 09:41:00
570
原创 Max Subarray
Max SubArray内容:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarra
2014-02-13 09:26:28
610
原创 Unique Binary Search Trees
Problem:Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example:Given n = 3, there are a total of 5 unique BST's.初看这道题目,感
2014-01-03 23:10:37
515
原创 Reverse Integer
Problem:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321class Solution {public: int reverse(int x) { vector tem; while(x!=0){
2014-01-03 21:01:56
557
原创 Same Tree
Problem:Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the sa
2014-01-03 13:36:11
588
原创 Maximum Depth of Binary Tree
Problem:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node./** * Definition for binary t
2014-01-02 23:14:35
659
原创 Single Number I
Problem:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have alinear runtime complexity. Could you implement it withou
2014-01-02 16:39:38
472
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人