- 博客(45)
- 资源 (13)
- 收藏
- 关注
原创 如何在1微秒内检测数以万计的ip段
需求:10万条ip段,例如127.0.0.1-127.0.0.255,需要在以常数时间检测 127.0.0.3有没有在这1万个ip段之中实现思路:红黑线段树,类似如下图片,图片应用自网络如何把ip映射为int呢?IP: 127.1.1.1 去掉 . , 每个对应于8位的字节,就是32位的int值。所以 0.0.0.1-0.0.0.255 对应为 1-255,这下就简单了,采用线段树来存储ip段在红...
2018-03-22 16:46:36 394
原创 降纬编码技巧
如文中有不对的地方,请多多指教。 降维攻击,顾名思义,首先要降维。如三维空间的物体在二维空间中,物体自身微观粒子相互之间的作用力公式将发生变化,物体分子将不能保持现有的稳定状态,极可能发生解体,导致物体本身毁灭。降维打击就是将攻击目标本身所处的空间维度降低,致使目标无法在低维度的空间中生存从而毁灭目标。摘自https://baike.baidu.com/item/%E9%99%8D
2017-12-28 16:15:25 408
原创 微生态架构设计
To be, or not to be, that is the question !1. 关于架构耦合度高内聚低耦合,是软件工程中的概念,是判断设计好坏的标准,主要是面向对象的设计,主要是看类的内聚性是否高,耦合度是否低。内聚性又称块内联系。指模块的功能强度的度量,即一个模块内部各个元素彼此结合的紧密程度的度量。若一个模块内各元素(语名之间、程序段之间)联系的越紧密,则它的内
2017-09-01 11:03:16 478
原创 go语言笔记 - 服务端 socket开发相关
文中如有不足之处,请指出推荐开发go语言的ide:atom下载地址: https://atom.io/1. 比较坑的地方本帖最后由 浅蓝 于 2017-1-19 10:02 编辑作者:浅蓝文中如有不足之处,请指出推荐开发go语言的ide:atom下载地址: https://atom.io/1. 比较坑的地方 引
2017-03-02 11:57:09 538
原创 go 语言 gc 问题
解决方案:短链接: 百度 车轮大战 http://www.infoq.com/cn/presentations/the-application-of-golang-in-baidu-frontend/长连接:暂无 (已经使用过 go 1.8)
2016-12-06 11:45:04 647
原创 服务器唯一标识 id 的生成方法
服务器唯一标识 id 的生成方法[机房] + ip地址(32为int)+ timestamp(毫秒) + seq(16 或者 32位)机房表示可选,如果业务扩大,需要机房区分。如果业务量太大,在1ms之内需要产生大于4g的id,只需要扩展seq
2016-12-06 11:40:56 7015
原创 nginx configure location 流程以及重要函数分析
ngx_tcp_core_location(ngx_conf_t*cf, ngx_command_t *cmd, void *dummy)clcf= ctx->loc_conf[ngx_tcp_core_module.ctx_index];clcf->loc_conf= ctx->loc_conf;同样的逻辑,看着很迷惑。使用clcf,给loc_conf赋值ngx_tcp_
2014-04-18 17:40:38 873
原创 nginx http模块中配置的实现和解析---1
配置的主要函数流程:下面是http配置解析的函数流程:ngx_http_block #ngx_string("http"),初始化总的config,然后传递------ngx_http_init_phases------ngx_http_init_phase_handlers ------ngx_http_core_find_co
2014-04-11 17:57:06 1139
原创 git note
git 概念working ------git-add -------> staging ----git commit----- > local repo ----git push-------> remote repogit commit -a -m "read me" # 提交到所有已经修改的文件到本地repo撤销working di
2014-04-10 20:42:56 898
原创 python note
1. python中有指针的概念吗?没有2.如何实现链表?自己定义类3.python中的list实现原理是什么?http://www.brpreiss.com/books/opus7/html/page82.html4.python类中cls和self的区别?http://stackoverflow.com/questions/7554738/python-
2014-03-03 21:16:13 996
转载 校园招聘题目分享-c/c++
1. 编写类String的构造函数,析构函数,赋值函数。已知类String的原型为:class String{public:String(const char *str = NULL); //普通构造函数String(const String &other); //拷贝构造函数~String(void); //析构函数String &oper
2014-03-03 18:35:37 970
原创 binary tree to list
/* * tree.cpp * * Created on: 2014-2-4 * Author: aeris */#include #include #include #include using namespace std;struct node{ int name; node * left_child; node * right_child;};
2014-02-04 21:13:06 840
转载 nginx proxy limit module development --3
Adding nginx variable:http://blog.sina.com.cn/s/blog_7303a1dc0100ycd1.html is very useful.Two ways about variable.1. nginx own variable.内建变量免费的午餐,不用任何手工劳动就能使用的变量——nginx帮你
2014-01-17 16:07:03 1038
原创 nginx proxy limit module development --2
Core algorithm of limit rate:code:if (u->limit_rate) {excess = u->received - u->limit_rate_after- u->limit_rate * (ngx_time() - r->start_sec + 1);if (excess > 0) {if (ngx_h
2014-01-17 16:05:15 1244
原创 nginx proxy limit module development --1
The company need the post and put request to be limited. The task is add the module to nginx.1. The research of nginx about the principle of read the client request body.Function
2014-01-17 16:04:09 1000
转载 小数变为二进制方法(转)
0.2 * 2 = 0.4 ...................00.4 * 2 = 0.8 ...................00.8 * 2 = 1.6 ...................10.6 * 2 = 1.2 ...................10.2 * 2 = 0.4 ...................00.4 * 2 = 0.8 ......
2013-08-30 10:57:26 1586
原创 gevent pywsgi overflow
def _do_read(self, length=None, use_readline=False): if use_readline: reader = self.rfile.readline else: reader = self.rfile.read content_length = self.
2013-07-24 10:28:13 2209
原创 zip stream download
import zipfile_ownimport osimport timeimport zipfile_comimport zipfiledef gen_file(file_path): fs = open(file_path, 'r') while 1: trunk = fs.read(1024*8) left = len(trunk
2013-07-15 16:24:22 1082
原创 ksyun s3 签名计算 php 代码
通过这个函数计算出来的url,可以直接下载对应的key,也就是你的文件<?php $signableQueryString = array( 'acl', 'delete', 'lifecycle', 'location', 'logging', 'notification', 'partNumber', 'policy', 'requestPaymen
2013-07-04 15:43:10 1561
原创 金山云 php版 s3
这是金山云的网页端上传文件的开发代码需要使用金山云的ACCESSKEY 和 SCECERT我使用5g的文件,上传成功了,haha大家可以作为一个php 网页端# $access_id is your AccessId# $access_key is your AccessSecretKey# $key is upload filename# $bucket_name
2013-07-02 15:39:19 2267
原创 服务器端开发调试心得
遇到一个棘手的问题:需要计算签名sign = base64.encodestring(hmac.new(secret_access_key, po, sha1).digest()).strip()使用这种方式计算,没有使用显示换行符号的打印方式,造成了换行符号的差异一个使用“\r\n",一个使用”\n"签名总是不正确使用字符串替换解决
2013-07-01 14:31:44 1012
转载 BUG python2.7 httplib message_body
ERROR:File "/usr/lib/python2.7/httplib.py", line 809, in _send_output msg += message_bodyUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14060: ordinal not in range(128)S
2013-06-09 10:08:59 2610
原创 redis sorted set source code analysis
sorted set in t_zset.c file。Insert operation:zaddCommand -----> zaddGenericCommand{ zzlFind{ zzlDelete{ zzlInsert-------- { ziplist : http://blog.nosqlfan.com/html/3919.html------
2013-06-06 14:52:26 1360
原创 解析python中的wsgiserver
just for funserver = wsgiserver.CherryPyWSGIServer(('0.0.0.0',8000),app)server.start()是程序入口,其中app是你的应用程序def app(environ,start_response): out = 'tmp/'+str(uuid.uuid1())+'.zip' statu
2013-04-22 20:22:29 7649
原创 文件zip打包,流式下载python 代码
使用方法:输入地址:例如http://0.0.0.0:8000?abc,def#!usr/bin/python#coding=utf-8import uuidimport osimport zipfileimport reimport sysimport officetoimageimport rarfileimport tarfileimport
2013-04-22 20:14:09 2172
原创 压缩文件缩略图 python 实现
可以支持zip,rar,7zip,tar.gz等等各式输入压缩文件名称,返回一个xml文件结构#!usr/bin/python#coding=utf-8import uuidimport osimport zipfileimport reimport sysimport officetoimageimport rarfileimport tarfile
2013-04-22 20:10:55 1288
原创 algorithm to generate unique code of 64 bit
this is funning algorithm .if you have enough space,you can use the wayjust like 2^64 guy stand as a circlethis alway have a right order .from one guy to last guy ,this guy represent 0/1.thi
2013-03-07 16:45:13 1162
转载 ubuntu 下装pyqt4
ubuntu 下装pyqt4 2012-03-31 10:13:12| 分类:COMPUTER |字号 订阅sudo apt-get install python-qt4-devsudo apt-get install pyqt4-dev-toolssudo apt-get install qt4-dev-tools sudo apt
2013-02-28 14:11:03 1075
原创 python 学习笔记-python import: command not found
在eclipse下开发python不需要如下语句#!/usr/bin/python 但是,在终端执行会出现python import: command not found
2013-02-28 09:53:17 21669 1
原创 我的一些构想
处在云计算部门,突发奇想快盘什么的很方便,但是远远不能满足要求我觉得如果可以拷贝个人环境就好了,就是个人 的工作或者生活环境让用户到哪儿都可以用不然创建一个项目,光是搭环境都需要很长的时间!
2013-02-26 16:32:52 598
原创 win7硬盘安装ubuntu
第一种方案:下载ubuntu10.10,解压之后,有个wubi,直接运行既可以安装。缺点:不能进行分区不推荐使用第二种:工具:easybcd引用:http://www.cnblogs.com/allenjin/archive/2011/11/26/2264089.html进行分区后,安装成功网卡:intel 82xxx,引用:http://downloa
2013-02-25 10:52:28 607
原创 dell 计算机笔试题 英文写作
In a few month' time you are going to graduate from university . How do you think your college years have prepared you for your future life?Write an essay of 200 words on the following topic:What I
2013-01-20 20:02:02 801
原创 QQ贺卡转图片过程
累死姐了首先,下个FlashCatcher,和Magic SWf2Gif然后,QQ中选张贺卡自己发给自己,然后点开信,点击查看然后,出现保存图标,保存,打开Magic SWf2Gif转换
2012-12-28 16:11:05 701
原创 IT求职经历
因为闲着无聊,参加了一下中国竞争最激烈的求职过程。并且从中学到了很多东西,特地写出来,以备日后无聊时查看。 自己也是小白一个,基础知识不懂,算法不懂,数据结构不懂。平时无聊上网,从来不好好学习。还好,我喜欢凑热闹,先是参加了实习生招聘,发现我基础很差,算法很差,于是看了下算法导论,还是收获颇多的。 在男友的帮助下,了解了一些linux内核方面的知识,并且,了解一
2012-11-13 15:18:09 1108
转载 龙芯笔试题
task_struct 是如何分配的,如何找到???http://www.cnblogs.com/hanyan225/archive/2011/07/09/2101962.html
2012-11-11 22:15:41 1399
原创 有100扇门,都是关着的
有100扇门,都是关着的,现从1喊道100,每喊一个数,这个数的倍数的那些门状态都改变一次,例如,喊1时,所有的门都打开,喊2时,所有2的倍数的门都关闭,依次类推,问喊完100之后,还有几扇门是开着的。解题思路:只有这个数含有奇数个因子是,门才是开的,例如4的因子为 4,2,1;所以,问题变为如何找到奇数个因子.分析,除了a *a之外,不可能还有奇数个因子.所有,从1-10,即
2012-11-03 22:22:59 1702
原创 unix环境高编中exec函数实例
#include using namespace std;int main(int argc,char *argv[]){coutreturn 0;}g++ -o ss ss.cppextern "C"{#include }#include using namespace std;int main(){pi
2012-06-15 11:32:34 1926
转载 基于OMAP-L138电路板的U-boot移植
最近参加了一个项目,主板采用的是TI的OMAP-L138,为了引导linux内核,准备采用u-boot作为bootloader。在搜集资料的过程中发现关于移植u-boot到基于OMAP-L138电路板的资料非常少,而且TI的OMAP-L138采用三级boot,比其他单arm9核的SOC要复杂的多,因此纠结了很长时间。好不容易参照hawkboard的配置把u-boot-2011.03移植到我们的板子
2012-05-29 15:16:00 1466
install_linux3.0.4_ubuntu
2011-10-28
window下linux环境模拟(MinGW,Cygwin).doc
2011-03-25
Bochs教程 Bochs是一个开源的虚拟机
2010-11-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人