11 2013 档案

摘要:MySQL长短密码今天批量搭建MySQL环境的时候,遇到长短密码问题,故就此问题总结一下长短密码。介绍1、长密码例子:mysql> show grants for 'test'@'localhost';+--------------------------------------------------------------------------------------------------------------+| Grants for test@localhost ... 阅读全文
posted @ 2013-11-27 20:56 小郭学路 阅读(594) 评论(0) 推荐(0) 编辑
摘要:githelptag#tag的用法gittaggittag-dxxx#删除taggittagv1.1#新增taggitdescribe--tag# 阅读全文
posted @ 2013-11-27 20:11 小郭学路 阅读(310) 评论(0) 推荐(0) 编辑
摘要:转载自:http://blog.chinaunix.net/u2/83905/showart_2134570.html在Unix系统下,应用程序崩溃,一般会产生core文件,如何根据core文件查找问题的所在,并做相应的分析和调试,是非常重要的。什么是Core Dump?Core的意思是内存, Dump的意思是扔出来, 堆出来.开发和使用Unix程序时, 有时程序莫名其妙的down了, 却没有任何的提示(有时候会提示core dumped). 这时候可以查看一下有没有形如core.进程号的文件生成, 这个文件便是操作系统把程序down掉时的内存内容扔出来生成的, 它可以做为调试程序的参考.co 阅读全文
posted @ 2013-11-27 11:50 小郭学路 阅读(19441) 评论(0) 推荐(0) 编辑
摘要:1、元素添加#include #include struct ListNode{ struct ListNode* next; int data;};typedef struct ListNode node;void AddFront(node** head,node* newnode){ newnode->next = *head; *head = newnode;}void PrintList(node* head) ... 阅读全文
posted @ 2013-11-26 21:22 小郭学路 阅读(182) 评论(0) 推荐(0) 编辑
摘要:看到别人的README文档中,经常看到如下的图:是通过tree命令treetree命令有很多参数,具体可以查看man[root@typhoeus79 code]# tree -L 1 Python-2.7.6Python-2.7.6|-- Demo|-- Doc|-- Grammar|-- Include|-- LICENSE|-- Lib|-- Mac|-- Makefile.pre.in|-- Misc|-- Modules|-- Objects|-- PC|-- PCbuild|-- Parser|-- Python|-- README|-- RISCOS|-- Tools|-- con 阅读全文
posted @ 2013-11-26 17:40 小郭学路 阅读(259) 评论(0) 推荐(0) 编辑
摘要:Innodb加强项1、Innodb全文索引mysql> show create table film_text\G*************************** 1. row *************************** Table: film_textCreate Table: CREATE TABLE `film_text` ( `film_id` smallint(6) NOT NULL, `title` varchar(255) NOT NULL, `description` text, FULLTEXT KEY `idx_title_descri... 阅读全文
posted @ 2013-11-23 19:25 小郭学路 阅读(207) 评论(0) 推荐(0) 编辑
摘要:1、多行宏定义#include #define _PyObject_HEAD_EXTRA \ struct _object *_ob_next; \ struct _object *_ob_prev;typedef struct _object{ _PyObject_HEAD_EXTRA}PyObject;int main(){ printf("%d\n",sizeof(PyObject)); ret... 阅读全文
posted @ 2013-11-23 14:32 小郭学路 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-11-22 17:03 小郭学路 阅读(129) 评论(0) 推荐(0) 编辑
摘要:IO利用率统计SASSSDMegaRaid 阅读全文
posted @ 2013-11-20 10:46 小郭学路 阅读(128) 评论(0) 推荐(0) 编辑
摘要:1、协作型过滤(collaborative filtering)一个协作型过滤算法通常的做法是对一大群人进行搜索,并从中找出与我们品味相近的一小群人。算法会对这些人所偏爱的其他内容进行考查,并将它们组合起来构造出一个经过排序的推荐列表。2、搜索偏好第一件事情,寻找一种表达不同人及其偏好的方法,使用嵌套字典。# A dictionary of movie critics and their ratings of a small# set of movies#一个涉及影评者以及对几部影片评分情况的字典critics={'Lisa Rose': {'Lady in the W 阅读全文
posted @ 2013-11-18 21:11 小郭学路 阅读(404) 评论(0) 推荐(0) 编辑
摘要:前言1、中文对照2、开放的WEB API接口del.icio.us 一个社会型书签应用系统,其开放的API允许你根据tag或者特定的用户来下载链接Kayak 一个提供API的旅游网站,可以利用API在自己的程序中集成针对航班和旅馆的搜索eBay 一个提供API的在线交易站点,允许查询当前正在出售的货品Hot or Not 一个评分与交友的网站,提供API对人员进行搜索,并获取其评分及个人资料Akismet 一个用于对协作型垃圾信息进行过滤的API(先记录一下,后续在例子中进行确认,更多APIhttp://www.programmableweb.com/)通过对来自单一源的数据进行处理... 阅读全文
posted @ 2013-11-18 18:20 小郭学路 阅读(381) 评论(0) 推荐(0) 编辑
摘要:例子12:ipython使用--pylab参数,默认加入matplotlib模块[root@typhoeus79 guosong]# ipython --pylabWARNING: IPython History requires SQLite, your history will not be savedPython 2.7.3 (default, Nov 27 2012, 17:47:24) Type "copyright", "credits" or "license" for more information.IPython 阅读全文
posted @ 2013-11-16 22:33 小郭学路 阅读(655) 评论(0) 推荐(0) 编辑
摘要:例子11-1:横坐标时间的处理from matplotlib.dates import datestr2num,DateFormatterimport matplotlib.dates as datesfig,ax=plt.subplots()formatter = DateFormatter('%... 阅读全文
posted @ 2013-11-15 20:39 小郭学路 阅读(5819) 评论(0) 推荐(0) 编辑
摘要:pandaspandasis an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for thePythonprogramming language一、安装1、pandasgit clone git://github.com/pydata/pandas.git2、RequirementsCpythonhttps://pypi.python.org/pypi/Cython/pytzhttps://pypi.pytho 阅读全文
posted @ 2013-11-14 21:31 小郭学路 阅读(1441) 评论(0) 推荐(0) 编辑
摘要:例子6、中文标签测试#!/usr/bin/env python2.7#-*- coding:utf-8 -*-import matplotlib.pyplot as plt import numpy as npimport matplotlib.font_manager as fmfontpath = '/usr/share/fonts/chinese/TrueType/ukai.ttf'myfont = fm.FontProperties(fname=fontpath)#定义一个myfont变量,myfont=matplotlib.font_manager.FontPrope 阅读全文
posted @ 2013-11-14 11:54 小郭学路 阅读(3903) 评论(0) 推荐(0) 编辑
摘要:1、简介Python的lists是非常的灵活以及易于使用。但是在处理科学计算相关大数量的时候,有点显得捉襟见肘了。Numpy提供一个强大的N维数组对象(ndarray),包含一些列同类型的元素,这点和python中lists不同。Python lists are extremely flexible and really handy, but when dealing with a largenumber of elements or to support scientific computing, they show their limits.One of the fundamental a 阅读全文
posted @ 2013-11-14 11:15 小郭学路 阅读(2599) 评论(0) 推荐(0) 编辑
摘要:小试牛刀在上一节已经安装好matplotlib模块,下面使用几个例子熟悉一下。对应的一些文档说明:http://matplotlib.org/1.3.1/api/pyplot_summary.html例子1:二维坐标——整数[root@typhoeus79 20131113]# ipythonIn [1]: import matplotlib.pyplot as pltIn [2]: x = range(6)In [3]: plt.plot(x,[xi*xi for xi in x])Out[3]: []In [4]: plt.savefig('test1.png')输出结果: 阅读全文
posted @ 2013-11-13 20:31 小郭学路 阅读(985) 评论(0) 推荐(0) 编辑
摘要:numpy1、下载安装源代码http://sourceforge.net/projects/numpy/files/NumPy/安装python2.7 setup.py install2、测试导入numpy模块,出现如下错误:[root@typhoeus79 numpy-1.8.0]# python2.7Python 2.7.3 (default, Nov 27 2012, 17:47:24) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2Type "help", "copyright", " 阅读全文
posted @ 2013-11-13 20:16 小郭学路 阅读(33271) 评论(0) 推荐(0) 编辑
摘要:字面值时源代码中用来描述固定值的记号,可能是整数、浮点数、字符或者字符串2.1 整数常量除了常见的十进制数外,还有八进制(以数字0开头)或者十六进制(0x/0X)表示法。#include int main(){ int x = 010; int y = 0x0A; printf("x=%d,y=%d\n",x,y); return 0;}输出:x=8,y=10常量类型可以通过后缀来区分类型0x200 -->int200U -->unsigned int0L -->long0xf0f0UL -->unsigned long0777LL --->l 阅读全文
posted @ 2013-11-12 21:01 小郭学路 阅读(359) 评论(0) 推荐(0) 编辑
摘要:简介pt-log-player是MySQL日志回放工具,在pt2.4中被去除,由percona-playback取代。在2.1中还是保留,如果想使用的话,需要下载2.1版本的。使用方法pt-log-player [OPTION...] [DSN]例子:日志切分pt-log-player --split Thread_id --type=genlog --session-files 16 --only-select --base-dir ./sessions ./mysql.log日志回放pt-log-player --play ./play/ --base-dir ./results -u . 阅读全文
posted @ 2013-11-12 11:32 小郭学路 阅读(663) 评论(0) 推荐(0) 编辑
摘要:安装http://www.cnblogs.com/zhoujinyi/archive/2013/04/19/3029134.htmlhttp://space.itpub.net/758322/viewspace-708581http://hidba.org/?p=2291、安装遇到的问题libtool重新下载安装http://www.gnu.org/software/libtool/./configure --prefix=/usr/bin/make && make install将libtool拷贝到sysbench的安装目录中2、运行autogen.sh出现RANLIBc未 阅读全文
posted @ 2013-11-11 16:02 小郭学路 阅读(195) 评论(0) 推荐(0) 编辑
摘要:简介fio是IO工具,既可以用于基准测试,也可以用于硬件的压力测试验证(stress/hardware verification)。支持13种不同的IO引擎(sync、mmap、libaio、posixaio、SG v3、splice、null、network、syslet、guasi、solarisaio或者更多),IO优先级(支持更新的Linux内核),rate IO,forked or 线程任务等。既适用于块设备,也适用于文件。fio可以解析job描述,这些描述来自于简单可理解的文本格式文件。fio可以展示多种io性能信息,包括IO延迟(IO latencies),IO百分率(IO pe 阅读全文
posted @ 2013-11-11 14:55 小郭学路 阅读(1961) 评论(0) 推荐(0) 编辑
摘要:fcntl 文件控制模块http://docs.python.org/2.7/library/fcntl.html#module-fcntlstruct 二进制文本处理模块http://docs.python.org/2.7/library/struct.html#module-structtermios [POSIX calls for tty I/O control接口]http://docs.python.org/2.7/library/termios.html#module-termios 阅读全文
posted @ 2013-11-08 16:53 小郭学路 阅读(135) 评论(0) 推荐(0) 编辑
摘要:解释TagList插件,是一款基于ctags,在vim代码窗口旁以分割窗口形式显示当前的代码结构概览,增加代码浏览的便利程度的vim插件。安装1、下载http://www.vim.org/scripts/script.php?script_id=2732、将doc以及plugin拷贝到~/.vim下面3、配置.vimrc添加如下:""""""""""""""""""""""&q 阅读全文
posted @ 2013-11-08 16:26 小郭学路 阅读(694) 评论(0) 推荐(0) 编辑
摘要:tcprstathttp://www.percona.com/docs/wiki/tcprstat:start监控网络流量情况,计算请求的响应时间(the delay between request and response)只能针对特定端口,对于统计类似mysqld、httpd、memcached等后台进程的响应时间比较实用。tcprstat优点1、轻量级,不会产生日志类文件It is lightweight and unobtrusive. No bulky log files need be written and analyzed2、request和response的时间可以精确到微秒 阅读全文
posted @ 2013-11-08 15:33 小郭学路 阅读(912) 评论(0) 推荐(0) 编辑
摘要:线上遇到同步中断,登录机器发现存在SQL注入导致131108 1:02:59 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000521' at position 431027290, relay log './relay-bin.001616' position: 431027427131108 1:02:59 [ERROR] Slave: Error 'Column 'email' cannot be null' on q 阅读全文
posted @ 2013-11-08 10:53 小郭学路 阅读(410) 评论(0) 推荐(0) 编辑
摘要:Nytro MegaRaid简介Dell R720xd,内存64G,12块SASDell R510xd,内存48G,12块SASSSD+SASSSD对于用户透明raid会将热点数据放在SSD上,冷数据放在sas上使用fio测试iops1、测试时间:三天2、读写比例:读写比各半3、数据容量最大4、filename设置为/data1/文件(900G)由于Nytro MegaRaid读3次就认为其是热点数据,使用dd产生一堆10G的文件使用dd产生1000M文件,文件名为testdd if=/dev/zero of=test bs=1M count=1000QPS的测试日志replay的方式模拟线上 阅读全文
posted @ 2013-11-07 18:05 小郭学路 阅读(336) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2013-11-07 18:03 小郭学路 阅读(0) 评论(0) 推荐(0) 编辑
摘要:安装最新版:http://dag.wieers.com/home-made/dstat/dstat-0.7.2.tar.bz2http://dag.wieers.com/home-made/dstat/#downloadhttp://pan.baidu.com/s/1gQQrY# rpm -qa | grep dstat (是否有旧版本)dstat-0.6.7-1.el5.rf# rpm -e dstat (有旧版本则先卸载)# cd /tmp# rz (上传安装包)# tar jxvf dstat-0.7.2.tar.bz2 && cd dstat-0.7.2# make i 阅读全文
posted @ 2013-11-07 17:01 小郭学路 阅读(731) 评论(0) 推荐(0) 编辑
摘要:hashlib在做一个授权管理系统,需要生产动态生成密码,故使用hashlib>>> import time>>> import hashlib>>> now = time.time()>>> md5_str = str(now)>>> >>> md5_str'1383811244.44'>>> token_temp = hashlib.md5(md5_str).hexdigest()>>> token_temp'13d2c75 阅读全文
posted @ 2013-11-07 16:00 小郭学路 阅读(203) 评论(0) 推荐(0) 编辑
摘要:所有例子都在64为操作系统Linux 2.6.30 x86_64 x86_64 x86_64 GNU/Linux1.1整数在stdint.h中定义一些看上去更明确的整数类型#ifndef __int8_t_defined# define __int8_t_definedtypedef signed char int8_t;typedef short int int16_t;typedef int int32_t;# if __WORDSIZE == 64 ... 阅读全文
posted @ 2013-11-05 21:20 小郭学路 阅读(452) 评论(0) 推荐(0) 编辑
摘要:argparse命令行参数解析模块,原optparse已经停止开发,建议替换为argparse在python2.7后默认加入parserArgumentParser默认解析来源sys.argv,也可以提供显示参数进行解析。构造参数中,通常只需关心description和epilog。前者显示程序标题,后者在帮助信息的尾部显示详细的版权、使用描述等。程序代码:[root@typhoeus79 20131105]# more test_argparse.py #!/usr/bin/env python26#-*- coding:utf-8 -*-from argparse import Argum 阅读全文
posted @ 2013-11-05 19:58 小郭学路 阅读(398) 评论(0) 推荐(0) 编辑
摘要:Process创建子进程执行指定的函数>>> from multiprocessing import Process,current_process>>> >>> def test(*args,**kwargs):... p = current_process()... print p.name,p.pid... print args... print kwargs... >>> >>> p = Process(target=test,args=(1,2),kwargs={"a":&q 阅读全文
posted @ 2013-11-04 16:41 小郭学路 阅读(1437) 评论(0) 推荐(0) 编辑