
Scripts
文章平均质量分 75
随遇而安随缘一世
这个作者很懒,什么都没留下…
展开
-
python对XML的解析
python有三种方法解析XML,SAX,DOM,以及ElementTree###1.SAX (simple API for XML ) pyhton 标准库包含SAX解析器,SAX是一种典型的极为快速的工具,在解析XML时,不会占用大量内存。但是这是基于回调机制的,因此在某些数据中,它会调用某些方法进行传递。这意味着必须为数据指定句柄,以维持自己的状态,这是非常困难的转载 2012-07-24 13:02:18 · 539 阅读 · 0 评论 -
For loops in R: how to do a “continue”
In R, you can use “for” loops just like in most other programming languages. Sometimes when you are looping through items and you encounter a certain condition, you want to skip over an item and mov转载 2014-08-19 09:29:06 · 1608 阅读 · 0 评论 -
grep
clong#07:02 PM@~/softwares/opengm/include/opengm$grep "arg_impl" ./* -R./inference/external/libdai/inference.hxx: virtual InferenceTermination arg_impl(std::vector& v, const size_t= 1)cons原创 2014-08-23 06:57:43 · 547 阅读 · 0 评论 -
linux grep命令
1.作用Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来。grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。2.格式grep [options]3.主要参数[options]主要参数:-c:只输出匹配行的计数。-I:不区分大 小写(转载 2014-08-23 07:55:04 · 635 阅读 · 0 评论 -
vim编辑器---批量注释与反注释
在使用vim编写代码的时候,经常需要用到批量注释与反注释一段代码。下面简要介绍其操作。方法一 块选择模式插入注释:用v进入virtual模式用上下键选中需要注释的行数按Control+v(win下面ctrl+q)进入列模式按大些“I”进入插入模式,输入注释符“#”或者是"//",然后立刻按下ESC(转载 2014-08-14 02:02:07 · 592 阅读 · 0 评论 -
Passing command line arguments to R CMD BATCH
My impression is that R CMD BATCH is a bit of a relic. In any case, the more recent Rscriptexecutable (available on all platforms), together with commandArgs() makes processing command line argu转载 2014-08-15 04:54:43 · 848 阅读 · 0 评论 -
Quick-R
Built-in FunctionsAlmost everything in R is done through functions. Here I'm only refering to numeric and character functions that are commonly used in creating or recoding variables.Numeric F转载 2014-08-15 20:18:32 · 987 阅读 · 0 评论 -
Factors in R
Conceptually, factors are variables in R which take on a limited number of different values; such variables are often refered to as categorical variables. One of the most important uses of factors i转载 2014-08-16 03:41:46 · 1008 阅读 · 0 评论 -
Bash scripting Tutorial
This bash script tutorial assumes no previous knowledge of bash scripting.As you will soon discover in this quick comprehensive bash scripting guide, learning the bash shell scripting is very easy tas转载 2014-08-15 20:03:23 · 988 阅读 · 0 评论 -
chmod----改变一个或多个文件的存取模式(mode)
chmod [options] mode files只能文件属主或特权用户才能使用该功能来改变文件存取模式。mode可以是数字形式或以who opcode permission形式表示。who是可选的,默认是a(所有用户)。只能选择一个opcode(操作码)。可指定多个mode,以逗号分开。options:-c,--changes转载 2014-08-15 22:25:59 · 584 阅读 · 0 评论 -
Why doesn't .bashrc run automatically?
put some alias commands in my .bashrc file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen.I have to select run script: in the Terminal>Preference原创 2014-08-19 12:01:24 · 706 阅读 · 0 评论 -
User Command Area
The User Command Area (UCA) consists of the bottom two lines of the terminal screen where most interaction with the tasks takes place. The user can type task-related commands in the UCA and Hermes c转载 2014-10-27 23:14:39 · 817 阅读 · 0 评论 -
I/O Redirection
There are always three default files [1] open, stdin (the keyboard), stdout (the screen), and stderr (error messages output to the screen). These, and any other open files, can be redirected. Redire转载 2014-10-21 08:59:12 · 966 阅读 · 0 评论 -
LaTeX技巧572:如何给表格项添加注释?
给表格加注释的确是很多TeX用户不好用的地方,这里提供一个样式和代码,或许对于你的学习使用有所帮助,样式如下:代码如下:\documentclass[11pt,a4paper,english]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{babel}\usepa转载 2014-12-05 09:34:56 · 1859 阅读 · 0 评论 -
Footnote in table
HI,move the \footnotetext commands outside the table environment; this however will cause the footnotes to appear at the bottom of the page (as the first table in my example below shows); if you转载 2015-01-29 10:53:31 · 945 阅读 · 0 评论 -
批处理xcopy命令拷贝文件和文件夹
可以用xcopy实现,即:xcopy obt\*.* C:\Windows\OBT\ /s /e XCOPY 还有众多的功能, 是加参数来完成的。上面的/s /e 参数的作用分别是把子目录和空目录都复制过去,一些使用举例和参数说明如下: 1、如只是单纯地复制 E:\ 盘上所有文件到 D:\ 盘上,就输入“ xcopy e:\*.* d: /s /h "就行啦!如果在复制过程中,你不要他复制转载 2015-04-18 03:38:38 · 2302 阅读 · 0 评论 -
Changing caption width in latex
In this post I will discuss how to change the width of the figure caption. You can use the same technique to change the width of the other caption (like table caption). Here I am using the caption pac转载 2015-04-22 23:31:27 · 1357 阅读 · 0 评论 -
bash中的加法运算和其他运算
在Bash中的加法运算有多种表达形式,下面是比较简单的两种: 1 a=3 let "b=$a+2" #b=5 or let "b=a+2" 之所以用双引号,是因为在bash中的变量替换发生在双引号内,如果不用引号,bash会把它们解释为命令。 2 a=3 ((b=a+2)) #b=5 这是最简单的一种形式。 bash中还可以运行好多中转载 2015-04-17 22:39:51 · 11047 阅读 · 0 评论 -
gcc -rdynamic参数解释
选项 -rdynamic 用来通知链接器将所有符号添加到动态符号表中(目的是能够通过使用 dlopen 来实现向后跟踪)-rdynamicPass the flag ‘-export-dynamic’ to the ELF linker, on targets that supportit. This instructs the linker to add all symbols,原创 2014-07-27 23:57:13 · 7759 阅读 · 1 评论 -
如何调试R程序
R语言的调试重要性不言而喻,这段时间准备改进一个R的包,但由于接触R时间不长,中间的很多东西不懂,需要重新打包调试,以对里面的很多程序有深入了解,下面从几个方面分享一下我的收获。1、 准备工作a) R软件的下载http://cran.r-project.org/。b) 下载源码包,比如我下载了tsDyn(非线性时间序列)包,http://cra转载 2014-05-30 04:06:02 · 4105 阅读 · 0 评论 -
bash 编程中循环语句用法
1.if 是单分支语句,使用格式如下: if condition ; then statement ….. fi 2.if … else 是双分支语句,使用格式如下: if condition ; then statement …. else statement …. fi 3.if …elif…elif…else 是多分支语句,使用格式如下:转载 2013-06-11 07:00:28 · 853 阅读 · 0 评论 -
Linux Bash Shell学习(六):设置环境参数
续Linux Bash学习(五):特殊文件、别名、选项和参数 本文也即《Learning the bash Shell》3rd Edition的第三章Customizing Your Environment之读书笔记二,但我们将不限于此。设置一个好的用户环境,对我们开发是非常关键的。在这一章节中,从四个方面进行介绍:特别的文件,别名,选项,参数。上回学习到参数设定的部分。继续…转载 2013-07-03 00:45:24 · 620 阅读 · 0 评论 -
Vim多行缩进技巧
1.按v进入visual状态,选择多行,用>或2.通常根据语言特征使用自动缩进排版:在命令状态下对当前行用== (连按=两次), 或对多行用n==(n是自然数)表示自动缩进从当前行起的下面n行。你可以试试把代码缩进任意打乱再用n==排版,相当于一般IDE里的code format。使用gg=G可对整篇代码进行排版。3.gg shift+G 首尾4.全文字眼替换转载 2013-08-07 02:05:38 · 1276 阅读 · 0 评论 -
Vim多行缩进技巧
按v进入visual状态,选择多行,用>或通常根据语言特征使用自动缩进排版:在命令状态下对当前行用== (连按=两次), 或对多行用n==(n是自然数)表示自动缩进从当前行起的下面n行。你可以试试把代码缩进任意打乱再用n==排版,相当于一般IDE里的code format。使用gg=G可对整篇代码进行排版。转载 2013-08-07 02:00:43 · 721 阅读 · 0 评论 -
Vim用法小结
这是我总结的一些基本用法,可能对初用者会有帮助,独乐乐不如众乐乐,是吧!说明:以下黑色为vi和vim均有的一般功能,而红色为Vim(Vi Improved)所特有功能。Vim一般的Unix和Linux下均有安装。 三种状态Command: 任何输入都会作为编辑命令,而不会出现在屏幕上,任何输入都引起立即反映Insert: 任何输入的数据都置于编辑寄存器,按ESC,可跳回com转载 2013-08-07 04:43:45 · 618 阅读 · 0 评论 -
vim 复制,粘贴,超给力
用vim这么久了,始终也不知道怎么在vim中使用系统粘贴板,通常要在网上复制一段代码都是先gedit打开文件,中键粘贴后关闭,然后 再用vim打开编辑,真的不爽;上次论坛上有人问到了怎么在vim中使用系统粘贴板,印象里回复很多,有好几页的回复却没有解决问题,今天实在受不了了又 在网上找办法,竟意外地找到了,贴出来分享一下。如果只是想使用系统粘贴板的话直接在输入模式按Shift+Inset就转载 2013-08-07 04:49:07 · 711 阅读 · 0 评论 -
配置VIM语法高亮及自动缩进
1 、配置文件的位置在目录 /etc/ 下面,有个名为vimrc 的文件,这是系统中公共的vim配置文件,对所有用户都有效。而在每个用户的主目录下,都可以自己建立私有的配置文件,命名为:“. vimrc ”。例如,/root目录下,通常已经存在一个. vimrc文件。如果不知道配置文件及脚本的位置,可以在vim中使用命令 :scriptnames ,将显示如下路径/etc/转载 2013-08-07 04:41:39 · 698 阅读 · 0 评论 -
Vim之删除重复行
题注:本文关于Vim的删除文本中的重复行。最近开始使用Vim,感觉此乃外人间之神器,怪不得那么多Vimer对其偏爱有加。现在说说文本中重读行删除问题。在众多的编辑器中Vim对正则的支持估计是最强大的了,很多高级的正则表达式在Vim中都是支持的。以下是我的解法::%s/\(.*\)\n\1/\1\r/g:g/^$/d这里需要两个命令,后再http://vim.wikia.转载 2013-08-08 07:40:01 · 1147 阅读 · 0 评论 -
vi功能使用
我的vim配置文件,适用于Python开发和rest文档编辑http://gashero.javaeye.com/blog/505858vim 查找词 输入Esc + :/ findName 或 grep -n name filename Yes. that's it. Press n to find next one.vim 显示行转载 2013-09-05 23:00:01 · 1062 阅读 · 0 评论 -
Why are EPS files generated by gnuplot rotated 90 degrees?
up vote1down votefavoriteI have an EPS file generated by gnuplot. I used the code:#set term post enh color#set out '1.eps'The EPS file viewer in gsview is horizontal. Howe转载 2013-09-30 09:12:01 · 823 阅读 · 0 评论 -
使用grep来查找当前文件夹下边所有包含某个字符串的文件
# grep "new User("\* -r ./*表示查找当前目录下所有包含字符串new User( 的文件,其中-r表示包含下级目录进行递归查询。./*指明在当前目录进行查询。双引号中的内容是需要查找的字符串。转载 2013-10-07 21:12:32 · 1139 阅读 · 0 评论 -
59维的LBP
考虑3x3的LBP operator。计算方法很简单,在边缘部分的处理方式一般从第二行和第二列开始,所以便最外面一层像素是没有经过LBP处理的。这个影响不大。LBP处理之后的像素值还是从0~255的,所以直观上,选择一个区域(整体或者局部),直方图的bin应该有256个。但假如我们选择的区域是16x16或者8x8,这样像素如果分布在256个区间里的话,一般会有很多bin是空的,增加原创 2013-10-21 21:49:13 · 2846 阅读 · 0 评论 -
ssh-copy-id command not found
sudo curl "hg.mindrot.org/openssh/raw-file/c746d1a70cfa/contrib/ssh-copy-id" -o /usr/bin/ssh-copy-idsudo chmod +x /usr/bin/ssh-copy-id原创 2013-12-02 11:29:39 · 6979 阅读 · 0 评论 -
vim 多文件编辑(偶的linux笔记)
在linux下,假若需要对多个文件的内容进行相互对照和参考,或需要将一个文件的某部分内容复制或粘贴到另一个文件中,可通过vim同时打开这些相关文件进行编辑。通过vim打开的每个文件都对应着一个buffer(buffer是系统为打开的文件分配的内存空间),每个buffer都有一个id。 1.在同一窗口下显示多个文件命令:vim filename1 filename2转载 2014-01-27 02:43:05 · 19761 阅读 · 0 评论 -
vim——打开多个文件、同时显示多个文件、在文件之间切换
打开多个文件:1.vim还没有启动的时候:在终端里输入 vim file1 file2 ... filen便可以打开所有想要打开的文件2.vim已经启动输入:open file可以再打开一个文件,并且此时vim里会显示出file文件的内容。同时显示多个文件::split:vsplit在文件之间切换:1.文件间切换Ctrl+6—下一个文件转载 2014-01-27 03:11:18 · 1052 阅读 · 0 评论 -
两篇很牛的vim使用技巧
读本文之前请注意:1. 本文的目标是提供一些vim的使用技巧,利用这些技巧可以提高vim的操作效率。部分技巧在vi上也可以使用,但是现在基本上都是用vim了。2. 本文是整理和总结使用技巧,而非讲解vim入门,因此不会涉及最基本的使用,例如如何上移或下移光标,对此类操作请参阅任何一本vim或者vi教程。3. 本文阅读对象是了解了vim的基本操作,而希望高效地利用vim进行工作的人。熟练转载 2014-01-27 03:12:09 · 1155 阅读 · 0 评论 -
CMake Tutorial
Below is a step-by-step tutorial covering common build system issues that CMake helps to address. Many of these topics have been introduced in Mastering CMake as separate issues but seeing how they转载 2014-01-28 03:00:14 · 1092 阅读 · 0 评论 -
Contains Duplicate III
Contains Duplicate IIIGiven an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the d转载 2015-09-18 04:15:27 · 711 阅读 · 0 评论