小行星

热爱平淡,向往未知


  • 首页

  • 分类

  • 归档

  • 关于

  • 阅读排行

  • 搜索

nvidia-smi 幽灵进程

发表于 2018-01-Wed | 阅读次数:
1
sudo pkill python

Error loading notebook

发表于 2018-01-Wed | 阅读次数:
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

查看占用空间

发表于 2018-01-Wed | 阅读次数:
1
du -h --max-depth=1 ./

python pickle 挖坑

发表于 2018-01-Tue | 阅读次数:

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

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

pickle 持久化对象

发表于 2018-01-Tue | 阅读次数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- 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

TypeError: Object of type 'float32' is not JSON serializable

发表于 2018-01-Mon | 阅读次数:
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 安装python

发表于 2018-01-Mon | 阅读次数:

安装pyenv

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

安装 python

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

mac 命令行移动

发表于 2018-01-Mon | 阅读次数:

Preferences -> Profiles -> Keys

###

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

vim _vim_files: function definition file not found #518

发表于 2018-01-Mon | 阅读次数:

remove ~/.zcompdump file

ssh 端口转发

发表于 2018-01-Mon | 阅读次数:

Local Port Forwarding

原因

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

阅读全文 »
1…535455…59
fangyh

fangyh

最爱的是那苍穹之外的浩渺宇宙

588 日志
4 分类
66 标签
© 2020 fangyh
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.3
|本站总访问量次