根据 https://github.com/creationix/nvm 可以很方便地安装,
然后可以很方便地安装、管理各版本的node。
1
|
|
装完后会显示 Now using node v0.10.26
,而在新开的 shell 中需要 nvm use v0.10.26
。所以设置一个默认版本,nvm alias default v0.10.26
貌似 nvm 只能管理使用 nvm 来安装的 nodes,然后按版本被安装到类似$HOME/.nvm/v0.10.26
的 path.
安装 node 会附带安装 npm(Node Package Manager)。npm 安装 package 有两种模式,global 跟 local,local的概念就是只在项目目录下安装一份(其实js的安装也只是简单地拷贝文件嘛),这起到了类似 python venv 的功能,可以为每个项目单独隔离出一个包依赖环境。
那么,为了避免多次安装造成多次download,npm 默认会在 $HOME/.npm
目录下 cache 下载的包。npm cache clean
可以清空这个目录。
使用了 nvm 后, 附带的npm 被安装在了 $HOME/.nvm/v0.10.26/lib/node_modules/npm/
(因为 npm 也只是一个 node module
而 global package 的安装目录变为 $HOME/.nvm/v0.10.26/lib/node_modules
,bin 会被 symlink 到 $HOME/.nvm/v0.10.26/bin
,它也已经被加入到 PATH 中.
1
|
|
另外,我原先的 node 都是用 homebrew 装的,
1 2 |
|
npm 被装在 /usr/local/lib/node_modules/npm -> /usr/local/Cellar/node/0.10.17/lib/node_modules/npm
npm prefix 为 /usr/local/share/npm,因而 npm global 包被装在 /usr/local/share/npm/lib/node_modules/
]]>OS X 实际上是 FreeBSD,Linux上隐藏文件/文件夹都只有取名为.
开头的方法,BSD上还有 chflags
这个命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
flag 前面加 no
就是相反的意思,
所以,
1
|
|
就行了.
]]>http://www.genmymodel.com/
在线的,略吊,但是目前支持的图有点少,不过大多时候能画类图也就够了
http://argouml.tigris.org/
ArgoUML
http://www.umlet.com/changes.htm
UMLet
http://www.astah.net/editions/community
Astah Community,这个推荐的人还蛮多
https://github.com/amolenaar/gaphor
用我大python写的
https://github.com/ObeoNetwork/UML-Modeling
OpenSource (EPL licensed) UML2 Graphical Modelers (Class, Composite, State, Activity, Sequence …) 这个应该是我找到的功能最全的,界面是继承 Eclipse 的貌似
安装 https://github.com/amolenaar/gaphor 的时候总报 ImportError: No module named pygtk
,
而我的 pygtk 是 homebrew 装的,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
(出问题后看pygtk有几个依赖是叉,还重装过一次)
python -c "import pygtk"
是 ok 的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
sys.path
中是包含 ‘/usr/local/lib/python2.7/site-packages’ 的,homebrew 装的 pygtk 在这里面。
但是在 cd gaphor-gaphor-0.17.2 && pip install .
的时候,输出 sys.path
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
却不包含 ‘/usr/local/lib/python2.7/site-packages’ 了。。为何
https://github.com/Homebrew/homebrew/issues/10908 这个 issue 是关于 Meld 的,依然没发现什么有帮助的信息么..
在我机子上分散在下列地方,
1 2 3 |
|
问题还没搞清楚 To be continued
还有,我搞不清楚现在我 easy_install 装的东西是否 work 了,以及装的地方在哪里?
http://lukehagan.com/journal/2010-11-21-easy_install/
似乎依然不 work 迷茫中
]]>装完1.2G…略忧伤
下面抄一下介绍..
Welcome to Haskell Platform. The platform consists of the Glasgow Haskell Compiler (GHC) and an extensive set of standard libraries and utilities with full documentation.
On Mac OS X, the Haskell Platform is installed in two major pieces: GHC and Haskell Platform. They are installed respectively in:
/Library/Frameworks/GHC.framework
/Library/Haskell
Executables are symlinked in /usr/bin and should be available in any shell.
This and prior versions of GHC and Haskell Platform can be found and then easily removed with the uninstallation command line utility:
/Library/Haskell/bin/uninstall-hs
Simply run it for more information.
The cabal command manages the building and installation of packages, both your own, and those it can fetch from the Hackage repository. The first time you run cabal, a Mac specific configuration is written into the ~/.cabal directory.
The configuration sets up cabal to install packages with the same layout as those installed with the Platform. Packages installed per user (–user, the default) are placed in a parallel tree in ~/Library/Haskell.
N.B. Built executables will be symlink’d into ~/Library/Haskell/bin, you probably want to add that to your $PATH by adding this line to your ~/.bash_profile:
export PATH="$HOME/Library/Haskell/bin:$PATH"
]]>1 2 3 4 5 6 7 |
|
:w !sudo tee %
Following is copied from Andrew Marshall’s answer on StackOverflow.
As eugene y pointed out, % does indeed mean “the current file name”. Another use for this in Vim is in substitution commands. For example, :%s/foo/bar means “in the current file, replace occurrences of foo with bar.” If you highlight some text before typing :s, you’ll see that the highlighted lines take the place of % as your substitution range.
One confusing part of this trick is that you might think :w is modifying your file, but it isn’t. If you opened and modified file1.txt, then ran :w file2.txt, it would be a “save as”; file1.txt wouldn’t be modified, but the current buffer contents would be sent to file2.txt.
Instead of file2.txt, you can substitute a shell command to receive the buffer contents. For instance, :w !cat will just display the contents.
If Vim wasn’t run with sudo access, its :w can’t modify a protected file, but if it passes the buffer contents to the shell, a command in the shell can be run with sudo. In this case, we use tee.
As for tee, picture the tee command as a T-shaped pipe in a normal bash piping situation: it directs output to specified file(s) and also sends it to standard output, which can be captured by the next piped command.
For example, in ps -ax | tee processes.txt | grep ‘foo’, the list of processes will be written to a text file and passed along to grep.
+-----------+ tee +------------+
| | -------- | |
| ps -ax | -------- | grep 'foo' |
| | || | |
+-----------+ || +------------+
||
+---------------+
| |
| processes.txt |
| |
+---------------+
(Diagram created with Asciiflow.)
See the tee man page for more info.
In the situation your question describes, using tee is a hack because we’re ignoring half of what it does. sudo tee writes to our file and also sends the buffer contents to standard output, but we ignore standard output. We don’t need to pass anything to another piped command in this case; we’re just using tee as an alternate way of writing a file and so that we can call it with sudo.
You can add this to your .vimrc to make this trick easy-to-use: just type :w!!.
1 2 3 |
|
1
|
|
And set up the default-terminal option in ~/.tmux.conf
,
1 2 |
|
__builtin__
里发现一个intern
方法,(原来是internal的意思..
其实 C 里面有个文字常量区,就是说只要是字符串字面量都会存在那里。
才知道Python里不太一样,比如说
1 2 3 4 |
|
真相是,python只对由0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz
中的字符组成的字符串自动做intern。
因为它们可能会更短…更像标识符..
另外,在 Python 3 中,似乎被移到sys.intern
中去了
.rvmrc
文件,
1
|
|
目测是指定ruby版本用的。每次进入目录都会有Do you wish to trust this .rvmrc file?
的提示,需要手动确认。
还是挺烦的…
其实,rvm list
可以看到我机子上只有这一个版本
1 2 3 |
|
所以这个 .rvmrc
是毫无意义的,可以删掉…
或者在~/.rvmrc
里写入export rvm_trust_rvmrcs_flag=1
Lisp and Python should love each other. Let’s make it happen.
http://docs.python.org/2/distutils/setupscript.html#installing-package-data
Building and Distributing Packages with Setuptools
https://pypi.python.org/pypi/setuptools/ http://www.pip-installer.org/en/latest/usage.html#pip-install http://www.pip-installer.org/en/latest/logic.html#git http://stackoverflow.com/questions/6947988/when-to-use-pip-requirements-file-versus-install-requires-in-setup-py https://groups.google.com/d/msg/python-virtualenv/1eI6Z9_XRHE/cj6CCHvmS10J http://stackoverflow.com/questions/2087148/can-i-use-pip-instead-of-easy-install-for-python-setup-py-install-dependen
from pip.req import parse_requirements
http://stackoverflow.com/questions/14399534/how-can-i-reference-requirements-txt-for-the-install-requires-kwarg-in-setuptool?answertab=votes#answer-16624700
Require pip>=1.2, as lower versions have a bug https://github.com/erikrose/peep/commit/65367f66b777f17b1223569e1cd2f6250a820e99
http://stackoverflow.com/questions/17366784/setuptools-unable-to-use-link-from-dependency-links/17442663#17442663 http://www.pip-installer.org/en/latest/logic.html#requirements-file-format
]]>At {virtualenv}/lib/python2.7/site-packages/
只能串口访问,没买usb无线,没有多余网线。。不能SSH、开VNC。。不幸福
等能联网了再来折腾吧 →_→
df -h
来获得sd卡的设备路径1 2 3 4 5 |
|
And you can use killall -INFO dd
to check the status of dd
in progress (link)
http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41 安装完需要重启。。
brew install minicom
ps. 我不知道为什么直接用screen连 screen /dev/tty.usbserial 9600
会乱码加卡死。。
one test case is easy, how to support multi- test cases?
ex.
1 2 3 4 5 6 7 |
|
in python 2.x
1
|
|
You can test it on the Online Judge. :)
]]>For PDF output, you’ll also need LaTeX. We recommend installing BasicTeX (64M), and using the tlmgr tool to install additional packages as needed.
Just download and run the pkg files.
Then add /usr/texbin
to your $PATH(export PATH=${PATH}:/usr/texbin;
).
Now, you get them installed.
1 2 3 |
|
tlmgr - TeX Live package manager
1 2 3 |
|
1 2 3 4 5 6 7 8 9 10 |
|
and you can check the version by tlmgr --version
1
|
|
1
|
|
TO be continued
最近的觉悟是自己写代码太慢,对IDE的依赖是累积的,各种恶性循环(不足够了解语言,不熟悉项目结构)。半天憋不出几行代码,这种状态让人厌恶…以前对此持观望态度,各种纵容自己,现在发现这已经成为自己的一大瓶颈…
这东西上次hack day的时候看 atupal用过,印象蛮深。今天挖出来玩玩。
去商店安装的时候,提示This application is not supported on this computer. Installation has been disabled.
,安装按钮直接变灰了。Google无果,看了下自己的Chrome版本,22…(mbp买来到现在没更过的节奏…),然后用”关于”里的自动更新报Error 12(以前也是这样所以一直没更吧..)。
试了官方提供的方法,木有用。。Google出来的也大致都是删掉SoftwareUpdate然后再装一遍的意思,以及各种偏方,无果。
然后想是不是因为现在版本太低(22->28)的缘故,最后直接把最新的下来覆盖了。后来发现完全无痛啊,因为现有的东西包括Extensions的localStorage都是放在Application Support/
里的么。。
然后很舒服地用着最新版,顺利地把Secure Shell装上了。
然后其实也不用什么配置是吧,输个<username>@localhost
就好了。。结果报Connection refused。。用iTerm试了下ssh localhost
同样是Connection refused(sshd服务没开的节奏…)
1
|
|
1 2 3 |
|
ok,现在已经可以顺利ssh到本地了。
另外,还可以直接授权publickey,这样就不用每次都输密码了(但是还是要输一次id_rsa私钥的密码,后面貌似shell会记住)。
1
|
|
用自己的账户登陆是ok了,但是尝试用root登陆时提示Permission denied (publickey,keyboard-interactive)
错误。
先是加了/etc/sshd_config里的PermitRootLogin yes
(开始把ssh_config跟sshd_config搞错了。。图样)。还是不行。
后来发现是OS X默认没有开启root用户,我输入的密码也只是a valid sudoer password
,根本不是root的密码。
1
|
|
之后就可以用root账户登陆了。
Chrome Secure Shell 用起来很方便也很爽。但是我发现ls
的时候中文目录名会乱码,中文文件内容可以正常显示。
还有就是不能输入中文(输入法无效。。)。
http://git.chromium.org/gitweb/?p=chromiumos/platform/assets.git;a=tree;f=chromeapps/hterm,这个据说是前端的源码,可以拿来研究下(kido参考)。但是clone了半天搞不下来。。= =(噗。。现在看了一下貌似死在3%了..)
以后别把包名取做site,import的时候会跟python标准库里的site.py冲突。。
]]>