1、vagrant建立简单httpserver方法:

1)映射端口

修改Vagrantfile, 末尾添加本地端口和虚机端口的映射关系, 然后执行vagrant reload.

   Vagrant::Config.run do |config|
# Forward guest port 8000 to host port 8000
config.vm.forward_port 8000, 8000
end

需新增端口映射,只需增加

config.vm.forward_port 80, 8080

2)启动HTTPServer

通过python自带web服务器SimpleHTTPServer,在特定目录下(建立一个index.html)输入下面的命令来启动web服务器,提供一个文件浏览的web服务。

$python -m SimpleHTTPServer 8000

然后在浏览器输入http://localhost:8000

就可以看到上述目录下的所有目录和文件了,-m用于指定端口。

2、强大的parallel

1)parallel用于并行执行命令,加快处理速度,但是每次都会提示版权信息,可以用--bibtex后输入will cite,去除版权提示。

$ parallel --bibtex

When using programs that use GNU Parallel to process data for publication please cite:

@article{Tange2011a,
title = {GNU Parallel - The Command-Line Power Tool},
author = {O. Tange},
address = {Frederiksberg, Denmark},
journal = {;login: The USENIX Magazine},
month = {Feb},
number = {1},
volume = {36},
url = {http://www.gnu.org/s/parallel},
year = {2011},
pages = {42-47}
} (Feel free to use \nocite{Tange2011a}) This helps funding further development. Type: 'will cite' and press enter.
> will cite Thank you for your support. It is much appreciated. The citation
notice is now silenced.

这样以后就不会每次命令提示版权信息。

parallel命令的用法比较

$find data -name '*.txt' -exec echo "Processin {}" \;

$find data -name '*.txt' -print0 | parallel -0 echo "Processin {}"

如果采用exec参数的话,注意-exec 最后结尾为一个空格加“\”加“;”,因为;可能在不同shell有不同解释,加上\来转义,确保exec参数之后的命令能正确执行。

3、神器jq来处理json

1)  jq .格式化显示json数据,瞬间觉得json数据可读了;

2)  curl -s "http://api.openweathermap.org/data/2.5/forecast?q=shanghai,cn&mode=json" | jq -c '.list[] | {temp: .main.temp,weather: .weather[].description,time: .dt_txt}'| json2csv -p -k temp,weather,time >forecast.csv

curl 中含有&注意一定要""包含起来;

jq -c 压缩显示,不分行显示,注意:[] .的使用与json文件中一致



Data Science at the Command Line学习笔记(二)的更多相关文章

  1. Data Science at the Command Line学习笔记(一)

    学习Data Science at the Command Line时,win7下安装环境是遇到了一些小问题,最后通过百度解决. 官方指导可以在这个地址找到:http://datascienceatt ...

  2. Docker command line 学习笔记

    deprecated ! 以后直接对这个更新 http://wangzhezhe.github.io/blog/2015/08/10/docker-operations/ 之前整理了好久,每次用到一点 ...

  3. Java IO学习笔记二

    Java IO学习笔记二 流的概念 在程序中所有的数据都是以流的方式进行传输或保存的,程序需要数据的时候要使用输入流读取数据,而当程序需要将一些数据保存起来的时候,就要使用输出流完成. 程序中的输入输 ...

  4. Learning ROS for Robotics Programming Second Edition学习笔记(二) indigo tools

    中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS for Robotics Pr ...

  5. ES6学习笔记<二>arrow functions 箭头函数、template string、destructuring

    接着上一篇的说. arrow functions 箭头函数 => 更便捷的函数声明 document.getElementById("click_1").onclick = ...

  6. muduo学习笔记(二)Reactor关键结构

    目录 muduo学习笔记(二)Reactor关键结构 Reactor简述 什么是Reactor Reactor模型的优缺点 poll简述 poll使用样例 muduo Reactor关键结构 Chan ...

  7. python3.4学习笔记(二十五) Python 调用mysql redis实例代码

    python3.4学习笔记(二十五) Python 调用mysql redis实例代码 #coding: utf-8 __author__ = 'zdz8207' #python2.7 import ...

  8. python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法

    python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法window安装redis,下载Redis的压缩包https://git ...

  9. python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码

    python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码 淘宝IP地址库 http://ip.taobao.com/目前提供的服务包括:1. 根据用户提供的 ...

随机推荐

  1. 用Firefox的debugger来调试JavaScript

    1.自我感觉比firebug更好用 https://developer.mozilla.org/zh-CN/docs/Tools/Debugger

  2. 向mysql workbench中导入.sql文件

    mysql workbench用的不多,前段时间装了一下,然后用了一下,感觉操作比dbdesigner4要更人性化一点.其中二个方面做了改进,让我觉得很爽. 第一,就是端口可以修改了,以前就是定死33 ...

  3. c/c++面试题(2)

    4.已知String类的原型是: class String { public: String(const char* str = NULL);   //普通的构造函数 String(const Str ...

  4. Java xml object 互转

    public class ClassRoom { private int id; private String name; private int grade; public int getId() ...

  5. C语言使用cmd命令并获取输出方法

    转自http://blog.csdn.net/hxh129/article/details/8000205 C语言使用cmd命令并获取输出方法 在实践中,我们有时候需要用C语言来调用cmd的命令,并得 ...

  6. HDU 4822----其实不会这个题

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4822 并不会做这个题,题解说是LCA(最近公共祖先),并不懂,说一下我自己的思路吧,虽然没能实现出来. 题 ...

  7. zTree简单使用和代码结构

    1.页面使用元素代码 <input type="text" id="key" class="Side_Toput2" name=&qu ...

  8. Python培训12期-day2作业-购物车

    #!/usr/bin/env python import sys import os import getpass 商品={ '图书': { "<Puppet实战>": ...

  9. hdu 4336 Card Collector

    dp+状态压缩 #include<cstdio> using namespace std; ]; <<]; int main() { int n; while(scanf(&q ...

  10. thinking in Java 学习

    1.句柄 所谓句柄实际上是一个数据,是一个long的数据. 句柄是WINDOWS用来标识被应用程序所建立或使用的对象的唯一整数,WINDOWS使用各种各样的句柄标识诸如应用程序实例,窗口,控制,位图, ...