0%

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

解决

xcode-select –install

开启HiDPI

1
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES
Read more »

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)

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

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()

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.

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
Read more »

1
export PATH=~/anaconda2/bin:$PATH

把 ~/Library/Preferences 里的 com.qiuyuzhou.ShadowsocksX-NG.plist 和 ~/Library/Application Support 里的 ShadowsocksX-NG/ 删掉.