0%

1
IPython Notebook error: Error loading notebook #9163
1
2
cd $(jupyter --data-dir)
mv nbsignatures.db nbsignatures.db.bak # Or just rm it - there's probably no use keeping the corrupt file

1
du -h --max-depth=1 ./

直接存arr失败了,存成dict就成功了

1
pickle.dump(output_dict, open("output_dict.txt", "wb"))

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-

import pickle
# 也可以这样:
# import cPickle as pickle

obj = {"a": 1, "b": 2, "c": 3}

# 将 obj 持久化保存到文件 tmp.txt 中
pickle.dump(obj, open("tmp.txt", "w"))

# do something else ...

# 从 tmp.txt 中读取并恢复 obj 对象
obj2 = pickle.load(open("tmp.txt", "r"))

print obj2

1
2
3
4
5
6
7
8
9
10
11
12
13
import json
class MyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, numpy.integer):
return int(obj)
elif isinstance(obj, numpy.floating):
return float(obj)
elif isinstance(obj, numpy.ndarray):
return obj.tolist()
else:
return super(MyEncoder, self).default(obj)

return json.dumps(data, cls=MyEncoder)

安装pyenv

1
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

安装 python

1
2
v=3.5.2|wget http://mirrors.sohu.com/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v

Preferences -> Profiles -> Keys

1
2
ctrl + -> | send escape sequence | f
ctrl + <- | send escape sequence | b

Local Port Forwarding

原因

一般来讲,云主机的防火墙默认只打开了22端口,如果需要访问3000端口的话,需要修改防火墙。为了保证安全,防火墙需要配置允许访问的IP地址。但是,本地公忘IP通常是网络提供商动态分配的,是不断变化的。这样的话,防火墙配置需要经常修改,就会很麻烦。

Read more »

1
2
conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda config --set show_channel_urls yes