所有由skywalk发布的文章

阿里云升级freebsd10.1到11.0-release-p8记录

阿里云升级freebsd10.1到11.0-release-p8记录

总体是一次顺利的升级体验!

主要用到的命令是:

查看版本

945  22:20   freebsd-version -k -u

设置环境变量,10.3版本,好像不需要弄这个:

946  22:20   setenv UNAME_r “10.3-RELEASE”

更新,这个在国内如果没有镜像的话时间超长!

 

为了装jupyter,使用了其它一下命令:

947  22:20   freebsd-update fetch

 

920  20:59   whereis jupyterhub

921  21:00   whereis jupyter

926  21:00   locate notejs

927  21:21   df

928  21:25   whereis nodejs

929  21:25   locate node

930  21:27   pkg install node

931  21:27   pkg-static install node

932  21:55   pkg_stick install python36

933  21:56   pkg-static install python36

934  22:02   whereis py-pyzmq

935  22:03   make PYTHON_VERSION=python3.6 install clean

936  22:03   cd /usr/ports/net/py-pyzmq

937  22:03   make PYTHON_VERSION=python3.6 install clean

938  22:07   pkg-static install py-setuptools36

939  22:07   pkg-static install devel/py-setuptools36

940  22:08   cd /usr/ports/net/py-pyzmq

943  22:09   make -V PYTHON_VERSION=python3.6 install clean

944  22:19   freebsd-version

945  22:20   freebsd-version -k -u

946  22:20   setenv UNAME_r “10.3-RELEASE”

后来知道,这里不需要设这个环境变量。

 

956  22:29   /usr/local/bin/python3.6

957  22:31   ps -aux

958  22:31   nameserver

959  22:32   nslookup

960  22:32   vi /etc/resolv.conf

 

983  22:36   freebsd-update fetch

984  22:36   freebsd-update fetch &

 

1000  22:43   freebsd-update -s ‘freebsd-updates.mirrors.163.com’ fetch

可惜163的镜像没有了。

参考的这篇文章:

升级FreeBSD 10.2-STABLE 到 11.0-RELEASE

https://bbs.aliyun.com/read/297189.html?spm=5176.bbsr296915.0.0.z411Uy

发现那篇文章中有误,

不过那个错误不影响大局,因为到了后面会有提示

freebsd-update fetch 之后,就可以先升级到10.3了

freebsd-update upgrade -r 10.3-RELEASE

 

root@iZ25alqsdzzZ:~ # freebsd-update upgrade -r 10.3-RELEASE

Looking up update.FreeBSD.org mirrors… 4 mirrors found.

Fetching metadata signature for 10.1-RELEASE from update5.freebsd.org… done.

Fetching metadata index… done.

Fetching 2 metadata files… done.

Inspecting system… done.

 

The following components of FreeBSD seem to be installed:

kernel/generic world/base world/lib32

 

The following components of FreeBSD do not seem to be installed:

src/src world/doc world/games

 

Does this look reasonable (y/n)? y

 

Fetching metadata signature for 10.3-RELEASE from update5.freebsd.org… done.

Fetching metadata index… done.

Fetching 1 metadata patches. done.

Applying metadata patches… done.

Fetching 1 metadata files…

done.

Inspecting system…

 

done.

Fetching files from 10.1-RELEASE for merging… done.

Preparing to download files… done.

Fetching 11045 patches…..10….20….30….40….50….60….70….80….90….100….110….120….130….140….150….160….170….180….190….200….210….220….230….240….250….260….270..

 

本来以为要3个小时呢,后来很快:

….10010….10020….10030….10040….10050……..11030….11040.. done.

Applying patches… done.

Fetching 393 files… done.

Attempting to automatically merge changes in files… done.

 

The following file could not be merged automatically: /etc/ntp.conf

Press Enter to edit this file in vi and resolve the conflicts

manually…

 

说/etc/ntp.conf无法自动合并,只能手工上!

 

回答了一大堆yes

然后运行安装:

/usr/sbin/freebsd-update install

 

root@iZ25alqsdzzZ:~ #/usr/sbin/freebsd-update install

Installing updates…

Kernel updates have been installed.  Please reboot and run

“/usr/sbin/freebsd-update install” again to finish installing updates.

 

一年多没重启了,重启一下

启动后看下:

root@rich:~ # freebsd-version -k -u

10.3-RELEASE-p11

10.1-RELEASE

 

Ok,成功从10.1升级到10.3,现在开始主版本升级,从10升级到11,输入如下命令:

# : > /usr/bin/bspatch

# freebsd-update upgrade -r 11.0-RELEASE

# freebsd-update install

<reboot the system>

# freebsd-update install

<rebuild third-party software>

# freebsd-update install

 

root@rich:~ # freebsd-update upgrade -r 11.0-RELEASE

src component not installed, skipped

Looking up update.FreeBSD.org mirrors… 4 mirrors found.

Fetching metadata signature for 10.3-RELEASE from update5.freebsd.org… done.

Fetching metadata index… done.

Fetching 1 metadata patches. done.

Applying metadata patches… done.

Fetching 1 metadata files… done.

Inspecting system… done.

 

The following components of FreeBSD seem to be installed:

kernel/generic world/base world/lib32

 

The following components of FreeBSD do not seem to be installed:

world/doc world/games

 

Does this look reasonable (y/n)? y

 

Fetching metadata signature for 11.0-RELEASE from update5.freebsd.org… done.

Fetching metadata index… done.

Fetching 1 metadata patches. done.

Applying metadata patches… done.

Fetching 1 metadata files… done.

Inspecting system… done.

Fetching files from 10.3-RELEASE for merging… done.

Preparing to download files… done.

Fetching 11218 patches…..10….20….30….40….50….60….70….80….90….100….110….120….130….140….150….160….170….180….190….200….210….220….230….240….250….260….270….280….290….300….310….320….330….340….350….360….370….380….390….400….410….420….430….440….450….460….470….480….490….500……….11200….11210…. done.

Applying patches… done.

Fetching 1645 files… done.

Attempting to automatically merge changes in files… done.

 

The following file could not be merged automatically: /etc/ntp.conf

Press Enter to edit this file in vi and resolve the conflicts

 

安装过程中,又出现ntp.conf,我直接确认退出,然后出现:

The following changes, which occurred between FreeBSD 10.3-RELEASE and

FreeBSD 11.0-RELEASE have been merged into /etc/group:

— current version

+++ new version

@@ -1,6 +1,6 @@

-# $FreeBSD: releng/10.3/etc/group 256366 2013-10-12 06:08:18Z rpaulo $

+# $FreeBSD: releng/11.0/etc/group 294896 2016-01-27 06:28:56Z araujo $

#

wheel:*:0:root,sky

daemon:*:1:

kmem:*:2:

sys:*:3:

@@ -15,10 +15,11 @@

staff:*:20:

sshd:*:22:

smmsp:*:25:

mailnull:*:26:

guest:*:31:

+video:*:44:

bind:*:53:

unbound:*:59:

proxy:*:62:

authpf:*:63:

_pflogd:*:64:

@@ -26,10 +27,11 @@

uucp:*:66:

dialer:*:68:

network:*:69:

audit:*:77:

www:*:80:

+_ypldap:*:160:

hast:*:845:

nogroup:*:65533:

nobody:*:65534:

mysql:*:88:

sky:*:1001:

Does this look reasonable (y/n)?

 

更新了一大堆东西,pkg这个是我真实目的,因为阿里云freebsd10.1的pkg挂了:

/usr/sbin/periodic

/usr/sbin/pkg

/usr/sbin/pmcannotate

 

最后出现:

/var/yp/Makefile.dist

To install the downloaded upgrades, run “/usr/sbin/freebsd-update install”.

 

按照提示运行

/usr/sbin/freebsd-update install

 

root@rich:~ #/usr/sbin/freebsd-update install

src component not installed, skipped

Installing updates…

Kernel updates have been installed.  Please reboot and run

“/usr/sbin/freebsd-update install” again to finish installing updates.

 

重启系统后,看一下:

root@rich:~ # uname -a

FreeBSD rich 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

root@rich:~ # freebsd-version -k -u

11.0-RELEASE-p8

10.3-RELEASE-p17

 

呵呵,已经是11啦!

再来一次/usr/sbin/freebsd-update install

root@rich:~ # /usr/sbin/freebsd-update install

src component not installed, skipped

Installing updates…

Completing this upgrade requires removing old shared object files.

Please rebuild all installed 3rd party software (e.g., programs

installed from the ports tree) and then run “/usr/sbin/freebsd-update install”

again to finish installing updates.

root@rich:~ #

 

这里让重新build所有的三方软件,天啊!

这个先不管它了

先看一下版本:

root@rich:~ # freebsd-version -k -u

11.0-RELEASE-p8

11.0-RELEASE-p8

 

嗯,这样就对了 !

 

总体来说,目前看算顺利,没有出什么内核无法启动,sshd无法启动,网站挂了等幺蛾子 !

patsy学习笔记——概述 zt

patsy学习笔记——概述

patsy是一个Python包,用于描述统计模型(statistical models)(特别是,线性模型或者有线性成分的模型),同时也用于构建设计矩阵(design matrices)。该包的开发受到了R或S语言中的公式微语言(the formula mini-language)的启发,并与其兼容。

举例来说,如果我们有变量y和变量 x,a,b。我们想求出变量y与变量x,a,b之间的回归关系,其中变量a和b之间存在着交互作用,则公式可写为:

patsy.dmatrices("y ~ x + a + b + a:b", data)

树莓派 freebsd相关信息

raspberrypi-running-freebsdarm

freebsd下如何安装摄像头

 

freebsd 树莓派 wiki

安装系统对我来说不是问题,关键是后面,怎么安那些驱动啥的啊!

# uname -a
FreeBSD rpi2 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r292413: Fri Dec 18 11:16:56 UTC 2015     root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI2  arm
root@rp

2016.1.19日补充:

顺便把家里路由器的dns换掉,从8.8.8.8 换成
202.102.152.3
202.102.154.3

这也是没有办法啊,因为经常网络不通!

 

树莓派那块,现在把摄像头装好了,中间有曲折,估计是接触不好的原因。

安装方法如下:

Setting up the Raspberry Pi Camera

  • Install the Raspberry Pi Userland tools:
    • pkg install raspberrypi-userland (misc/raspberrypi-userland)

  • Enable the video core and up the RAM allocated to the GPU, by adding the following to /boot/msdos/CONFIG.TXT:
    • start_x=1

    • gpu_mem=128

  • Reboot
  • Test:
    • raspistill -t 100 -n -o snap-`date +%Y%m%d-%H%M%S`.jpg

 

 

龙虎榜统计

# -*- coding: utf-8 -*-
“””
Created on Tue Sep 15 21:50:19 2015

@author: Administrator
“””

import tushare as ts

aa=ts.inst_detail()
print(“机构买入、卖出信息统计”)
print(aa[:50])

手工检查,发现今天的数据是32项,所以:

bb=aa[:32]

bb=bb.drop_duplicates(‘code’)

bb
Out[33]:
code   name        date   bamount   samount  0   300432   富临精工  2015-10-28   5789.10    897.93
1   000566   海南海药  2015-10-28    101.18      0.00

 

d=bb[‘bamount’].sum()

e=bb[‘samount’].sum()

d

Out[40]: 67145.9

e
Out[41]: 109086.06999999999

得出统计:

10.28日机构买入67145.9万
10.28日机构卖出109086.07万

tushare 使用通联数据

st = ts.Market()

df = st.MktEqud(tradeDate=’20150917′, field=’ticker,secShortName,preClosePrice,openPrice,highestPrice,lowestPrice,closePrice,turnoverVol,turnoverRate’)

df[‘ticker’] = df[‘ticker’].map(lambda x: str(x).zfill(6))

df
Out[23]:
ticker secShortName  preClosePrice  openPrice  highestPrice  0     000001         平安银行         10.900     10.850        11.140
1     000002          万科A         13.430     13.350        13.390
2     000004         国农科技         26.500     26.260        27.350

 

Web Plotting Python金融分析学习

练习了2个数据源的,分别是yahoo和tushare的

 

import numpy as np

import pandas as pd

url=’http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2009′
data=pd.read_csv(url,parse_dates=[‘Date’])

data.plot(x=”Date”,y=’Close’)

就能看到微软2009年的走势图了

 

第二种方法是从tushare获取数据:

data1=ts.get_hist_data(‘sh’)

但是这里获取的数据没有常规的日期列,需要把索引复制到日期列里:

data1[‘Date’]=data1.index

data1.plot(x=’Date’,y=’close’)

这样就能看到近3年的上证走势图了!

 

顺便学习了Bokeh绘图,好像这个挺推荐的:

可以直接输出网页,可以实时绘图!

from bokeh.plotting import figure, output_file, show

# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

# output to static HTML file
output_file("lines.html", title="line plot example")

# create a new plot with a title and axis labels
p = figure(title="simple line example",