每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,歡迎關注開源日報。交流QQ群:202790710;電報群 https://t.me/OpeningSourceOrg


今日推薦開源項目:《Screenshot-to-code-in-Keras 機器學習生成前端代碼

推薦理由:

項目介紹

編程實現網頁設計的原型一直是一樣費時費力的活,工程師往往還需要快速實現並保持還原度。實現靜態網頁的活如果交由機器自動去處理既能提高效率,將工程師從繁重的勞動中解脫,又能保證還原度。Screenshot-to-code-in-Keras 這個項目就是希望通過深度學習改變前端開發。它將會加快原型設計速度,拉低開發軟體的門檻。

目前該項目致力於實現靜態原型的還原,對於網頁特效等處理還是需要人為進行干預,前端工程師還沒有要到下崗的地步啊~如果類似項目繼續發展,是否能夠做到特效自動實現,業務邏輯自動實現呢,我們拭目以待。到了那一天,前端工程師甚至可能大部分軟體工程師都要下崗了,全部代碼實現都自動化處理,雖然可能會讓工程師掉飯碗,但這又何不是每個工程師嚮往的那一天呢。

實踐

使用相關可以直接看項目 https://github.com/emilwallner/Screenshot-to-code-in-Keras 的 readme 介紹。

《Turning design mockups into code with deep learning》這篇文章將為我們介紹如何通過深度學習實現前端編程的智能化,相應的譯文可見戳我

小編抱著初學者嘗試的心態,按照相關介紹進行了實踐。小編使用的是 mac osx 環境。

首先需要安裝有 Python 2.7 和 pip

然後安裝項目依賴的一些模塊,建議以用戶許可權安裝

pip install keras --user -U
pip install tensorflow --user -U
pip install pillow --user -U
pip install h5py --user -U
pip install jupyter --user -U

然後將項目 clone 到本地,如果你不想在本地跑(因為確實很麻煩),你可以使用 floydhub.com 的相關服務,項目上有相關的介紹。

git clone https://github.com/emilwallner/Screenshot-to-code-in-Keras
cd Screenshot-to-code-in-Keras/local
jupyter notebook

啟動之後會打開 jupyter 的頁面

運行 Bootstrap 和 Hello_world 兩項,如下圖,如果在本地跑小心電腦風扇燒起來,下載資源和訓練十分耗時耗資源

之後運行 HTML 項目能達到此效果

如果您對深度學習方面或者對改變前端開發工作模式方面十分有興趣不妨可以研究嘗試一下。

三年之後前端工程師們要下崗了么?嗯哼,我猜應該不會。

作者介紹

Emil Wallner

twitter:https://twitter.com/EmilWallner
生活在巴黎,是一個深度學習方面富有經驗和想像力的人,通過此項目預言在未來三年內,深度學習將改變前端開發。


今日推薦英文原文:《10 commands every Linux user should know》原作者:Sam Bocetta

原文鏈接:https://opensource.com/article/18/4/10-commands-new-linux-users

推薦理由:Linux 操作的精髓盡在命令行界面,很多樂趣也來自於這種傳統的交互,各種命令很多,但是掌握這常見的10個命令就能應付絕大多數場合。

 

10 commands every Linux user should know

Terminal

Image by : Jamie Cox. Modified by Opensource.com. CC BY 2.0.

You may think you're new to Linux, but you're really not. There are 3.74 billion global internet users, and all of them use Linux in some way since Linux servers power 90% of the internet. Most modern routers run Linux or Unix, and the TOP500 supercomputers also rely on Linux. If you own an Android smartphone, your operating system is constructed from the Linux kernel.

In other words, Linux is everywhere.

But there's a difference between using Linux-based technologies and using Linux itself. If you're interested in Linux, but have been using a PC or Mac desktop, you may be wondering what you need to know to use the Linux command line interface (CLI). You've come to the right place.The following are the fundamental Linux commands you need to know. Each is simple and easy to commit to memory. In other words, you don't have to be Bill Gates to understand them.

1. ls

You're probably thinking, "Is what?" No, that wasn't a typographical error – I really intended to type a lower-case L. ls, or "list," is the number one command you need to know to use the Linux CLI. This list command functions within the Linux terminal to reveal all the major directories filed under a respective filesystem. For example, this command:

ls /applications

shows every folder stored in the applications folder. You'll use it to view files, folders, and directories.

All hidden files are viewable by using the command ls -a.

2. cd

This command is what you use to go (or "change") to a directory. It is how you navigate from one folder to another. Say you're in your Downloads folder, but you want to go to a folder called Gym Playlist. Simply typing cd Gym Playlist won't work, as the shell won't recognize it and will report the folder you're looking for doesn't exist. To bring up that folder, you'll need to include a backslash. The command should look like this:

cd Gym\ Playlist

To go back from the current folder to the previous one, you can type in the folder name followed by cd ... Think of the two dots like a back button.

3. mv

This command transfers a file from one folder to another; mv stands for "move." You can use this short command like you would drag a file to a folder on a PC.

For example, if I create a file called testfile to demonstrate all the basic Linux commands, and I want to move it to my Documents folder, I would issue this command:

mv /home/sam/testfile /home/sam/Documents/

The first piece of the command (mv) says I want to move a file, the second part (home/sam/testfile) names the file I want to move, and the third part (/home/sam/Documents/) indicates the location where I want the file transferred.

4. Keyboard shortcuts

Okay, this is more than one command, but I couldn't resist including them all here. Why? Because they save time and take the headache out of your experience.

CTRL+K Cuts text from the cursor until the end of the line

CTRL+Y Pastes text

CTRL+E Moves the cursor to the end of the line

CTRL+A Moves the cursor to the beginning of the line

ALT+F Jumps forward to the next space

ALT+B Skips back to the previous space

ALT+Backspace Deletes the previous word

CTRL+W Cuts the word behind the cursor

Shift+Insert Pastes text into the terminal

Ctrl+D Logs you out

These commands come in handy in many ways. For example, imagine you misspell a word in your command text:

sudo apt-get intall programname

You probably noticed "install" is misspelled, so the command won't work. But keyboard shortcuts make it easy to go back and fix it. If my cursor is at the end of the line, I can click ALT+B twice to move the cursor to the place noted below with the ^ symbol:

sudo apt-get^intall programname

Now, we can quickly add the letter s to fix install. Easy peasy!

5. mkdir

This is the command you use to make a directory or a folder in the Linux environment. For example, if you're big into DIY hacks like I am, you could enter mkdir DIY to make a directory for your DIY projects.

6. at

If you want to run a Linux command at a certain time, you can add at to the equation. The syntax is at followed by the date and time you want the command to run. Then the command prompt changes to at> so you can enter the command(s) you want to run at the time you specified above

For example:

at 4:08 PM Sat
at> cowsay 'hello'
at> CTRL+D

This will run the program cowsay at 4:08 p.m. on Saturday night.

7. rmdir

This command allows you to remove a directory through the Linux CLI. For example:

rmdir testdirectory

Bear in mind that this command will not remove a directory that has files inside. This only works when removing empty directories.

8. rm

If you want to remove files, the rm command is what you want. It can delete files and directories. To delete a single file, type rm testfile, or to delete a directory and the files inside it, type rm -r.

9. touch

The touch command, otherwise known as the "make file command," allows you to create new, empty files using the Linux CLI. Much like mkdir creates directories, touch creates files. For example, touch testfile will make an empty file named testfile.

10. locate

This command is what you use to find a file in a Linux system. Think of it like search in Windows. It's very useful if you forget where you stored a file or what you named it.

For example, if you have a document about blockchain use cases, but you can't think of the title, you can punch in locate -blockchain or you can look for "blockchain use cases" by separating the words with an asterisk or asterisks (*). For example:

locate -i*blockchain*use*cases*.


There are tons of other helpful Linux CLI commands, like the pkill command, which is great if you start a shutdown and realize you didn't mean to. But the 10 simple and useful commands described here are the essentials you need to get started using the Linux command line.


每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,歡迎關注開源日報。交流QQ群:202790710;電報群 https://t.me/OpeningSourceOrg