自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 Redis Sentinel Failover判定 源码探寻

前言Redis sentinel设计初衷是保证Redis服务集群的稳定可用服务。其核心逻辑: 假设有Redis实例采用主从备份机制,如果master机器由于一些原因挂掉不可访问,sentinel可以自动识别出来,并且从master的slaves中选择出一个promote为master,从而保证服务可用。详细文档,参见官网。

2016-08-29 19:11:59 785

原创 wrk(压测工具)源码笔记

常用压测工具wrk(多线程并发、可定制script分析)源码分析。github项目地址: https://github.com/wg/wrk

2016-08-19 15:36:41 5393

原创 由sqlmap学到的python杂烩

由sqlmap学到的python杂烩          1. global          2. hasattr 和 dict.xxx的区别      global:      声明变量为全局变量,此关键字为跨函数的,但不跨文件。如果要跨文件,还是得用from XXX import XXX          例如:           config = Noned

2014-12-06 17:03:54 524

原创 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 772 1

原创 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 1482

原创 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 1750

原创 sqlmap源码阅读笔记---LOGGER

安装方法:git clone https://github.com/sqlmapproject/sqlmap.git

2014-11-17 11:21:37 1798

原创 opensuse在宏基笔记本无法调节屏幕亮度---解决方案

问题描述:安装好Opensuse后,发现无法调节屏幕亮度,快捷键调整是

2014-11-16 16:24:37 2520

转载 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 1456

转载 字符串哈希函数

基本概念所谓完美哈希函数,就是指没有冲突的哈希函数,即对任意的 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 373

转载 Linux平台下的service程序编写指南

Linux平台下的service程序编写指南Hu Dennis Sep 24, 2010转载注明出处http://blog.csdn.net/gobitan 摘要:本文主要介绍了如何编写一个service服务所涉及的两个主要方面。1)将一个普通程序装成daemon程序;2)编写service方式的shell脚本。并以C语言为例,基于Red hat 企业版5.3平台演示了一个servic

2014-09-09 10:14:23 705

原创 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 583

原创 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 465

原创 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 548

原创 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 450

原创 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 510

原创 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 476

原创 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 536

原创 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 426

空空如也

空空如也

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

TA关注的人

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