小行星

热爱平淡,向往未知


  • 首页

  • 分类

  • 归档

  • 关于

  • 阅读排行

  • 搜索

ubuntu安装mac风格

发表于 2017-11-Wed | 阅读次数:

​Install Unity tweak tool

1
sudo apt-get install unity-tweak-tool
阅读全文 »

mac 使用遇到的错误

发表于 2017-11-Fri | 阅读次数:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools ), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解决

xcode-select –install

2k屏幕开启HiDPI

发表于 2017-11-Fri | 阅读次数:

开启HiDPI

1
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES
阅读全文 »

python 闭包

发表于 2017-11-Sun | 阅读次数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def two_type(t=1):
def dec(fun):
def real_fun(x):
if t == 1:
print ("i am real")
else:
print ("i am false")
fun(x)
return real_fun
return dec

@two_type(t=0)
def fun(x):
print(2*x)
fun(2)

python trick

发表于 2017-11-Sun | 阅读次数:
1
2
3
4
5
6
7
8
9
def make_averager():
count = 0
total = 0

def averager(new_value):
count += 1
total += new_value
return total / count
return averager

对于数字,字符串,元祖 不可变类型来说,只能读取不能更新。 重新绑定会隐式创建局部变量count.
只有可变变量是可以的。

或者使用nonlocal count, total

python 装饰器

发表于 2017-11-Sun | 阅读次数:
1
2
3
4
5
6
7
8
9
10
11
12
def use_logging(func):

def wrapper(*args, **lkwargs):
logging.warn("%s is running" % func.__name__)
return func(*args, **lkwargs)
return wrapper

def bar():
print('i am bar')

bar = use_logging(bar)
bar()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Foo(object):
def __init__(self, func):
self._func = func

def __call__(self):
print('class decorator running')
self._func()
print('class decorator ending')

@Foo
def bar():
print('bar')

bar()

jupyter 复制sublime代码 indent indications

发表于 2017-11-Sun | 阅读次数:

解决:
cmd+], cmd+[

iterm2 更多历史

发表于 2017-11-Sat | 阅读次数:

There is an option “unlimited scrollback buffer” which you can find under Preferences > Profiles > Terminal or you can just pump up number of lines that you want to have in history in the same place.

jupyter notebook 添加python3

发表于 2017-11-Sat | 阅读次数:
1
2
3
4
conda create -n py36-test python=3.6
source activate py36-test
python -m ipykernel install --name py36-test
source deactivate
阅读全文 »

命令不存在

发表于 2017-11-Sat | 阅读次数:
1
export PATH=~/anaconda2/bin:$PATH
1…555657…59
fangyh

fangyh

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

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