Sunday, July 30, 2017

quickly log in remote sever

reference:
http://blog.csdn.net/leexide/article/details/17252369
https://my.oschina.net/aiguozhe/blog/33994

process:
local server:
1. ssh-keygen -t rsa (连续三次回车,即在本地生成了公钥和私钥,不设置密码)
2. ssh root@172.24.253.2 "mkdir .ssh;chmod 0700 .ssh" (需要输入密码, 注:必须将.ssh的权限设为700) (if remote server doesn't have ssh file)
3. scp ~/.ssh/id_rsa.pub root@172.24.253.2:.ssh/id_rsa.pub (需要输入密码)

remote server:
1. 
cat id_rsa.pub >> ~/.ssh/authorized_keys
2. 
 chmod 600 authorized_keys
3.
 chmod 700 -R ~/.ssh
注意都要在对应.ssh 文件目录下进行

Wednesday, July 19, 2017

python write to file buffer

https://stackoverflow.com/questions/18984092/python-2-7-write-to-file-instantly
https://stackoverflow.com/questions/3167494/how-often-does-python-flush-to-a-file
Use flush() or

For file operations, Python uses the operating system's default buffering unless you configure it do otherwise. You can specify a buffer size, unbuffered, or line buffered.
For example, the open function takes a buffer size argument.
"The optional buffering argument specifies the file’s desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size. A negative buffering means to use the system default, which is usually line buffered for tty devices and fully buffered for other files. If omitted, the system default is used."
bufsize = 0
f = open('file.txt', 'w', bufsize)
shareimprove this answer

Tuesday, May 23, 2017

Pages in Canvas

add code in Canvas
<p><code>java -version </code></p>
<pre><code>java -version </code></pre>

add github gist to html:
<iframe title="Code Embed" src="https://gist.github.com/RoyZhengGao/16c8a02c7d1fc90d616cc8f731b31d34.pibb" width="675" height="675" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe>

Thursday, May 11, 2017

Information Theory, Inference and Learning Algorithms Reading

1. preface

 binary symmetric channe
l

 Information theory and coding theory oer an alternative (and much more exciting)
approach: we accept the given noisy channel as it is and add communication
systems  to it so that we can detect and correct the errors introduced by
the channel. As shown in gure 1.6, we add an encoder  before the channel and
a decoder  after it.

Majority-vote
decoding algorithm

chapter 4:The Source Coding Theorem

Saturday, May 6, 2017

html format

add code to html
<code>int</code>

use iframe + github gist to embed long code in Canvas

<p class="p1"><span class="s1"> <iframe title="Code Embed" src="https://gist.github.com/RoyZhengGao/16c8a02c7d1fc90d616cc8f731b31d34.pibb" width="675" height="675" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe></span></p>

Friday, April 28, 2017

tensorflow

activate tensorflow:

source ~/Documents/tensorflow/bin/activate


deactivate tensorflow:

deactivate

Tuesday, February 28, 2017

Use anaconda in the server

every time to use anaconda pip, you need to execute the command first to find the path:




export PATH=/home/gao27/anaconda/bin:$PATH
或者把这行代码写入~/.bashrc 中,然后 source ~/.bashrc


install Anaconda in server
https://docs.anaconda.com/anaconda/install/linux


install pip directly:
https://pip.pypa.io/en/stable/installing/#id7