代码改变世界

[ZZ] 使用rsync来实现快速删除大量文件

2014-05-29 11:32 by 三犬风, 271 阅读, 0 推荐, 收藏, 编辑
摘要:昨天遇到了要在Linux下删除海量文件的情况,需要删除数十万个文件。这个是之前的程序写的日志,增长很快,而且没什么用。这个时候,我们常用的删除命令rm -fr * 就不好用了,因为要等待的时间太长。所以必须要采取一些非常手段。我们可以使用rsync来实现快速删除大量文件。1、先安装rsync:yum... 阅读全文

如何设置mail alias

2014-05-06 10:57 by 三犬风, 933 阅读, 0 推荐, 收藏, 编辑
摘要:Use Case: admin needs to be notified when appuser task is failed, the notification email is sent to appuser by default(check with the command 'mail'),... 阅读全文

vim复制粘贴

2014-04-23 14:58 by 三犬风, 485 阅读, 0 推荐, 收藏, 编辑
摘要:问题1: vim 进入文本后,通过拖动鼠标不能复制粘贴文本行(自动进入VISUAL模式)解决1:找到.vimrc(e.g. /var/home/user/.vimrc), 添加set mouse=a #打开鼠标模式set mouse=v #使用鼠标复制内容到剪切板问题2:复制粘贴后,缩进混乱解决2:... 阅读全文

字符串逆序[Python]

2014-04-21 10:50 by 三犬风, 412 阅读, 0 推荐, 收藏, 编辑
摘要:str = 'yob a ma i' # 10def recursion(mystr): global rstr index = 0 strlen = len(mystr) if 1 != strlen: recursion(mystr[index+1:... 阅读全文

[zz]字符串转换成整数

2014-04-10 17:46 by 三犬风, 267 阅读, 0 推荐, 收藏, 编辑
摘要:输入一个表示整数的字符串,把该字符串转换成整数并输出。例如输入字符串"345",则输出整数345。分析:这道题尽管不是很难,学过C/C++语言一般都能实现基本功能,但不同程序员就这道题写出的代码有很大区别,可以说这道题能够很好地反应出程序员的思维和编程习惯,因此已经被包括微软在内的多家公司用作面试题。建议读者在往下看之前自己先编写代码,再比较自己写的代码和下面的参考代码有哪些不同。首先我们分析如何完成基本功能,即如何把表示整数的字符串正确地转换成整数。还是以"345"作为例子。当我们扫描到字符串的第一个字符'3'时,我们不知道后面还有多少 阅读全文

[zz]链表倒序

2014-04-10 17:44 by 三犬风, 288 阅读, 0 推荐, 收藏, 编辑
摘要:四种方式实现倒序输出链表 方法一:借用栈倒序输出链表 方法二:先翻转链表,再顺序输出 方法三:递归实现,好方法 方法四:用数组实现 方法一:借用栈倒序输出链表 因为栈是先进后出,把链表中的元素存进栈中,链表前面的元素在栈底,后面的元素在栈顶,链表后面的元素先出栈 方法二:先翻转链表,再... 阅读全文

[ZZ]Hadoop on OpenStack: Elastic Data Processing (EDP) with Savanna 0.3

2013-12-12 15:03 by 三犬风, 377 阅读, 0 推荐, 收藏, 编辑
摘要:Hadoop on OpenStack: Elastic Data Processing (EDP) with Savanna 0.3byAlexander KuznetsovAugust 26, 2013Now that version 0.2 of ProjectSavannais out, it’s time to start looking at what will be coming up in version 0.3. The goal for this next development phase is to provide elastic data processing (ED 阅读全文

[ZZ][Perl] Export and Export_OK

2013-10-15 16:46 by 三犬风, 527 阅读, 0 推荐, 收藏, 编辑
摘要:Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.@EXPORT and @EXPORT_OK are the two main variables used during export operation.@EXPORT contains li 阅读全文

How to add repositories for yum install

2013-10-09 10:37 by 三犬风, 202 阅读, 0 推荐, 收藏, 编辑
摘要:--enablerepo enables repositories that are disabled for some reason (look for disabled=yes in the repo files in /etc/yum.repos.d).[your repository tag]name =repositor namebaseurl = http://www.xxxenabled = 1 # by default to pull from this repositorygpgcheck = 0 阅读全文

[Perl Module] How can I look up the version of CPAN module?

2013-10-09 10:06 by 三犬风, 217 阅读, 0 推荐, 收藏, 编辑
摘要:1. perl -le 'eval "require $ARGV[0]" and print $ARGV[0]->VERSION' Proc::PID::File2.perl -MProc::PID::File -le 'print $Proc::PID::File::VERSION'(If you are lucky, the module will have a package variable $VERSION)3.perl -MProc::PID::File\ 9999Proc::PID::File version 9999 r 阅读全文