在CPAN上发布Perl模块

perl

假如你跟别人说你写了很多Perl代码,别人会相信吗?要是问你,在CPAN上有模块吗?你如何回答?

Minor update 2014-08-19: 用Dist::Zillaa吧!

Dist::Zilla is a program to make it easier to write, package, manage, and release free software.

为了减少依赖,我之前写的Perl代码大多是独立脚本形式,即使有模块也是随脚本分享,一些可重用的代码,也只是通过复制粘贴。

Perl模块最好的分享途径还是发布到CPAN上,今天变决定把以前课题里面的一个有用的函数发布出来。

Read more →

少壮不备份,老大徒伤悲 — 请认真备份数据

it office sci devop data

今天又听到一个rm -rf / 式的悲剧,幸亏没root权限,只把自己家的东西删的一干二净。可是,他没有备份!本文谈谈我对数据备份的一些想法。

即使是很有经验的linux使用者也不能完全避免一时疏忽。应对rm -rf可能带来的悲剧有多种途径,包括一些linux发行版默认设置别名alias rm='rm -i' ,以及通过别名设置rm为其它更安全的删除软件,比如我在Linux配置备忘录里面提到的trash-cli(其它中文介绍!)。平时删除文件到“回收站”即可,再定期清空回收站。

无论防范措施做得再好,也比不上良好的备份习惯。

Read more →

Install Perl from source

perl linux

I never realized that installing Perl from source could be such a tough thing.

1). The first obstacle is the error from the uncompression of source package.  I also tried to compress the package on my PC and transfered them to server by sftp. However, over 200 files failed to be transfered. The same error occured with binary distributions.

The simplest solution is to uncompress the source package on PC and make a copy, then compress this copy and transfer it to server by sftp.

Read more →

无root权限解决lib××× not found,以及Linux上设置良好的目录结构

linux

本文帮助你解决在无root权限的linux系统上安装软件时候遇到的lib××× not found的问题,并推荐一个Linux上良好的目录结构。

1. 安装软件到自己的软件目录。

缺乏的lib×××库大多都能在网上下载到源码,可自己下载安装。

Read more →

Protecting Against WordPress Brute-Force Attacks

network

Several waves of Brute-Force Attacks to my WordPress blog lasted for more than two hours!!! Like automaticlly adding the attacking IPs to /etc/hosts.deny black list to avoid attacks by sshd, a WordPress plugin “Limit Login Attempts” uses the same strategy to defend attacks. Hiding the wp-login.php page is also a good choice.

Read more →

可复现的计算科学研究十条简单规则,以及自己的一些经验

sci devop

《Ten Simple Rules for Reproducible Computational Research》对做计算科学方面研究的同仁有非常好的借鉴意义,本文结合我自己的经验对其阐述。

Read more →

根据URL批量下载图片(能够打破防盗链设置)

network

本文提供根据URL批量下载图片的Perl脚本,能够打破防盗链设置。

至于如何获得图片的URL,一般的浏览器都支持右键点击图片“复制图片链接”,有的网站的图片URL有规律,这就最理想了,用excel扩展出n个URL即可!

虽然Firefox可以在图片上点击右键“查看图片信息”显示该页面所有图片的地址,并能够批量”另存为”,但如果遇到某些图片链接,比如QQ空间上的图片的链接,它不是以图片后缀名结尾的,此方法会把所有图片保存为同一个文件名的文件,即覆盖先前文件,最终只得到一个文件。此脚本通过计数将图片保存为不重复的文件。

第一次运行batch_download_images.pl,它会自动生成一个默认的URL文件,如下所示:

# 设置referer是为了反“防盗链”,只需设置该网站任一页面的地址即可
referer = http://www.wzsky.net/html/Website/Color/117958_11.html

# urls
http://www.wzsky.net/img2013/uploadimg/20130906/12162977.jpg
http://www.wzsky.net/img2013/uploadimg/20130906/12162978.jpg
http://www.wzsky.net/img2013/uploadimg/20130906/12162979.jpg

代码如下:

Read more →

Process queue for high CPU/RAM/time usage processes

devop

源代码托管在https://github.com/shenwei356/process_queue。 [ Update ] Please use crun, a command line tool to run workflow.

Read more →

Batch compute pI (isoelectric point) and Mw (molecular weight) via Compute pI/Mw tool at ExPASy

bioinf

本文提供批量计算蛋白质等电点的Perl脚本,根据包含氨基酸的fasta序列,批量提交表单到ExPASy的等电点计算工具(不支持对多条氨基酸序列进行批量计算),并解析结果。 这个脚本包含两个方法:逐条读取Fasta序列;通过LWP模块提交表单。 Latest source code is available on Github。

Read more →