<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3339005215836974547</id><updated>2025-09-16T14:19:56.946+08:00</updated><category term="CentOS"/><category term="Bash"/><category term="python"/><category term="DHCP"/><category term="docker"/><category term="linux"/><category term="ubuntu"/><category term="vnc"/><category term="DNS"/><category term="SVN"/><category term="django"/><category term="yum"/><category term="Windows"/><category term="git"/><category term="ipv6"/><category term="mercurial"/><category term="php"/><category term="proxy"/><category term="Celery"/><category term="Eclipse"/><category term="ISA Server"/><category term="Java"/><category term="LDAP"/><category term="Samba SELinux"/><category term="Serial"/><category term="TestLink"/><category term="chmod"/><category term="clojure"/><category term="createrepo"/><category term="dos image"/><category term="easy_install"/><category term="fio"/><category term="freeradius"/><category term="gitosis"/><category term="httpd"/><category term="httpd folder listing"/><category term="httpd_sys_content_t"/><category term="icmp"/><category term="jenkins"/><category term="lxml"/><category term="mediawiki"/><category term="mod_wsgi"/><category term="mongodb"/><category term="mysql"/><category term="mysql phpmyadmin yum"/><category term="nfs"/><category term="ntlmaps"/><category term="openldap"/><category term="ping"/><category term="python getopt"/><category term="python setuptools easy_install"/><category term="python with"/><category term="rabbitmq"/><category term="radius"/><category term="radtest"/><category term="regular expression"/><category term="route"/><category term="route-eth0"/><category term="sed"/><category term="selinux"/><category term="setuptools"/><category term="ssh"/><category term="sysctl"/><category term="test automation"/><category term="tftp"/><category term="tsocks"/><category term="vim"/><category term="vpn"/><category term="vsftpd"/><category term="webmin"/><category term="webmin aws"/><category term="websocket"/><category term="wins"/><category term="wxPython"/><category term="you don&#39;t have permission to access"/><category term="yum rpmforge"/><title type='text'>Linux學習</title><subtitle type='html'>個人在學習Linux過程當中的個人筆記，提供個人及有需要的人查閱，若有錯誤歡迎提供指正，謝謝。&#xa;This Blog recorded notes about my learning Linux and provides myself and others reference. If there are any incorrect information, welcome to leave a message to correct me, Thanks.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>152</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-4035232720942449751</id><published>2023-10-20T10:45:00.001+08:00</published><updated>2023-10-20T10:45:15.823+08:00</updated><title type='text'>壞軌硬碟抓資料紀錄</title><content type='html'>&lt;p&gt;&amp;nbsp;用到的Tool&lt;/p&gt;&lt;p&gt;chkdsk (在ptt看到壞軌的話最好不要用chkdsk，忘記安全移除的分區表錯誤才用這個)&lt;/p&gt;&lt;p&gt;photorec裡面的disktest，用Ubuntu iso的try Ubuntu感覺成功率較高&lt;/p&gt;&lt;p&gt;------------&lt;/p&gt;&lt;p&gt;可以考慮的tool&lt;/p&gt;&lt;p&gt;ddrescue (這種感覺比較恰當，不會一直去讀原硬碟，有可能造成更多壞軌，但要準備跟原硬碟一樣大的空間)&lt;/p&gt;&lt;p&gt;又ddrescue dump出image後再用mount的方式抓出檔案。&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/4035232720942449751/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2023/10/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4035232720942449751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4035232720942449751'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2023/10/blog-post.html' title='壞軌硬碟抓資料紀錄'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-2441145836172414218</id><published>2021-01-29T11:38:00.003+08:00</published><updated>2021-01-29T11:38:35.203+08:00</updated><title type='text'>tmux資源收集</title><content type='html'>&lt;p&gt;https://larrylu.blog/tmux-33a24e595fbc&lt;br /&gt;基本介紹&lt;/p&gt;&lt;p&gt;https://github.com/gpakosz/.tmux&lt;br /&gt;把介面弄得很漂亮&lt;/p&gt;&lt;p&gt;https://github.com/rothgar/awesome-tmux&lt;br /&gt;一堆awesome&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/2441145836172414218/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2021/01/tmux.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2441145836172414218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2441145836172414218'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2021/01/tmux.html' title='tmux資源收集'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-4602227327659112429</id><published>2020-12-14T15:07:00.003+08:00</published><updated>2021-01-29T11:39:30.849+08:00</updated><title type='text'>用python的regular expression做文字取代</title><content type='html'>&lt;p&gt;&lt;a href=&quot;https://docs.python.org/3/library/re.html#re.sub&quot; target=&quot;_blank&quot;&gt;https://docs.python.org/3/library/re.html#re.sub&lt;/a&gt;&lt;/p&gt;&lt;p&gt;把 \ 之前的文字全部刪除&lt;/p&gt;&lt;p&gt;re.sub(r&#39;^\S* \\ &#39;, &#39;&#39;,the_string)&lt;/p&gt;&lt;p&gt;在單引號之前的r但表單引號裡面的字串是regular expression&lt;/p&gt;&lt;p&gt;^ 是match字串的開頭&lt;/p&gt;&lt;p&gt;\S是match非空白的字元&lt;/p&gt;&lt;p&gt;*是只match前面的東西(\S)0到任意個&lt;/p&gt;&lt;p&gt;\\前面的\是跳脫字元，用來跳脫後面的字元\，後面的\被跳脫後就是指\本身了，用來match \。若沒跳脫的話(如前面的\)就會發揮他在reqular expression的作用(跳脫後面的字元)&lt;/p&gt;&lt;p&gt;----------&lt;/p&gt;&lt;p&gt;*&lt;/p&gt;&lt;p&gt;Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many repetitions as are possible. ab* will match ‘a’, ‘ab’, or ‘a’ followed by any number of ‘b’s.&lt;/p&gt;&lt;dt style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Lucida Grande&amp;quot;, Arial, sans-serif; font-size: 16px;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot; style=&quot;background-color: #ecf0f3; border-radius: 3px; font-family: monospace, sans-serif; font-size: 15.44px; padding: 0px 1px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;\S&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;&lt;dd style=&quot;background-color: white; color: #222222; font-family: &amp;quot;Lucida Grande&amp;quot;, Arial, sans-serif; font-size: 16px; hyphens: auto; line-height: 20.8px; margin-bottom: 10px; margin-left: 30px; margin-top: 3px; text-align: justify;&quot;&gt;&lt;p style=&quot;hyphens: auto; line-height: 22.4px; margin-top: 0px;&quot;&gt;Matches any character which is not a whitespace character. This is the opposite of&amp;nbsp;&lt;code class=&quot;docutils literal notranslate&quot; style=&quot;background-color: #ecf0f3; border-radius: 3px; font-family: monospace, sans-serif; font-size: 15.44px; padding: 0px 1px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;\s&lt;/span&gt;&lt;/code&gt;. If the&amp;nbsp;&lt;a class=&quot;reference internal&quot; href=&quot;https://docs.python.org/3/library/re.html#re.ASCII&quot; style=&quot;color: #0072aa; text-decoration-line: none;&quot; title=&quot;re.ASCII&quot;&gt;&lt;code class=&quot;xref py py-const docutils literal notranslate&quot; style=&quot;background-color: transparent; border-radius: 3px; font-family: monospace, sans-serif; font-size: 15.44px; padding: 0px 1px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;ASCII&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&amp;nbsp;flag is used this becomes the equivalent of&amp;nbsp;&lt;code class=&quot;docutils literal notranslate&quot; style=&quot;background-color: #ecf0f3; border-radius: 3px; font-family: monospace, sans-serif; font-size: 15.44px; padding: 0px 1px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;[^&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;\t\n\r\f\v]&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/dd&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/4602227327659112429/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2020/12/pythonregular-expression.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4602227327659112429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4602227327659112429'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2020/12/pythonregular-expression.html' title='用python的regular expression做文字取代'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-8690780444447614754</id><published>2019-10-23T13:41:00.000+08:00</published><updated>2020-01-23T15:14:32.725+08:00</updated><title type='text'>Gatsby製作Blog</title><content type='html'>&lt;a href=&quot;https://www.gatsbyjs.org/docs/adding-a-list-of-markdown-blog-posts/&quot;&gt;https://www.gatsbyjs.org/docs/adding-a-list-of-markdown-blog-posts/&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://codinghero.netlify.com/&quot; target=&quot;_blank&quot;&gt;https://codinghero.netlify.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/8690780444447614754/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/10/gatsbyblog.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8690780444447614754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8690780444447614754'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/10/gatsbyblog.html' title='Gatsby製作Blog'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-1513813619488291421</id><published>2019-10-22T20:48:00.000+08:00</published><updated>2019-10-22T20:48:00.522+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bash"/><title type='text'>定時排程刪除超過一定天數的檔案</title><content type='html'>&lt;a href=&quot;https://softwareengineering.stackexchange.com/questions/149824/automatically-delete-files-after-they-expire&quot;&gt;https://softwareengineering.stackexchange.com/questions/149824/automatically-delete-files-after-they-expire&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://superuser.com/questions/1072679/bash-what-does-means&quot;&gt;https://superuser.com/questions/1072679/bash-what-does-means&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://linux.vbird.org/linux_basic/0430cron.php&quot;&gt;http://linux.vbird.org/linux_basic/0430cron.php&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eff0f1; color: #242729; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;menlo&amp;quot; , &amp;quot;monaco&amp;quot; , &amp;quot;lucida console&amp;quot; , &amp;quot;liberation mono&amp;quot; , &amp;quot;dejavu sans mono&amp;quot; , &amp;quot;bitstream vera sans mono&amp;quot; , &amp;quot;courier new&amp;quot; , monospace , sans-serif; font-size: 13px; white-space: pre-wrap;&quot;&gt;find $search_path -atime +3 -exec rm {} \;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
加到crontab裡面&lt;br /&gt;
# crontab -e&lt;br /&gt;
&lt;br /&gt;
{}的意思就是find輸出的結果會帶到rm的參數，\;是確保command結束符號，可用+取代</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/1513813619488291421/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/10/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1513813619488291421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1513813619488291421'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/10/blog-post.html' title='定時排程刪除超過一定天數的檔案'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-5805097024569010303</id><published>2019-07-24T11:41:00.000+08:00</published><updated>2019-07-24T13:22:20.339+08:00</updated><title type='text'>pyenv-win 安裝與移除</title><content type='html'>&lt;a href=&quot;https://github.com/pyenv-win/pyenv-win&quot; target=&quot;_blank&quot;&gt;https://github.com/pyenv-win/pyenv-win&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
1. Install&lt;br /&gt;
&lt;code&gt;pip install pyenv-win --target %USERPROFILE%/.pyenv&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
&lt;code&gt;2. Add following to PATH enviroment variable&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;code&gt;%USERPROFILE%\.pyenv\pyenv-win\bin;%USERPROFILE%\.pyenv\pyenv-win\shims;&lt;/code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;3. Add installed path in file easy_install.pth to site-packages folder(ex: C:\Users\Jack_Lin\AppData\Local\Programs\Python\Python37-32\Lib\site-packages).&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;Need to add absolute path, ex:&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;C:\Users\Jack_Lin\.pyenv in file easy_install.pth&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;4. pip list to check pyenv-win is installed and recognize by pip&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
&lt;code&gt;5. upgrade&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;pip install --upgrade pyenv-win&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;6. uninstall&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;pip uninstall pyenv-win&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/5805097024569010303/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/07/pyenv-win.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5805097024569010303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5805097024569010303'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/07/pyenv-win.html' title='pyenv-win 安裝與移除'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-7542705071450966588</id><published>2019-06-14T12:25:00.001+08:00</published><updated>2019-06-14T12:27:51.455+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><title type='text'>如何push本地branch並覆蓋remote branch</title><content type='html'>&lt;br /&gt;
git push -f --set-upstream origin master&lt;br /&gt;
&lt;code style=&quot;background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 16.2px; padding: 2px 4px;&quot;&gt;git push -f&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #303233; font-family: Lato, &amp;quot;PingFang TC&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, 微軟正黑體, 新細明體, Arial, sans-serif; font-size: 18px;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 16.2px; padding: 2px 4px;&quot;&gt;要小心使用&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/7542705071450966588/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/06/pushbranchremote-branch.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/7542705071450966588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/7542705071450966588'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/06/pushbranchremote-branch.html' title='如何push本地branch並覆蓋remote branch'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-1820848934473729980</id><published>2019-05-20T18:40:00.000+08:00</published><updated>2019-05-20T18:40:03.654+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><title type='text'>Scrapy學習筆記</title><content type='html'>若要整合Django和Scrapy，可利用&lt;a href=&quot;https://github.com/scrapy-plugins/scrapy-djangoitem&quot; target=&quot;_blank&quot;&gt;DjangoItem&lt;/a&gt;，可節省定義Item的部分，讓Scrapy的Item定義自動去參照Django model，也可在Item增加欄位。&lt;br /&gt;
&lt;br /&gt;
ItemLoader的部分，預設add_value後，postprocessor都會以list為最後輸出結果，可更感post processor為TakeFirst。&lt;br /&gt;
&lt;br /&gt;
在Pipeline裡，若應用到DjangoItem，要先save後，在以Django model來操作 Foreign Key或是ManyToManyField部分。DjangoItem無法直接取得Django model內容。DjangoItem只是取去參考Django model，省去寫 field_xxx = scrapy.Field()而已。</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/1820848934473729980/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/05/scrapy.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1820848934473729980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1820848934473729980'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/05/scrapy.html' title='Scrapy學習筆記'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-5266460251177280909</id><published>2019-04-24T18:22:00.000+08:00</published><updated>2019-04-24T18:22:10.277+08:00</updated><title type='text'>pandas Dataframe操作</title><content type='html'>import pandas as pd&lt;br /&gt;
df = pd.read_excel(&#39;b.xlsx&#39;, &#39;Acceptance&#39;)&lt;br /&gt;
df[df[&#39;Config 3&#39;].notna()]&lt;br /&gt;
&lt;br /&gt;
裡面的df[&#39;Config 3&#39;].notna()是filter的方式，結果是列出所有Config13欄位不是na的 rows&lt;br /&gt;
&lt;br /&gt;
Pandas的Series是縱向的，例如某個Column的值的列表&lt;br /&gt;
&lt;br /&gt;
pandas兩個主要的data structure&lt;br /&gt;
DataFrame和Series&lt;br /&gt;
DataFrame就是Series的容器&lt;br /&gt;
Series就是純量的容器&lt;br /&gt;
&lt;h3 style=&quot;background-color: #d8dee3; color: #212224; font-family: Arial, sans-serif; font-size: 17.28px; font-weight: normal; margin: 30px 0px 10px; padding: 5px 0px 5px 10px; text-shadow: white 0px 1px 0px;&quot;&gt;
Indexing / Selection&lt;a class=&quot;headerlink&quot; href=&quot;https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#indexing-selection&quot; style=&quot;color: #c60f0f; font-size: 0.8em; padding: 0px 4px; text-decoration-line: none; visibility: hidden;&quot; title=&quot;Permalink to this headline&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;div style=&quot;background-color: white; color: #3e4349; font-family: Arial, sans-serif; font-size: 14.4px; line-height: 1.5em;&quot;&gt;
The basics of indexing are as follows:&lt;/div&gt;
&lt;table border=&quot;1&quot; class=&quot;colwidths-given docutils&quot; style=&quot;background-color: white; border-collapse: collapse; border: 0px; color: #3e4349; font-family: Arial, sans-serif; font-size: 14.4px;&quot;&gt;&lt;colgroup&gt;&lt;col width=&quot;50%&quot;&gt;&lt;/col&gt;&lt;col width=&quot;33%&quot;&gt;&lt;/col&gt;&lt;col width=&quot;17%&quot;&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;thead style=&quot;vertical-align: bottom;&quot; valign=&quot;bottom&quot;&gt;
&lt;tr class=&quot;row-odd&quot; style=&quot;border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;th class=&quot;head&quot; style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; text-align: left; vertical-align: middle;&quot;&gt;Operation&lt;/th&gt;&lt;th class=&quot;head&quot; style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; text-align: left; vertical-align: middle;&quot;&gt;Syntax&lt;/th&gt;&lt;th class=&quot;head&quot; style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; text-align: left; vertical-align: middle;&quot;&gt;Result&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;tbody valign=&quot;top&quot;&gt;
&lt;tr class=&quot;row-even&quot; style=&quot;background: rgb(245, 245, 245); border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Select column&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;df[col]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Series&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-odd&quot; style=&quot;border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Select row by label&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;df.loc[label]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Series&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-even&quot; style=&quot;background: rgb(245, 245, 245); border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Select row by integer location&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;df.iloc[loc]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Series&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-odd&quot; style=&quot;border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Slice rows&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;df[5:10]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;DataFrame&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;row-even&quot; style=&quot;background: rgb(245, 245, 245); border: none; line-height: normal; max-width: none; padding: 0.5em; vertical-align: middle;&quot;&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;Select rows by boolean vector&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;hyphens: none;&quot;&gt;df[bool_vec]&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: initial; border-top-style: initial; border-width: 0px 0px 1px; line-height: normal; max-width: none; padding: 1px 8px 1px 5px; vertical-align: middle;&quot;&gt;DataFrame&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;div&gt;
如果要一個row一個row去做動作&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas&quot;&gt;https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
df.iterrows()&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/5266460251177280909/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/04/pandas-dataframe.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5266460251177280909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5266460251177280909'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/04/pandas-dataframe.html' title='pandas Dataframe操作'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-5604171509498912219</id><published>2019-03-26T10:23:00.002+08:00</published><updated>2019-03-26T10:23:30.089+08:00</updated><title type='text'>inotify-tools監測資料夾</title><content type='html'>&lt;a href=&quot;https://www.howtogeek.com/405468/how-to-perform-a-task-when-a-new-file-is-added-to-a-directory-in-linux/amp/&quot; target=&quot;_blank&quot;&gt;https://www.howtogeek.com/405468/how-to-perform-a-task-when-a-new-file-is-added-to-a-directory-in-linux/amp/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/5604171509498912219/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/03/inotify-tools.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5604171509498912219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5604171509498912219'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/03/inotify-tools.html' title='inotify-tools監測資料夾'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-466176126485630398</id><published>2019-03-07T16:25:00.003+08:00</published><updated>2019-03-07T16:25:58.124+08:00</updated><title type='text'>Delopy Django project on Ubuntu 1804 with mod_wsgi</title><content type='html'>&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;1. Install apache2 &amp;amp; postgresql&lt;/span&gt;&lt;br style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;2. Install mod_wsgi&lt;/span&gt;&lt;br style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;# sudo apt install libapache2-mod-wsgi-py3&lt;/span&gt;&lt;br style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;3. Create a Python3 virtualenv&lt;/span&gt;&lt;br style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;# mkvirtualenv -p $(which python3) django &amp;amp; psycopg2-binary&lt;/span&gt;&lt;br style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;(django)# pip install django&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;(django)# pip install psycopg2-binary&lt;/span&gt;&lt;br /&gt;
4. Enter into project folder. /home/jack/Documents/Projects/myproject&lt;br /&gt;
5. Install Requirement python package&lt;br /&gt;
(django) # pip install -r requirements.txt&lt;br style=&quot;background-color: #fff9ee;&quot; /&gt;&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;6. Note that the wsgi.py is put on /home/jack/Documents/Projects/myproject/myproject&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, &amp;quot;Palatino Linotype&amp;quot;, Palatino, serif; font-size: 15.4px;&quot;&gt;7. Edit settings.py in ./myproject&lt;/span&gt;&lt;br /&gt;
Add ALLOWED_HOSTS = [&#39;*&#39;,]&lt;br /&gt;
(This is risky)&lt;br /&gt;
Add STATIC_ROOT = &#39;/home/jack/Documents/Projects/myproject/static&#39;&lt;br /&gt;
8. Setup Postgresql database correctly &amp;amp; create a database in it.&lt;br /&gt;
9. Edit settings.py to meet the database you want to use.&lt;br /&gt;
10. Database Migrate &amp;amp; collectstatic&lt;br /&gt;
(django) # python manage.py migrate&lt;br /&gt;
(django) # python manage.py collectstatic&lt;br /&gt;
11. create a new conf in /etc/apache2/site-available myproject.conf with sudo&lt;br /&gt;
&lt;virtualhost&gt;&lt;/virtualhost&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ServerName myproject&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alias /robots.txt /home/jack/Documents/Projects/myproject/static/static/robots.txt&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alias /favicon.ico /home/jack/Documents/Projects/myproject/static/favicon.ico&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alias /static/ /home/jack/Documents/Projects/myproject/static/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;directory home=&quot;&quot; jack=&quot;&quot; myproject=&quot;&quot; ocuments=&quot;&quot; rojects=&quot;&quot; static=&quot;&quot;&gt;&lt;/directory&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Require all granted&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; WSGIDaemonProcess django python-home=/home/jack/.virtualenvs/django/ python-path=/home/jack/Documents/Projects/myproject/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WSGIScriptAlias / /home/jack/Documents/Projects/myproject/myproject/wsgi.py&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WSGIProcessGroup django&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;directory home=&quot;&quot; jack=&quot;&quot; myproject=&quot;&quot; ocuments=&quot;&quot; rojects=&quot;&quot;&gt;&lt;/directory&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;files wsgi.py=&quot;&quot;&gt;&lt;/files&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Require all granted&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
12. Edit /etc/apache2/ports.conf, Add a line&lt;/div&gt;
&lt;div&gt;
Listen 4002&lt;/div&gt;
&lt;div&gt;
13. Enable the site &amp;amp; reload&lt;/div&gt;
&lt;div&gt;
# sudo a2ensite myproject&lt;/div&gt;
&lt;div&gt;
# sudo systemctl reload apache2&lt;/div&gt;
&lt;div&gt;
14. Allow port 4002 in Firewall&lt;/div&gt;
&lt;div&gt;
# sudo ufw allow 4002&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
&lt;a href=&quot;https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/&quot; target=&quot;_blank&quot;&gt;https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/&quot; target=&quot;_blank&quot;&gt;https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/466176126485630398/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2019/03/delopy-django-project-on-ubuntu-1804.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/466176126485630398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/466176126485630398'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2019/03/delopy-django-project-on-ubuntu-1804.html' title='Delopy Django project on Ubuntu 1804 with mod_wsgi'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-4109284843187988343</id><published>2018-10-22T14:29:00.003+08:00</published><updated>2018-10-22T14:29:36.963+08:00</updated><title type='text'>TestLink setup on CentOS 7</title><content type='html'>#Install PostgreSQL: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-centos-7&lt;br /&gt;# sudo yum install postgresql-server postgresql-contrib&lt;br /&gt;# sudo postgresql-setup initdb&lt;br /&gt;# sudo systemctl start postgresql&lt;br /&gt;# sudo systemctl enable postgresql&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://dotblogs.com.tw/jovepaterlab/2017/04/17/222958&quot; target=&quot;_blank&quot;&gt;https://dotblogs.com.tw/jovepaterlab/2017/04/17/222958&lt;/a&gt;&lt;br /&gt;[root@localhost peter]# su - postgres&lt;br /&gt;-bash-4.2$ psql -U postgres&lt;br /&gt;psql (9.6.2)&lt;br /&gt;Type &quot;help&quot; for help.&lt;br /&gt;&lt;br /&gt;postgres=# ALTER USER postgres WITH PASSWORD &#39;password&#39;&lt;br /&gt;postgres-# \q&lt;br /&gt;-bash-4.2$ exit&lt;br /&gt;logout&lt;br /&gt;&lt;br /&gt;Edit /var/lib/pgsql/data/pg_hba.conf&lt;br /&gt;local&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; md5&lt;br /&gt;host&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1/32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; md5&lt;br /&gt;host&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ::1/128&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; md5&lt;br /&gt;&lt;span id=&quot;goog_216088403&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;https://www.tecmint.com/install-php-7-in-centos-7/&quot; target=&quot;_blank&quot;&gt;https://www.tecmint.com/install-php-7-in-centos-7/&lt;/a&gt;&lt;span id=&quot;goog_216088404&quot;&gt;&lt;/span&gt;&lt;br /&gt;# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm&lt;br /&gt;# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm&lt;br /&gt;# yum-config-manager --enable remi-php72&lt;br /&gt;# yum install php php-mcrypt php-cli php-gd php-curl php-pgsql php-ldap php-zip php-fileinfo &lt;br /&gt;# php -v&lt;br /&gt;&lt;br /&gt;Enable Apache2&lt;br /&gt;# systemctl start httpd&lt;br /&gt;# systemctl enable httpd&lt;br /&gt;&lt;br /&gt;Edit /etc/php.ini&lt;br /&gt;session.gc_maxlifetime = 2400&lt;br /&gt;max_input_vars = 3000&lt;br /&gt;memory_limit = 256M&lt;br /&gt;upload_max_filesize = 20M&lt;br /&gt;max_execution_time = 120&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set MySQL password&lt;br /&gt;mysqladmin -u root password password&lt;br /&gt;&lt;br /&gt;# Copy Testlink source code&lt;br /&gt;# wget -e use_proxy=yes -e https_proxy=jack_lin3.compal.com:3128 https://github.com/TestLinkOpenSourceTRMS/testlink-code/archive/testlink_1_9.zip&lt;br /&gt;&amp;nbsp;&amp;nbsp; 47&amp;nbsp; unzip&lt;br /&gt;# unzip testlink_1_9.zip -d /var/www/html/&lt;br /&gt;# cd /var/www/html/&lt;br /&gt;# ls&lt;br /&gt;# mv testlink-code-testlink_1_9/ testlink/&lt;br /&gt;# ls&lt;br /&gt;# chown -R apache:apache testlink&lt;br /&gt;mkdir&amp;nbsp; /var/testlink&lt;br /&gt;mkdir /var/testlink/logs&lt;br /&gt;mkdir /var/testlink/upload_area&lt;br /&gt;chown apache:apache /var/testlink/logs&lt;br /&gt;chown apache:apache /var/testlink/upload_area&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Check firewall setting&lt;br /&gt;&lt;a href=&quot;https://linuxhint.com/list_open_ports_firewalld/&quot; target=&quot;_blank&quot;&gt;https://linuxhint.com/list_open_ports_firewalld/&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7&quot; target=&quot;_blank&quot;&gt;https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Add http service in firewall&lt;br /&gt;# sudo firewall-cmd --zone=public --permanent --add-service=http&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://stackoverflow.com/questions/12416879/testlink-installation-failed-checking-if-var-testlink-logs-directory-exists&quot;&gt;link1&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://blog.csdn.net/sapphire_sky/article/details/51088856&quot; target=&quot;_blank&quot;&gt;link2&lt;/a&gt;&lt;br /&gt;# sudo chcon -Rv --type httpd_sys_rw_content_t /var/www/html/testlink/gui/templates_c&lt;br /&gt;##### chcon -Rv --type httpd_sys_rw_content_t /var/www/html/testlink&lt;br /&gt;https://tripal.info/tutorials/v3.x/installation/server-setup/centos7&lt;br /&gt;# setsebool -P httpd_can_network_connect_db on&lt;br /&gt;&lt;br /&gt;Remove line 872~879&lt;br /&gt;/install/sql/postgres/testlink_create_tables.sql&lt;br /&gt;&lt;a href=&quot;https://github.com/TestLinkOpenSourceTRMS/testlink-code/blob/testlink_1_9/install&quot; target=&quot;_blank&quot;&gt;https://github.com/TestLinkOpenSourceTRMS/testlink-code/blob/testlink_1_9/install&lt;/a&gt;/sql/postgres/testlink_create_tables.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Open http://&lt;ip&gt;/testlink, Follow steps to install.&lt;br /&gt;&lt;br /&gt;YOU NEED TO RUN MANUALLY Following Script on your DB CLIENT Application&lt;br /&gt;&lt;br /&gt;/var/www/html/testlink/install/sql/postgres/testlink_create_udf0.sql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;YOUR ATTENTION PLEASE:&lt;br /&gt;To have a fully functional installation You need to configure mail server settings, following this steps&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; copy from config.inc.php, [SMTP] Section into custom_config.inc.php.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; complete correct data regarding email addresses and mail server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Installation was successful!&lt;br /&gt;You can now log in to Testlink (using login name:admin / password:admin - Please Click Me!).&lt;br /&gt;&lt;br /&gt;&lt;/ip&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/4109284843187988343/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/10/testlink-setup-on-centos-7.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4109284843187988343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/4109284843187988343'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/10/testlink-setup-on-centos-7.html' title='TestLink setup on CentOS 7'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-6090332476174936709</id><published>2018-10-18T14:19:00.002+08:00</published><updated>2018-10-18T14:36:01.462+08:00</updated><title type='text'>Deploying Flask App with mod_wsgi (Python3) in Ubuntu 1804</title><content type='html'>1. Install apache2&lt;br /&gt;
2. Install mod_wsgi&lt;br /&gt;
# sudo apt install libapache2-mod-wsgi-py3&lt;br /&gt;
3. Create a Python3 virtualenv with Flask installed&lt;br /&gt;
# mkvirtualenv -p $(which python3) flask&lt;br /&gt;
(flask)# pip install flask&lt;br /&gt;
4. Create a .wsgi file for project (put in project folder)&lt;br /&gt;
newsite.wsgi:&lt;br /&gt;
&lt;br /&gt;
activate_this = &#39;/home/jack/.virtualenvs/flask/bin/activate_this.py&#39;&lt;br /&gt;
with open(activate_this) as file_:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; exec(file_.read(), dict(__file__=activate_this))&lt;br /&gt;
import sys&lt;br /&gt;
sys.path.insert(0, &#39;/home/jack/Documents/Projects/newsite&#39;)&lt;br /&gt;
from app import app as application&lt;br /&gt;
&lt;br /&gt;
5. Open Apache2 ports. Edit file /etc/apache2/ports.conf&lt;br /&gt;
&lt;br /&gt;
Listen 4002&lt;br /&gt;
&lt;br /&gt;
6. Create a file for new site in /etc/apache2/sites-available&lt;br /&gt;
newsite.conf:&lt;br /&gt;
&lt;br /&gt;
&lt;virtualhost&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerName newsite&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSGIDaemonProcess newsite user=jack group=jack threads=5&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSGIScriptAlias / /home/jack/Documents/Projects/newsite/newsite.wsgi&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;directory flaskr=&quot;&quot; home=&quot;&quot; jack=&quot;&quot; ocuments=&quot;&quot; rojects=&quot;&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSGIProcessGroup newsite&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSGIApplicationGroup %{GLOBAL}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Require all granted&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/directory&gt;&lt;/virtualhost&gt;&lt;br /&gt;
&lt;br /&gt;
7. Enable the newsite&lt;br /&gt;
# sudo a2ensite newsite&lt;br /&gt;
(a2dissite for disable)&lt;br /&gt;
&lt;br /&gt;
8. Reload the Apache2&lt;br /&gt;
# sudo systemctl reload apache2&lt;br /&gt;
&lt;br /&gt;
9. Allow port 4002 by ufw&lt;br /&gt;
# sudo ufw allow 4002&lt;br /&gt;
(sudo ufw delete allow 4002) to disable&lt;br /&gt;
&lt;br /&gt;
10. Open broswer to browse http://&lt;ip&gt;:4002&lt;/ip&gt;&lt;br /&gt;
&lt;br /&gt;
Note1. Apache2 error log is in /var/log/apache2/error.log&lt;br /&gt;
&lt;br /&gt;
Note2. If you are using open() in app.py, need to instead to app.open_resource() to prevent FileNotFoundException&lt;br /&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
http://flask.pocoo.org/docs/1.0/deploying/mod_wsgi/&lt;br /&gt;
http://flask.pocoo.org/docs/0.12/api/#flask.Flask.open_resource &lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/6090332476174936709/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/10/deploying-flask-app-with-modwsgi.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/6090332476174936709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/6090332476174936709'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/10/deploying-flask-app-with-modwsgi.html' title='Deploying Flask App with mod_wsgi (Python3) in Ubuntu 1804'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-8717335331341498349</id><published>2018-08-16T17:04:00.003+08:00</published><updated>2018-08-16T17:04:54.526+08:00</updated><title type='text'>iSCSI target setup (Ubuntu)</title><content type='html'>&lt;a href=&quot;https://www.server-world.info/en/note?os=Ubuntu_18.04&amp;amp;p=iscsi&amp;amp;f=1&quot; target=&quot;_blank&quot;&gt;https://www.server-world.info/en/note?os=Ubuntu_18.04&amp;amp;p=iscsi&amp;amp;f=1&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://wiki.archlinux.org/index.php/ISCSI/LIO&quot; target=&quot;_blank&quot;&gt;https://wiki.archlinux.org/index.php/ISCSI/LIO&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;block&quot; style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px 0px 21px; padding: 0px;&quot;&gt;
&lt;div class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;
# create a directory&lt;/div&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;root@dlp:~#&amp;nbsp;&lt;div class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;
&lt;a href=&quot;https://www.server-world.info/en/command/html/mkdir.html&quot; style=&quot;color: yellow; margin: 0px; padding: 0px; text-decoration-line: none;&quot;&gt;mkdir&lt;/a&gt;&amp;nbsp;/var/lib/iscsi_disks&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;color2&quot; style=&quot;background-color: #191919; color: lightpink; display: inline; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot;&gt;
# enter the admin console&lt;/div&gt;
&lt;br style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot; /&gt;&lt;span style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700;&quot;&gt;root@dlp:~#&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;color1&quot; style=&quot;background-color: #191919; color: palegreen; display: inline; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot;&gt;
targetcli&amp;nbsp;&lt;/div&gt;
&lt;br style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot; /&gt;
&lt;pre style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; letter-spacing: 0px; padding: 0px; white-space: pre-wrap; word-break: break-all;&quot;&gt;targetcli shell version 2.1.fb43
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type &#39;help&#39;.

/&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;cd backstores/fileio &lt;/span&gt;

&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# create a disk-image with the name &quot;disk01&quot; on /var/lib/iscsi_disks/disk01.img with 10G&lt;/span&gt;
/backstores/fileio&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;create disk01 /var/lib/iscsi_disks/disk01.img 10G &lt;/span&gt;
Created fileio disk01 with size 10737418240
/backstores/fileio&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;cd /iscsi &lt;/span&gt;

&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# create a target&lt;/span&gt;
&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# naming rule : [ iqn.(year)-(month).(reverse of domain name):(any name you like) ]&lt;/span&gt;
/iscsi&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;create iqn.2018-05.world.srv:dlp.target01 &lt;/span&gt;
Created target iqn.2018-05.world.srv:dlp.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;cd iqn.2018-05.world.srv:dlp.target01/tpg1/luns &lt;/span&gt;

&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# set LUN&lt;/span&gt;
/iscsi/iqn.20...t01/tpg1/luns&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;create /backstores/fileio/disk01 &lt;/span&gt;
Created LUN 0.
/iscsi/iqn.20...t01/tpg1/luns&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;cd ../acls &lt;/span&gt;

&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# set ACL (it&#39;s the IQN of an initiator you permit to connect)&lt;/span&gt;
/iscsi/iqn.20...t01/tpg1/acls&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;create iqn.2018-05.world.srv:www.initiator01 &lt;/span&gt;
Created Node ACL for iqn.2018-05.world.srv:www.initiator01
Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/acls&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;cd iqn.2018-05.world.srv:www.initiator01 &lt;/span&gt;

&lt;span class=&quot;color2&quot; style=&quot;color: lightpink; display: inline; margin: 0px; padding: 0px;&quot;&gt;# set UserID for authentication&lt;/span&gt;
/iscsi/iqn.20...w.initiator01&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;set auth userid=username &lt;/span&gt;
Parameter userid is now &#39;username&#39;.
/iscsi/iqn.20...w.initiator01&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;set auth password=password &lt;/span&gt;
Parameter password is now &#39;password&#39;.
/iscsi/iqn.20...w.initiator01&amp;gt; &lt;span class=&quot;color1&quot; style=&quot;color: palegreen; display: inline; margin: 0px; padding: 0px;&quot;&gt;exit &lt;/span&gt;
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/rtslib-fb-target/backup.
Configuration saved to /etc/rtslib-fb-target/saveconfig.json

&lt;/pre&gt;
&lt;div class=&quot;color2&quot; style=&quot;background-color: #191919; color: lightpink; display: inline; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot;&gt;
# after configuration above, the target enters in listening like follows&lt;/div&gt;
&lt;br style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot; /&gt;&lt;span style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700;&quot;&gt;root@dlp:~#&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;color1&quot; style=&quot;background-color: #191919; color: palegreen; display: inline; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot;&gt;
&lt;a href=&quot;https://www.server-world.info/en/command/html/ss.html&quot; style=&quot;color: yellow; margin: 0px; padding: 0px; text-decoration-line: none;&quot;&gt;ss&lt;/a&gt;&amp;nbsp;-napt | grep 3260&amp;nbsp;&lt;/div&gt;
&lt;br style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; margin: 0px; padding: 0px;&quot; /&gt;
&lt;pre style=&quot;background-color: #191919; color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, Monaco, monospace; font-size: 14px; font-weight: 700; letter-spacing: 0px; padding: 0px; white-space: pre-wrap; word-break: break-all;&quot;&gt;LISTEN   0         256                 0.0.0.0:3260             0.0.0.0:* &lt;/pre&gt;
&lt;br /&gt;
&lt;h4 style=&quot;background: none rgb(255, 255, 255); border-bottom: 0px; color: #222222; font-family: sans-serif; font-size: 14px; line-height: 1.6; margin: 0.3em 0px 0px; overflow: hidden; padding-bottom: 0px; padding-top: 0.5em;&quot;&gt;
&lt;span class=&quot;mw-headline&quot; id=&quot;Disable_Authentication&quot;&gt;Disable Authentication&lt;/span&gt;&lt;/h4&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: sans-serif; font-size: 14px; line-height: inherit; margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;
Navigate targetcli to your target (i.e. /iscsi/iqn.../tpg1) and:&lt;/div&gt;
&lt;pre style=&quot;background-color: #ebf1f5; border: 1px solid rgb(187, 204, 221); color: #222222; line-height: 1.3em; overflow: auto; padding: 1em; white-space: pre-wrap !important; word-break: break-all;&quot;&gt;.../tpg1&amp;gt; set attribute authentication=0&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/8717335331341498349/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/08/iscsi-target-setup-ubuntu.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8717335331341498349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8717335331341498349'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/08/iscsi-target-setup-ubuntu.html' title='iSCSI target setup (Ubuntu)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-5970275352596232654</id><published>2018-07-12T13:09:00.001+08:00</published><updated>2018-07-12T13:09:40.027+08:00</updated><title type='text'>Samba on Ubuntu</title><content type='html'>&lt;a href=&quot;https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-18-04-bionic-beaver-linux&quot; target=&quot;_blank&quot;&gt;Ref&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
# apt install samba&lt;br /&gt;
# edit /etc/samba/smb.conf&lt;br /&gt;
create folder&lt;br /&gt;
# mkdir /var/samba&lt;br /&gt;
# chmod 777 /var/samba&lt;br /&gt;
&lt;br /&gt;
Add this:&lt;br /&gt;
[public]&lt;br /&gt;
&amp;nbsp; comment = public anonymous access&lt;br /&gt;
&amp;nbsp; path = /var/samba/&lt;br /&gt;
&amp;nbsp; browsable =yes&lt;br /&gt;
&amp;nbsp; create mask = 0666&lt;br /&gt;
&amp;nbsp; directory mask = 0777&lt;br /&gt;
&amp;nbsp; writable = yes&lt;br /&gt;
&amp;nbsp; guest ok = yes&lt;br /&gt;
&lt;br /&gt;
# systemctl restart smbd</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/5970275352596232654/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/07/samba-on-ubuntu.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5970275352596232654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5970275352596232654'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/07/samba-on-ubuntu.html' title='Samba on Ubuntu'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-3219702491328833221</id><published>2018-07-10T14:58:00.002+08:00</published><updated>2018-07-12T11:16:18.089+08:00</updated><title type='text'>HTTPS on Ubuntu 1804 (use default-ssl.conf)</title><content type='html'># sudo -i&lt;br /&gt;
# apt install apache2&lt;br /&gt;
# a2enmod ssl&lt;br /&gt;
# a2ensite default-ssl.conf&lt;br /&gt;
# systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
config files in /etc/apache2/sites-available&lt;br /&gt;
log files in /var/log/apache2/&lt;br /&gt;
&lt;br /&gt;
use browser to browse https://&lt;the-server-ip&gt;&lt;/the-server-ip&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/3219702491328833221/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/07/https-on-ubuntu-1804-use-default-sslconf.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/3219702491328833221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/3219702491328833221'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/07/https-on-ubuntu-1804-use-default-sslconf.html' title='HTTPS on Ubuntu 1804 (use default-ssl.conf)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-1702527782967406555</id><published>2018-06-28T14:01:00.001+08:00</published><updated>2018-06-28T14:39:16.338+08:00</updated><title type='text'>用Flask-SQLAlchemy把Model定義獨立到models.py</title><content type='html'>&lt;a href=&quot;https://stackoverflow.com/questions/9692962/flask-sqlalchemy-import-context-issue/9695045#9695045&quot;&gt;https://stackoverflow.com/questions/9692962/flask-sqlalchemy-import-context-issue/9695045#9695045&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
models.py&lt;br /&gt;
=====&lt;br /&gt;
&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; flask_sqlalchemy &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; SQLAlchemy&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; datetime &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; datetime&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
db = SQLAlchemy()&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;User&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;db&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Model&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
    &lt;span style=&quot;color: #dcdcaa;&quot;&gt;id&lt;/span&gt; = db.Column(db.Integer, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;primary_key&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    username = db.Column(db.String(&lt;span style=&quot;color: #b5cea8;&quot;&gt;80&lt;/span&gt;), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;unique&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    email = db.Column(db.String(&lt;span style=&quot;color: #b5cea8;&quot;&gt;120&lt;/span&gt;), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;unique&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
    &lt;span style=&quot;color: #569cd6;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;__repr__&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;self&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
        &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;user span=&quot;&quot;&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;%r&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;gt;&#39;&lt;/span&gt; % &lt;span style=&quot;color: #569cd6;&quot;&gt;self&lt;/span&gt;.username&lt;/user&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Post&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;db&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Model&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
    &lt;span style=&quot;color: #dcdcaa;&quot;&gt;id&lt;/span&gt; = db.Column(db.Integer, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;primary_key&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    title = db.Column(db.String(&lt;span style=&quot;color: #b5cea8;&quot;&gt;80&lt;/span&gt;), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    body = db.Column(db.Text, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    json = db.Column(db.JSON)&lt;/div&gt;
&lt;div&gt;
    pub_date = db.Column(db.DateTime, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;,&lt;/div&gt;
&lt;div&gt;
            &lt;span style=&quot;color: #9cdcfe;&quot;&gt;default&lt;/span&gt;=datetime.utcnow)&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
    category_id = db.Column(db.Integer, db.ForeignKey(&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;category.id&#39;&lt;/span&gt;),&lt;/div&gt;
&lt;div&gt;
            &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    category = db.relationship(&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;Category&#39;&lt;/span&gt;,&lt;/div&gt;
&lt;div&gt;
            &lt;span style=&quot;color: #9cdcfe;&quot;&gt;backref&lt;/span&gt;=db.backref(&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;posts&#39;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;lazy&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;))&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
    &lt;span style=&quot;color: #569cd6;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;__repr__&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;self&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
        &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;post span=&quot;&quot;&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;%r&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;gt;&#39;&lt;/span&gt; % &lt;span style=&quot;color: #569cd6;&quot;&gt;self&lt;/span&gt;.title&lt;/post&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Category&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;db&lt;/span&gt;.&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Model&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
    &lt;span style=&quot;color: #dcdcaa;&quot;&gt;id&lt;/span&gt; = db.Column(db.Integer, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;primary_key&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;True&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
    name = db.Column(db.String(&lt;span style=&quot;color: #b5cea8;&quot;&gt;50&lt;/span&gt;), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;nullable&lt;/span&gt;=&lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;)&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
    &lt;span style=&quot;color: #569cd6;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;__repr__&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;self&lt;/span&gt;):&lt;/div&gt;
&lt;div&gt;
        &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;&lt;category span=&quot;&quot;&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;%r&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;gt;&#39;&lt;/span&gt; % &lt;span style=&quot;color: #569cd6;&quot;&gt;self&lt;/span&gt;.name&lt;/category&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
app.py&lt;br /&gt;
======&lt;br /&gt;
&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; flask &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; Flask&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #608b4e;&quot;&gt;# from flask_sqlalchemy import SQLAlchemy&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; flask_admin &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; Admin&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; flask_admin.contrib.sqla &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; ModelView&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #c586c0;&quot;&gt;from&lt;/span&gt; models &lt;span style=&quot;color: #c586c0;&quot;&gt;import&lt;/span&gt; db, User, Post, Category&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
app = Flask(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;__name__&lt;/span&gt;)&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #608b4e;&quot;&gt;#app.config[&#39;SQLALCHEMY_DATABASE_URI&#39;] = &#39;sqlite:////tmp/test.db&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
app.config[&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;SQLALCHEMY_DATABASE_URI&#39;&lt;/span&gt;] = &lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;postgresql:///jack&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
app.config[&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;SQLALCHEMY_TRACK_MODIFICATIONS&#39;&lt;/span&gt;] = &lt;span style=&quot;color: #569cd6;&quot;&gt;False&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #608b4e;&quot;&gt;# db = SQLAlchemy(app)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
db.init_app(app)&lt;/div&gt;
&lt;div&gt;
admin = Admin(app, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;flask-sql&#39;&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;template_mode&lt;/span&gt;=&lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;bootstrap3&#39;&lt;/span&gt;)&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
admin.add_view(ModelView(User, db.session))&lt;/div&gt;
&lt;div&gt;
admin.add_view(ModelView(Post, db.session))&lt;/div&gt;
&lt;div&gt;
admin.add_view(ModelView(Category, db.session))&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/1702527782967406555/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/flask-sqlalchemymodelmodelspy.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1702527782967406555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/1702527782967406555'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/flask-sqlalchemymodelmodelspy.html' title='用Flask-SQLAlchemy把Model定義獨立到models.py'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-8065136967790258425</id><published>2018-06-22T11:23:00.000+08:00</published><updated>2018-06-22T11:23:07.872+08:00</updated><title type='text'>Ubuntu install postgresql &amp; flask-sqlalchemy</title><content type='html'># sudo apt install postgresql&lt;br /&gt;
# sudo systemctl enable postgresql&lt;br /&gt;
# sudo -i -u postgres&lt;br /&gt;
# createuser --interactive&lt;br /&gt;
jack&lt;br /&gt;
y&lt;br /&gt;
Note. already have a user named jack&lt;br /&gt;
# createdb jack&lt;br /&gt;
Note. create a database named jack.&lt;br /&gt;
logout from postgres&lt;br /&gt;
#logout&lt;br /&gt;
&lt;br /&gt;
Edit the Flask app.py&lt;br /&gt;
app.config[&#39;SQLALCHEMY_DATABASE_URI&#39;] = &#39;postgresql:///jack&#39;&lt;br /&gt;
&lt;br /&gt;
You can save JSON type now&lt;br /&gt;
json = db.Column(db.JSON)</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/8065136967790258425/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/ubuntu-install-postgresql-flask.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8065136967790258425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8065136967790258425'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/ubuntu-install-postgresql-flask.html' title='Ubuntu install postgresql &amp; flask-sqlalchemy'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-5248887279539914738</id><published>2018-06-21T16:49:00.000+08:00</published><updated>2018-06-21T16:49:51.672+08:00</updated><title type='text'>遇到密碼對 可是登不進ssh</title><content type='html'>Check the log in /var/log/auth.log&lt;br /&gt;
$ grep sshd /var/log/auth.log | less&lt;br /&gt;
看到&lt;br /&gt;
sshd[2110]: User jack not allowed because shell /usr/bin/zsh does not exist&lt;br /&gt;
&lt;br /&gt;
可能是之前有安裝過zsh但是沒有移乾淨&lt;br /&gt;
下env | grep SHELL看到的確是/usr/bin/zsh&lt;br /&gt;
&lt;br /&gt;
用chsh指令改&lt;br /&gt;
$ sudo chsh -s /bin/bash jack&lt;br /&gt;
解決不能登入ssh問題&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/5248887279539914738/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/ssh.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5248887279539914738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/5248887279539914738'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/ssh.html' title='遇到密碼對 可是登不進ssh'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-311827448656968830</id><published>2018-06-21T09:53:00.000+08:00</published><updated>2018-06-21T09:53:46.929+08:00</updated><title type='text'>Robotframework 變數檔案</title><content type='html'>使用-V &lt;yaml file=&quot;&quot;&gt; 參數&lt;/yaml&gt;&lt;br /&gt;
&lt;br /&gt;
# robot -V vars.yaml a.robot&lt;br /&gt;
&lt;br /&gt;
vars.yaml內容&lt;br /&gt;
BMC_IP: 172.16.1.16&lt;br /&gt;
&lt;br /&gt;
For using &quot;Library&amp;nbsp; &amp;nbsp; Dialogs&quot;&lt;br /&gt;
apt-get install python3-tk&lt;br /&gt;
pip intall tkinter</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/311827448656968830/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/robotframework.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/311827448656968830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/311827448656968830'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/06/robotframework.html' title='Robotframework 變數檔案'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-8697523612975637117</id><published>2018-05-18T15:52:00.000+08:00</published><updated>2019-03-23T13:12:20.151+08:00</updated><title type='text'>Setup Python3 develop environment on Ubuntu Server 1804</title><content type='html'>1. Install Ubuntu Server 1804&lt;br /&gt;
2. Install pip3 &amp;amp; python3-dev&lt;br /&gt;
# sudo apt install python3-pip python3-dev&lt;br /&gt;
3. update pip&lt;br /&gt;
# python3 -m pip install -U pip&lt;br /&gt;
4. logout and login&lt;br /&gt;
5. Install virtualenvwrapper&lt;br /&gt;
# python3 -m pip install --user virtualenvwrapper&lt;br /&gt;
6. add variable in .bashrc&lt;br /&gt;
export VIRTUALENVWRAPPER_PYTHON=$(which python3)&lt;br /&gt;
7. include virtualenvwrapper in .bashrc&lt;br /&gt;
Add following in tail of .bashrc&lt;br /&gt;
# set ~/.local/bin in PATH&lt;br /&gt;
if [ -d &quot;$HOME/.local/bin&quot; ] ; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PATH=&quot;$HOME/.local/bin:$PATH&quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# virtualenvwrapper&lt;br /&gt;
source $(which virtualenvwrapper.sh)&lt;br /&gt;
8. logout &amp;amp; login again&lt;br /&gt;
9. create a virtualenv&lt;br /&gt;
# mkvirtualenv env1&lt;br /&gt;
&lt;br /&gt;
for APT proxy setting: /etc/apt/apt.conf&lt;br /&gt;
Acquire::http::Proxy &quot;http://yourproxyaddress:proxyport&quot;;&lt;br /&gt;
&lt;br /&gt;
for pip proxy setting per-user: ~/.config/pip/pip.conf&lt;br /&gt;
[global]&lt;br /&gt;
proxy = http://127.0.0.1:3128&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717&quot;&gt;https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/8697523612975637117/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/05/setup-python3-develop-environment-on.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8697523612975637117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/8697523612975637117'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/05/setup-python3-develop-environment-on.html' title='Setup Python3 develop environment on Ubuntu Server 1804'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-2405575161010280741</id><published>2018-05-16T13:38:00.002+08:00</published><updated>2018-05-16T13:38:57.800+08:00</updated><title type='text'>Increase upload file size limit of TestLink</title><content type='html'>Edit /etc/php.ini file&lt;br /&gt;
&lt;br /&gt;
upload_max_filesize = 100M&lt;br /&gt;max_execution_time = 600&lt;br /&gt;
&lt;br /&gt;
Edit&lt;br /&gt;
/var/html/www/testlink/config.inc.php&lt;br /&gt;
$tlCfg-&amp;gt;import_file_max_size_bytes (config.inc.php): 8192000&lt;br /&gt;$tlCfg-&amp;gt;import_max_row (config.inc.php): 100000&lt;br /&gt;$tlCfg-&amp;gt;repository_max_filesize (config.inc.php): 8 // MB&lt;br /&gt;
&lt;br /&gt;
restart Apache&lt;br /&gt;
service apache2 restart&lt;br /&gt;
or&lt;br /&gt;
service httpd restart</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/2405575161010280741/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/05/increase-upload-file-size-limit-of.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2405575161010280741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2405575161010280741'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/05/increase-upload-file-size-limit-of.html' title='Increase upload file size limit of TestLink'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-3523741959030097407</id><published>2018-03-29T15:23:00.000+08:00</published><updated>2018-03-29T15:23:48.732+08:00</updated><title type='text'>Use mkvirtualenv of virtualenvwrapper-win to create diffenrent Python version of env</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;應用Python的virtualenv和virtualenvwrapper可方便建立Python的virtual enviroment，方便在不同的environment切換，各env有獨立的pip list和Python版本&lt;/span&gt;&lt;/div&gt;
&lt;b id=&quot;docs-internal-guid-df51a023-70a3-a3d9-8c00-a5b51abc1322&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;首先要安裝Python (Linux已有內建Python2)&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;Windows安裝完後要將PATH設定包含到C:\Python27&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;安裝pip套件 &lt;/span&gt;&lt;a href=&quot;https://pip.pypa.io/en/stable/installing/&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;-webkit-text-decoration-skip: none; background-color: transparent; color: #1155cc; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration-skip-ink: none; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;https://pip.pypa.io/en/stable/installing/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;安裝virtualenv, pip install virtualenv&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;安裝virtualenvwrapper或是virtualenvwrapper-win (Windows版)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;建立virtualenv&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;mkvirtualenv env01&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;查看pip list, pip list&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;跳出env01, deactivate&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;查看目前有多少virtualenv, workon&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;進入virtualenv env01, workon env01&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;若要建立Python3的virtualenv, 先安裝Python3&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;確認Pyhon3的python.exe位置 (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: &#39;Times New Roman&#39;; font-size: 12pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;C:\Users\Jack_Lin\AppData\Local\Programs\Python\Python35\python.exe), 若是Linux, 可用which python3指令查看&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: decimal; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;建立一Python3的virtualenv&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;ol style=&quot;margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;mkvirtualenv &lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;-p&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt; C:\Users\Jack_Lin\AppData\Local\Programs\Python\Python35\python.exe python35&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li dir=&quot;ltr&quot; style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; list-style-type: lower-alpha; text-decoration: none; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; white-space: pre;&quot;&gt;python -V&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/3523741959030097407/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/03/use-mkvirtualenv-of-virtualenvwrapper.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/3523741959030097407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/3523741959030097407'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/03/use-mkvirtualenv-of-virtualenvwrapper.html' title='Use mkvirtualenv of virtualenvwrapper-win to create diffenrent Python version of env'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-9121656775915145799</id><published>2018-02-08T19:26:00.002+08:00</published><updated>2018-02-08T19:26:38.024+08:00</updated><title type='text'>ipmitool ipmi-raw ipmiutil cmd (icmd) raw command format</title><content type='html'>ipmitool:&lt;br /&gt;
ipmitool -I lanplus -H 192.168.1.123 -U admin -P password raw 0x06 0x01&lt;br /&gt;
&lt;br /&gt;
ipmi-raw:&lt;br /&gt;
ipmi-raw -D LAN_2_0 -h 192.168.1.123 -u admin -p password 0x00 0x06 0x01&lt;br /&gt;
&lt;br /&gt;
icmd:&lt;br /&gt;
icmd -J 3 -N 192.168.1.123 -U admin -P password 00 20 18 01</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/9121656775915145799/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/02/ipmitool-ipmi-raw-ipmiutil-cmd-icmd-raw.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/9121656775915145799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/9121656775915145799'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/02/ipmitool-ipmi-raw-ipmiutil-cmd-icmd-raw.html' title='ipmitool ipmi-raw ipmiutil cmd (icmd) raw command format'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3339005215836974547.post-2205422101828165710</id><published>2018-02-08T16:41:00.002+08:00</published><updated>2018-04-16T16:15:18.574+08:00</updated><title type='text'>redfishtool on ubuntu</title><content type='html'>1. apt-get update&lt;br /&gt;
2. apt-get install python python3 python-pip&lt;br /&gt;
3. make a file /etc/pip.conf if you need proxy setting for pip&lt;br /&gt;
[list]&lt;br /&gt;
format=columns&lt;br /&gt;
[global]&lt;br /&gt;
trusted-host = pypi.python.org&lt;br /&gt;
proxy = http://127.0.0.1:3128&lt;br /&gt;
4. pip install virtualenvwrapper&lt;br /&gt;
5. login with normal user (not root)&lt;br /&gt;
6. add one line in tail of .bashrc&lt;br /&gt;
source $(which virtualenvwrapper.sh)&lt;br /&gt;
7. re-login&lt;br /&gt;
8. create a virtualenv of python3&lt;br /&gt;
mkvirtualenv -p $(which python3) redfish&lt;br /&gt;
9. pip install redfishtool&lt;br /&gt;
&lt;br /&gt;
redfishtool commands:&lt;br /&gt;
&lt;br /&gt;
redfishtool -u admin -p password -r 192.168.1.123 -S Always System&lt;br /&gt;
redfishtool -u admin -p password -r 192.168.1.123 -S Always System -a&lt;br /&gt;
redfishtool -u admin -p password -r 192.168.1.123 -S Always raw /redfish/v1/xxxx/xxxx&lt;br /&gt;
&lt;br /&gt;
======&lt;br /&gt;
For Ubuntu 17.10, before step5&lt;br /&gt;
Need to add ~/.local/bin to PATH, edit ~/.bashrc&lt;br /&gt;
# set PATH ~/.local/bin&lt;br /&gt;
if [ -d &quot;$HOME/.local/bin&quot; ] ; then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; PATH=&quot;$HOME/.local/bin:$PATH&quot;&lt;br /&gt;
fi</content><link rel='replies' type='application/atom+xml' href='http://farwill-linux.blogspot.com/feeds/2205422101828165710/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://farwill-linux.blogspot.com/2018/02/redfishtool-on-ubuntu.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2205422101828165710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3339005215836974547/posts/default/2205422101828165710'/><link rel='alternate' type='text/html' href='http://farwill-linux.blogspot.com/2018/02/redfishtool-on-ubuntu.html' title='redfishtool on ubuntu'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>