tag:blogger.com,1999:blog-81282044354291555602024-03-05T15:45:07.711+08:00超軟之家Endless Learning! Hardware Limited but Software is unlimited.Unknownnoreply@blogger.comBlogger102125tag:blogger.com,1999:blog-8128204435429155560.post-52266265258455228162022-12-31T00:29:00.004+08:002022-12-31T00:37:45.323+08:00Typescript beginning with ts-node<h1 class="mume-header" id="install-nvm-first" style="font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 2.25em; font-variant-ligatures: normal; line-height: 1.2; margin-bottom: 16px; margin-top: 1em; orphans: 2; padding-bottom: 0.3em; text-decoration-thickness: initial; widows: 2;"><span style="background-color: white;"><span style="color: #444444;">Install nvm first</span></span></h1><div><span style="background-color: white;"><span style="color: #444444;"><a href="https://github.com/nvm-sh/nvm#installing-and-updating">https://github.com/nvm-sh/nvm#installing-and-updating</a></span></span></div><div><br /></div><div><span style="background-color: white;"><span style="color: #444444;"><div style="color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><div style="line-height: 19px;"><div style="line-height: 19px;"><pre class="code-active-line" style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="18" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash</code></pre></div></div></div></div></span></span></div><div><span style="background-color: white;"><span style="color: #444444;"><h2 style="color: black; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 2.25em; line-height: 1.2; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; text-align: left;">Example of install nvm</h2><div><pre class="code-active-line" style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; color: black; font-size: 14px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="18" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15916 100 15916 0 0 32283 0 --:--:-- --:--:-- --:--:-- 32283
=> Downloading nvm from git to <span class="hljs-string" style="color: #a31515;">'/home/ci/.nvm'</span>
=> Cloning into <span class="hljs-string" style="color: #a31515;">'/home/ci/.nvm'</span>...
remote: Enumerating objects: 358, <span class="hljs-keyword" style="color: blue;">done</span>.
remote: Counting objects: 100% (358/358), <span class="hljs-keyword" style="color: blue;">done</span>.
remote: Compressing objects: 100% (304/304), <span class="hljs-keyword" style="color: blue;">done</span>.
remote: Total 358 (delta 41), reused 164 (delta 28), pack-reused 0
Receiving objects: 100% (358/358), 218.72 KiB | 1.40 MiB/s, <span class="hljs-keyword" style="color: blue;">done</span>.
Resolving deltas: 100% (41/41), <span class="hljs-keyword" style="color: blue;">done</span>.
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm <span class="hljs-built_in" style="color: #007acc;">source</span> string to /home/ci/.bashrc
=> Appending bash_completion <span class="hljs-built_in" style="color: #007acc;">source</span> string to /home/ci/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
<span class="hljs-built_in" style="color: #007acc;">export</span> NVM_DIR=<span class="hljs-string" style="color: #a31515;">"<span class="hljs-variable" style="color: green;">$HOME</span>/.nvm"</span>
[ -s <span class="hljs-string" style="color: #a31515;">"<span class="hljs-variable" style="color: green;">$NVM_DIR</span>/nvm.sh"</span> ] && \. <span class="hljs-string" style="color: #a31515;">"<span class="hljs-variable" style="color: green;">$NVM_DIR</span>/nvm.sh"</span> <span class="hljs-comment" style="color: green; font-style: italic;"># This loads nvm</span>
[ -s <span class="hljs-string" style="color: #a31515;">"<span class="hljs-variable" style="color: green;">$NVM_DIR</span>/bash_completion"</span> ] && \. <span class="hljs-string" style="color: #a31515;">"<span class="hljs-variable" style="color: green;">$NVM_DIR</span>/bash_completion"</span> <span class="hljs-comment" style="color: green; font-style: italic;"># This loads nvm bash_completion</span></code></pre></div></span></span></div><p class="sync-line" data-line="23" style="background-color: #141414; color: #cccccc; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 16px; font-variant-ligatures: normal; margin: 0px; orphans: 2; text-decoration-thickness: initial; widows: 2;"></p><h1 class="mume-header" id="install-and-select-nodejs-version-by-nvm-command-line" style="font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 2.25em; font-variant-ligatures: normal; line-height: 1.2; margin-bottom: 16px; margin-top: 1em; orphans: 2; padding-bottom: 0.3em; text-decoration-thickness: initial; widows: 2;"><span style="background-color: white;">Install and select Node.js version by nvm command line</span></h1><p class="sync-line" data-line="24" style="background-color: #141414; color: #cccccc; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 16px; font-variant-ligatures: normal; margin: 0px; orphans: 2; text-decoration-thickness: initial; widows: 2;"></p><pre class="language-bash" data-info="sh" data-role="codeBlock" style="background-color: #27292c; border-radius: 3px; border: rgb(61, 61, 61); color: #c5c8c6; direction: ltr; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 0.85em; font-variant-ligatures: normal; line-height: 1.45; margin-bottom: 16px; margin-top: 0px; orphans: 2; overflow: auto; padding: 1em; tab-size: 4; text-decoration-thickness: initial; widows: 2; word-break: normal;">nvm <span class="token function" style="color: #ffd2a7;">install</span> v18</pre><div><span style="background-color: white;"><br /></span></div><div><span style="background-color: white;"><blockquote class="code-line" data-line="44" dir="auto" style="background: var(--vscode-textBlockQuote-background); border-color: var(--vscode-textBlockQuote-border); border-left-style: solid; border-left-width: 5px; font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; margin: 0px 7px 0px 5px; padding: 0px 16px 0px 10px; position: relative;"><p class="code-line" data-line="44" dir="auto" style="margin-bottom: 0.7em; margin-top: 0px; position: relative;">Please logout and login again to activate nvm.sh shell environment</p></blockquote><pre class="code-active-line" style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; font-size: 14px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="46" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">~$ nvm <span class="hljs-built_in" style="color: #007acc;">ls</span>
N/A
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
~$ nvm install v18
Downloading and installing node v18.12.1...
Downloading https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz...
<span class="hljs-comment" style="color: green; font-style: italic;">################################################################################################################################ 100.0%</span>
Computing checksum with sha256sum
Checksums matched!
Now using node v18.12.1 (npm v8.19.2)
Creating default <span class="hljs-built_in" style="color: #007acc;">alias</span>: default -> v18 (-> v18.12.1)
~$ nvm <span class="hljs-built_in" style="color: #007acc;">ls</span>
-> v18.12.1
default -> v18 (-> v18.12.1)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.12.1) (default)
stable -> 18.12 (-> v18.12.1) (default)
lts/* -> lts/hydrogen (-> v18.12.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.2 (-> N/A)
lts/gallium -> v16.19.0 (-> N/A)
lts/hydrogen -> v18.1</code></pre></span></div><h1 class="mume-header" id="install-typescript" style="font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 2.25em; font-variant-ligatures: normal; line-height: 1.2; margin-bottom: 16px; margin-top: 1em; orphans: 2; padding-bottom: 0.3em; text-decoration-thickness: initial; widows: 2;"><span style="background-color: white;">Install typescript</span></h1><div><span style="background-color: white;"><div style="font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><br /></div><div style="font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><pre style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="79" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">~$ npm install -g typescript
added 1 package, and audited 2 packages <span class="hljs-keyword" style="color: blue;">in</span> 2s
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.2.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.2.0
npm notice Run npm install -g npm@9.2.0 to update!
npm notice
</code></pre><h2 class="code-line" data-line="92" dir="auto" id="install-typescript-with-specific-version" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; margin-bottom: 0.2em; margin-top: 0px; position: relative; white-space: normal;">install typescript with specific version</h2><h3 class="code-line" data-line="92" dir="auto" id="create-example-hellots-file" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; margin-bottom: 0.2em; margin-top: 0px; position: relative; white-space: normal;"><pre style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; font-size: 14px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="94" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">npm install -g typescript@4.6.4</code></pre></h3><h1 style="text-align: left;">Example of hello.ts</h1><h3 class="code-line" data-line="92" dir="auto" id="create-example-hellots-file" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; margin-bottom: 0.2em; margin-top: 0px; position: relative; white-space: normal;"><br /></h3><h3 class="code-line" data-line="92" dir="auto" id="create-example-hellots-file" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; margin-bottom: 0.2em; margin-top: 0px; position: relative; white-space: normal;">Create example hello.ts file</h3><pre style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="93" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;"><span class="hljs-built_in" style="color: #007acc;">cat</span> << <span class="hljs-string" style="color: #a31515;">EOF >> hello.ts
var name:string = "Coder of Typescript";
console.log(`Hello, ${name}`);
EOF</span>
</code></pre><h3 class="code-line" data-line="99" dir="auto" id="results-of-hellots" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; margin-bottom: 0.2em; margin-top: 0px; position: relative; white-space: normal;">Results of hello.ts</h3><pre class="code-active-line" style="background-color: rgba(220, 220, 220, 0.4); border-radius: 3px; margin-top: 0px; overflow: auto; padding: 16px; white-space: pre-wrap;"><code class="code-line language-sh" data-line="100" dir="auto" style="color: var(--vscode-editor-foreground); font-family: var(--vscode-editor-font-family, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace); font-size: 1em; line-height: 1.357em; position: relative; tab-size: 4;">~$ ts-node hello.ts
Hello, Coder</code></pre></div><div style="font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><h1 class="code-line" data-line="111" dir="auto" id="conclusions" style="border-bottom: 1px solid rgba(0, 0, 0, 0.18); border-left-color: rgba(0, 0, 0, 0.18); border-right-color: rgba(0, 0, 0, 0.18); border-top-color: rgba(0, 0, 0, 0.18); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-weight: normal; line-height: 1.2; margin-top: 0px; padding-bottom: 0.3em; position: relative; white-space: normal;">Conclusions</h1><p class="code-line code-active-line" data-line="113" dir="auto" style="font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; margin-bottom: 0.7em; margin-top: 0px; position: relative; white-space: normal;">I considere that typescript is a good tool for nodejs to write more stable code. Enjoy The journal for Typescript writing!</p></div><div style="line-height: 19px;"><br /></div><div style="line-height: 19px;"><br /></div></div></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-50796462924524167222021-07-28T00:58:00.006+08:002021-07-29T01:18:32.845+08:00ffmpeg 降低聲音品質來縮小 mp3 檔案大小<p> </p><div style="orphans: 4;"><span face="Open Sans, Clear Sans, Helvetica Neue, Helvetica, Arial, sans-serif" style="color: #333333;"><span style="background-color: white; caret-color: rgb(51, 51, 51); font-size: 36px; white-space: pre-wrap;"><b>目的縮小MP3檔案大小</b></span></span></div><ul cid="n87" class="ul-list" data-mark="*" mdtype="list" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; margin: 0.8em 0px; padding-left: 30px; position: relative;"><li cid="n90" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n91" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">雙聲道改單聲道 </span></p></li><li cid="n94" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n92" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;"> 範例為</span><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">音訊</span><b style="color: #202122; font-family: sans-serif; font-size: 15.008px;">位元速率(</b>bitrate) 從 160 kb/s 降為 64 kb/s</p></li></ul><h2 cid="n115" class="md-end-block md-heading" mdtype="heading" style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; break-after: avoid-page; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; cursor: text; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">指令語法</span></h2><pre cid="n116" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">ffmpeg -i <160k stereo filename>.mp3 -ac 1 -b:a 64k <output 64k mono filename>.mp3</span></pre><p cid="n117" class="md-end-block md-p" mdtype="paragraph" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">-ac </span><span class="md-tag md-raw-inline" face="var(--monospace)" md-inline="tag" spellcheck="false" style="box-sizing: border-box; color: #a7a7a7; opacity: 1;"><channels></span><span class="md-plain" md-inline="plain" style="box-sizing: border-box;"> 設定音訊頻道數(set number of audio channels) </span></p><ul cid="n132" class="ul-list" data-mark="*" mdtype="list" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; margin: 0.8em 0px; padding-left: 30px; position: relative;"><li cid="n135" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n136" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">1 表示單聲道(mono)</span></p></li><li cid="n141" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n139" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">2 表示雙聲道(stereo)</span></p></li></ul><p cid="n124" class="md-end-block md-p" mdtype="paragraph" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">-b:a </span><span class="md-tag md-raw-inline" face="var(--monospace)" md-inline="tag" spellcheck="false" style="box-sizing: border-box; color: #a7a7a7; opacity: 1;"><bitrate></span><span class="md-plain" md-inline="plain" style="box-sizing: border-box;"> 音訊</span><b style="color: #202122; font-family: sans-serif; font-size: 15.008px;">位元速率(</b><a href="https://en.wikipedia.org/wiki/Bit_rate" target="_blank">bitrate</a>)</p><h2 cid="n98" class="md-end-block md-heading" mdtype="heading" style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; break-after: avoid-page; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; cursor: text; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">小結</span></h2><p cid="n102" class="md-end-block md-p" mdtype="paragraph" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">檔案大小縮小約為原來的 39.88% </span></p><pre cid="n107" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">~<span class="cm-def" style="box-sizing: border-box; color: blue;">$ python</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Python <span class="cm-number" style="box-sizing: border-box; color: #116644;">3</span>.9.6 (default, Jun <span class="cm-number" style="box-sizing: border-box; color: #116644;">29</span> <span class="cm-number" style="box-sizing: border-box; color: #116644;">2021</span>, <span class="cm-number" style="box-sizing: border-box; color: #116644;">04</span>:45:03)</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">..</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">>>> round(80973 / <span class="cm-number" style="box-sizing: border-box; color: #116644;">203040</span> * <span class="cm-number" style="box-sizing: border-box; color: #116644;">100</span>,2)</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-number" style="box-sizing: border-box; color: #116644;">39</span>.88</span></pre><h2 cid="n99" class="md-end-block md-heading" mdtype="heading" style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; break-after: avoid-page; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; cursor: text; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">執行指令範例</span></h2><pre cid="n58" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ ffmpeg</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-i</span> 1_setup_160k_stereo.mp3 <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-ac</span> <span class="cm-number" style="box-sizing: border-box; color: #116644;">1</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-b</span>:a 64k 1_setup_64k_mono.mp3</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">...</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ ffmpeg</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-i</span> 1_setup_160k_stereo.mp3</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Input <span class="cm-comment" style="box-sizing: border-box; color: #aa5500;">#0, mp3, from '1_setup_160k_stereo.mp3':</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Duration: <span class="cm-number" style="box-sizing: border-box; color: #116644;">00</span>:00:10.12, <span class="cm-builtin" style="box-sizing: border-box; color: #3300aa;">start</span>: <span class="cm-number" style="box-sizing: border-box; color: #116644;">0</span>.069063, bitrate: <span class="cm-number" style="box-sizing: border-box; color: #116644;">160</span> kb/s</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> Stream <span class="cm-comment" style="box-sizing: border-box; color: #aa5500;">#0:0: Audio: mp3, 16000 Hz, stereo, fltp, 160 kb/s</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> Metadata:</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> encoder : LAME3.98r</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span cm-text="" style="box-sizing: border-box;"></span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ ffmpeg</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-i</span> 1_setup_64k_mono.mp3</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Input <span class="cm-comment" style="box-sizing: border-box; color: #aa5500;">#0, mp3, from 1_setup_64k_mono.mp3':</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Metadata:</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> encoder : Lavf58.45.100</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Duration: <span class="cm-number" style="box-sizing: border-box; color: #116644;">00</span>:00:10.08, <span class="cm-builtin" style="box-sizing: border-box; color: #3300aa;">start</span>: <span class="cm-number" style="box-sizing: border-box; color: #116644;">0</span>.069063, bitrate: <span class="cm-number" style="box-sizing: border-box; color: #116644;">64</span> kb/s</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> Stream <span class="cm-comment" style="box-sizing: border-box; color: #aa5500;">#0:0: Audio: mp3, 16000 Hz, mono, fltp, 64 kb/s</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span cm-text="" style="box-sizing: border-box;"></span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span cm-text="" style="box-sizing: border-box;"></span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ ls</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-la</span> 1_setup*</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-rw-r--r--</span>@ <span class="cm-number" style="box-sizing: border-box; color: #116644;">1</span> tester staff <span class="cm-number" style="box-sizing: border-box; color: #116644;">203040</span> Jul <span class="cm-number" style="box-sizing: border-box; color: #116644;">24</span> <span class="cm-number" style="box-sizing: border-box; color: #116644;">18</span>:38 1_setup_160k_stereo.mp3</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-rw-r--r--</span>@ <span class="cm-number" style="box-sizing: border-box; color: #116644;">1</span> tester staff <span class="cm-number" style="box-sizing: border-box; color: #116644;">80973</span> Jul <span class="cm-number" style="box-sizing: border-box; color: #116644;">24</span> <span class="cm-number" style="box-sizing: border-box; color: #116644;">18</span>:43 1_setup_64k_mono.mp3</span></pre><br class="Apple-interchange-newline" /><div><h2 cid="n269" class="md-end-block md-heading md-focus" mdtype="heading" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; border-bottom: 1px solid rgb(238, 238, 238); box-sizing: border-box; break-after: avoid-page; break-inside: avoid; cursor: text; font-size: 1.75em; line-height: 1.225; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain md-expand" md-inline="plain" style="box-sizing: border-box;">延伸閱讀</span></h2><ul cid="n270" class="ul-list" data-mark="*" mdtype="list" style="box-sizing: border-box; margin: 0.8em 0px; padding-left: 30px; position: relative;"><li cid="n273" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n274" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2020/05/ffmpeg-mp4.html" style="-webkit-user-drag: none; box-sizing: border-box; color: #4183c4; cursor: pointer;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">使用 ffmpeg 指令合併的多個MP4檔案</span></a></span></p></li></ul></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-80102394604864351982021-07-28T00:31:00.002+08:002021-07-28T00:31:20.100+08:00Dev Tips - command line snippets<p> </p><h1 cid="n0" class="md-end-block md-heading md-focus" mdtype="heading" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; break-after: avoid-page; break-inside: avoid; cursor: text; font-size: 2.25em; line-height: 1.2; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Command - equal to ldd</span></h1><pre cid="n35" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">objdump <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-p</span> <path/to/program> | <span class="cm-builtin" style="box-sizing: border-box; color: #3300aa;">grep</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-i</span> needed</span></pre><p cid="n37" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"></p><h1 cid="n34" class="md-end-block md-heading" mdtype="heading" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; break-after: avoid-page; break-inside: avoid; cursor: text; font-size: 2.25em; line-height: 1.2; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Command - while loop with date and sleep</span></h1><pre cid="n2" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-keyword" style="box-sizing: border-box; color: #770088;">while</span> [ <span class="cm-number" style="box-sizing: border-box; color: #116644;">1</span> ] ; <span class="cm-keyword" style="box-sizing: border-box; color: #770088;">do</span> date <span class="cm-operator" style="box-sizing: border-box; color: #981a1a;">+</span><span class="cm-string" style="box-sizing: border-box; color: #aa1111;">"%M:%S"</span> ; <span class="cm-builtin" style="box-sizing: border-box; color: #3300aa;">sleep</span> <span class="cm-number" style="box-sizing: border-box; color: #116644;">1</span> ; <span class="cm-keyword" style="box-sizing: border-box; color: #770088;">done</span></span></pre><p cid="n3" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"></p><h1 cid="n4" class="md-end-block md-heading" mdtype="heading" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; break-after: avoid-page; break-inside: avoid; cursor: text; font-size: 2.25em; line-height: 1.2; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Command - cp</span></h1><p cid="n5" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">merge one folder to another folder</span></p><p cid="n6" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0.8em 0px; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">if file exists in </span><span class="md-pair-s" md-inline="code" spellcheck="false" style="box-sizing: border-box;"><code style="background-color: #f3f4f4; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; font-family: var(--monospace); font-size: 0.9em; padding: 0px 2px;">dummy_tmp</code><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">, it will replace by file in </span><span class="md-pair-s" md-inline="code" spellcheck="false" style="box-sizing: border-box;"><code style="background-color: #f3f4f4; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; font-family: var(--monospace); font-size: 0.9em; padding: 0px 2px;">origin_tmp</code></span></span></p><pre cid="n7" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #f8f8f8; background-image: inherit; background-origin: inherit; background-size: inherit; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(231, 234, 237); box-sizing: border-box; break-inside: avoid; font-family: var(--monospace); font-size: 0.9em; margin-bottom: 15px; margin-top: 15px; overflow: visible; padding: 8px 4px 6px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ cp</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-RT</span> origin_tmp/ dummy_tmp/</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: blue;">$ diff</span> <span class="cm-attribute" style="box-sizing: border-box; color: #0000cc;">-ur</span> dummy_tmp origin_tmp</span></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-49410458975974342582021-07-14T23:41:00.005+08:002021-07-14T23:41:49.147+08:00Bash Tip - date 日期指令轉換 unix epoch time 範例<p> </p><h1 style="text-align: left;">Command - date</h1><div><h3 style="text-align: left;">Example 1 date - convert unix epoch timestamp to date string</h3><pre cid="n9" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); color: #b8bfc6; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ date</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">--date</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">'@1617694020'</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Tue <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">06</span> Apr <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2021</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">07</span>:27:00 AM UTC</span></pre><h3 style="text-align: left;">Example 2 date - convert unix timestamp to custom formatted date string</h3><div><br /><pre cid="n11" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); color: #b8bfc6; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ date</span> <span class="cm-operator" style="box-sizing: border-box;">+</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"%Y-%m-%d %H:%m"</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">--date</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">'@1617694020'</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2021</span><span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-04-06</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">07</span>:04</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ date</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">--date</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">'@1617694020.904'</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">Tue <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">06</span> Apr <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2021</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">07</span>:27:00 AM UTC</span></pre><h3 style="text-align: left;">Example 3 date -- MacOS Mojave convert timestamp to date string</h3><div><br /><pre cid="n13" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); color: #b8bfc6; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative !important; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-comment" style="box-sizing: border-box; color: #da924a;">## MacOS Mojave not support --date</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ date</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">--date</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">'@1617694020.904'</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">date: illegal option <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">--</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[<span class="cm-operator" style="box-sizing: border-box;">+</span>|-]val[ymwdHMS]] ...</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"> [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [<span class="cm-operator" style="box-sizing: border-box;">+</span>format]</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-comment" style="box-sizing: border-box; color: #da924a;">## use -r to instead</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ date</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-r</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">1625043610</span> <span class="cm-operator" style="box-sizing: border-box;">+</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"%Y%m%d %H:%M:%S"</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">20210630</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">17</span>:00:10</span></pre><br class="Apple-interchange-newline" /></div></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-25294017934165726552021-01-21T18:30:00.002+08:002021-01-21T18:31:35.312+08:00bash tips - 使用部分執行檔名來發出終止程式指令 terminate processes by partial process name<div><p cid="n2" class="md-end-block md-p" mdtype="paragraph" style="background-color: #fefefe; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: Vollkorn, Palatino, Times; font-size: 19px; line-height: inherit; margin-bottom: 1rem; margin-top: 0px; orphans: 4; position: relative; text-align: justify; white-space: pre-wrap;"><span class="md-plain md-expand" md-inline="plain" style="box-sizing: border-box;">在 Linux 系統中,時常會遇到需要終止執行中的程式,如果只有單一執行檔程式執行多個 Instances 時,可簡單使用下列指令例如:</span></p><pre cid="n13" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="bash" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #fefefe; background-image: inherit; background-origin: inherit; background-size: inherit; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; font-family: Consolas, Menlo, Monaco, monospace, serif; font-size: 0.9rem; margin-bottom: 1.5em; margin-left: 1em; overflow: visible; padding-bottom: 8px; padding-left: 1em; padding-top: 6px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-builtin" style="box-sizing: border-box; color: #3300aa;">killall</span> <process name></span></pre><p cid="n15" class="md-end-block md-p" mdtype="paragraph" style="background-color: #fefefe; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: Vollkorn, Palatino, Times; font-size: 19px; line-height: inherit; margin-bottom: 1rem; margin-top: 0px; orphans: 4; position: relative; text-align: justify; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">但若是有多個 prefix 相同的程式就要分別指定</span></p><pre cid="n20" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" mdtype="fences" spellcheck="false" style="background-attachment: inherit; background-clip: inherit; background-color: #fefefe; background-image: inherit; background-origin: inherit; background-size: inherit; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; font-family: Consolas, Menlo, Monaco, monospace, serif; font-size: 0.9rem; margin-bottom: 1.5em; margin-left: 1em; overflow: visible; padding-bottom: 8px; padding-left: 1em; padding-top: 6px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-builtin" style="box-sizing: border-box; color: #3300aa; font-size: 0.9rem;">killall</span><span style="font-size: 0.9rem;"> </span>test_a test_b test_c</span></pre><p cid="n18" class="md-end-block md-p md-focus" mdtype="paragraph" style="background-color: #fefefe; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: Vollkorn, Palatino, Times; font-size: 19px; line-height: inherit; margin-bottom: 1rem; margin-top: 0px; orphans: 4; position: relative; text-align: justify; white-space: pre-wrap;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">為了方便使用,初步寫一版可使用部分執行檔來終止程式的腳本,下例腳本是使用以下 /bin/sh 測試:</span></p></div><div><div><ul style="text-align: left;"><li>busybox v1.31</li><li>dash 0.5.8-2.10</li></ul></div><h3 style="text-align: left;">Script example</h3><div><br /></div><div><pre cid="n167" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="sh" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-meta" style="box-sizing: border-box; color: #b7b3b3;">#!/bin/sh</span></span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">pname</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$1</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span></span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">if</span> [ <span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"x</span><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$pname</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span> <span class="cm-operator" style="box-sizing: border-box;">=</span> x ]; <span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">then</span></span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-tab" cm-text=" " face="var(--monospace)" role="presentation" style="box-sizing: border-box; display: inline-block; position: relative;"></span><span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">echo</span> <span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"syntax: <partial process name>"</span></span><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">; exit</span><span style="color: #b8bfc6;"> </span><span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">1</span><span class="cm-number" style="box-sizing: border-box; color: #b8bfc6;"> ; </span></span><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">fi</span></span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">ps</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-a</span> | <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span> <span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$pname</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span> | \</span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-v</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span> | \</span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sed</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-e</span> <span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"s/^[ ]*\([0-9][0-9]*\) .*</span><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$/</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">\1/g"</span> | \</span><br /><span role="presentation" style="box-sizing: border-box; color: #b8bfc6; padding-right: 0.1px;"><span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">while</span> read pid ; <span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">do</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">kill</span> <span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$pid</span> ; <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">echo</span> <span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"terminate </span><span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$pid</span><span class="cm-string" style="box-sizing: border-box; color: #d26b6b;">"</span> ; <span class="cm-keyword" style="box-sizing: border-box; color: #c88fd0;">done</span></span></pre><br class="Apple-interchange-newline" /></div><div><h4 style="text-align: left;"> Test output</h4><div><pre cid="n170" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); color: #b8bfc6; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative; white-space: normal; width: inherit;"><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">~<span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ sleep</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">86400</span> &</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">[1] <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2824</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">~<span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ sleep</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">86402</span> &</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">[2] <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2832</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span cm-text="" style="box-sizing: border-box;"></span></span></pre>sh 加上 -x 可除錯執行<br /><br /><pre cid="n170" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" mdtype="fences" spellcheck="false" style="background-color: #333333; box-sizing: border-box; break-inside: avoid; caret-color: rgb(184, 191, 198); color: #b8bfc6; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: 0.9rem; margin-bottom: 20px; margin-top: 0px; overflow: visible; padding: 10px 10px 10px 30px; position: relative; white-space: normal; width: inherit;"><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">~<span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$ sh</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-x</span> terminate_pname.sh <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sleep</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">pname</span><span class="cm-operator" style="box-sizing: border-box;">=</span><span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sleep</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> [ xsleep <span class="cm-operator" style="box-sizing: border-box;">=</span> x ]</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">ps</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-a</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sleep</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-v</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">grep</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sed</span> <span class="cm-attribute" style="box-sizing: border-box; color: #7575e4;">-e</span> s/^[ ]*\([0-9][0-9]*\) .*<span class="cm-def" style="box-sizing: border-box; color: #8d8df0;">$/</span>\1/g</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> read pid</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">kill</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2824</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">echo</span> terminate <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2824</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">terminate <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2824</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> read pid</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">kill</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2832</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">echo</span> terminate <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2832</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">terminate <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">2832</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span class="cm-operator" style="box-sizing: border-box;">+</span> read pid</span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">[1]- Terminated <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sleep</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">86400</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;">[2]<span class="cm-operator" style="box-sizing: border-box;">+</span> Terminated <span class="cm-builtin" style="box-sizing: border-box; color: #f3b3f8;">sleep</span> <span class="cm-number" style="box-sizing: border-box; color: #64ab8f;">86402</span></span><br /><span role="presentation" style="box-sizing: border-box; padding-right: 0.1px;"><span cm-text="" style="box-sizing: border-box;"></span></span></pre></div><h4 style="text-align: left;"><span class="md-plain md-expand" md-inline="plain" style="box-sizing: border-box;">參考文章</span></h4><ul cid="n105" class="ul-list" data-mark="-" mdtype="list" style="box-sizing: border-box; list-style: square; margin-bottom: 1.5rem; margin-top: 0px; padding: 0px 0px 0px 1.875rem; position: relative;"><li cid="n106" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n107" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap; word-wrap: break-word;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2019/09/bash.html" spellcheck="false" style="-webkit-user-drag: none; box-sizing: border-box; cursor: pointer; outline: 0px;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">阿班 Bash 常用指令範例</span></a></span></p></li><li cid="n108" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n109" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap; word-wrap: break-word;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2019/02/bash-tip-use-bash-to-implement-like-cs.html" spellcheck="false" style="-webkit-user-drag: none; box-sizing: border-box; cursor: pointer; outline: 0px;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Bash Tip - Use bash to implement like C's argc and argv</span></a></span></p></li><li cid="n110" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n111" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap; word-wrap: break-word;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2019/03/run-command-with-multiple-arguments.html" spellcheck="false" style="-webkit-user-drag: none; box-sizing: border-box; cursor: pointer; outline: 0px;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Bash Tip - Run Command with multiple arguments with ssh</span></a></span></p></li><li cid="n112" class="md-list-item" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n113" class="md-end-block md-p" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap; word-wrap: break-word;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2020/09/bash-tip.html" spellcheck="false" style="-webkit-user-drag: none; box-sizing: border-box; cursor: pointer; outline: 0px;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">Bash Tip - 單行取得目前腳本檔絕對路徑的方法</span></a></span></p></li></ul><p><br /></p></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-77455462304357297892020-12-23T01:18:00.002+08:002020-12-23T01:20:23.817+08:00VMware Player 與Windows 10裝置及Credential Guard不相容問題<div><br /></div><div>最近試玩 WSL2 之後,發現了 VM Player 無法正常啟動,發生下列錯誤:</div><div><br /></div><blockquote><div>VMware Player and Device/Credential Guard are not compatible. VMware Player can be run after disabling Device/Credential Guard. Please visit <a href="http://www.vmware.com/go/turnoff_CG_DG">http://www.vmware.com/go/turnoff_CG_DG</a> for mor details.</div></blockquote><div><br /></div><div>看了該 VMware 文件 <a href="https://kb.vmware.com/s/article/2146361" target="_blank">VMware Workstation and Device/Credential Guard are not compatible error in VMware Workstation on Windows 10 host (2146361)</a></div><div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQKMSCbnzOdsmkYXTt4xXraViqMVBRtONIfLIJ-rio5t-i8KQErR3_MI7nrW5F8lKjXyXYyINA58vs0edN8gRkElNpC4RV5TpRhs9Zkg_g5oTQwnHr7pzOynsB0ed2B8aqvYG84gHxGrer/s697/VMware_ubuntu_turnof_CG_DG.jpg" style="display: block; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="524" data-original-width="697" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQKMSCbnzOdsmkYXTt4xXraViqMVBRtONIfLIJ-rio5t-i8KQErR3_MI7nrW5F8lKjXyXYyINA58vs0edN8gRkElNpC4RV5TpRhs9Zkg_g5oTQwnHr7pzOynsB0ed2B8aqvYG84gHxGrer/w400-h301/VMware_ubuntu_turnof_CG_DG.jpg" width="400" /></a><h2 style="text-align: left;">小結</h2></div><div class="separator" style="clear: both;"><br /></div><div class="separator" style="clear: both;">這個問題主因是Windows 10 該功能有增加存取限制,在 Workstation 15.5.6 以上版本已修正該問題。</div><div class="separator" style="clear: both;">可到此連結下載15.5.7 版本 <a href="https://my.vmware.com/en/web/vmware/downloads/details?downloadGroup=PLAYER-1557&productId=800&rPId=47861">https://my.vmware.com/en/web/vmware/downloads/details?downloadGroup=PLAYER-1557&productId=800&rPId=47861</a></div><div class="separator" style="clear: both;"><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-77673916577125212232020-09-11T12:39:00.004+08:002020-09-11T12:56:11.814+08:00Bash Tip - 單行取得目前腳本檔絕對路徑的方法<h2>Bash Tip - 單行取得目前腳本檔絕對路徑的方法</h2>
<pre><code class="language-sh">_t="${0%%`basename $0`}"; cd "$_t" ; sh_abs_path=`pwd`; echo "$sh_abs_path"
</code></pre>
<h2>執行範例</h2>
<ul>
<li>先將上列單行指令寫入到檔案</li>
</ul>
<pre><code class="language-sh">## 建立測試目錄
~$ mkdir -p /tmp/abspath_demo
## 將單行指令寫入到 demo.sh
~$ echo '_t="${0%%`basename $0`}"; cd "$_t" ; sh_abs_path=`pwd`; echo "$sh_abs_path"' > \
/tmp/abspath_demo/demo.sh
</code></pre>
<ul>
<li>執行 demo.sh</li>
</ul>
<pre><code class="language-sh">~$ sh "/tmp/abspath_demo/demo.sh"
/tmp/abspath_demo
</code></pre>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-31082331746775108482020-07-28T13:55:00.005+08:002020-07-28T18:22:53.206+08:00MacOS Tips - Command Lines<br />
<h3>
OSX 終端機使用指含播放 mp3 檔案的方法</h3>
<ul>
<li>使用 afplay </li>
<ul>
<li>afplay <mp3 filename></li></ul></ul><div><div><span></span>語法說明<br /><div class="p2" style="font-stretch: normal; line-height: normal;"><div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;"><div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;"><div class="p1" style="font-stretch: normal; line-height: normal;"><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1">$ afplay -h</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"><br /></font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> Audio File Play</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> Version: 2.0</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> Copyright 2003-2013, Apple Inc. All Rights Reserved.</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> Specify -h (-help) for command options</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"><br /></font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1">Usage:</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1">afplay [option...] audio_file</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"><br /></font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1">Options: (may appear before or after arguments)</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-v | --volume} VOLUME</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> set the volume for playback of the file</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-h | --help}</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> print help</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> { --leaks}</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> run leaks analysis</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-t | --time} TIME</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> play for TIME seconds</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-r | --rate} RATE</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> play at playback rate</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-q | --rQuality} QUALITY</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality)</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> {-d | --debug}</font></div><div class="p1" style="font-stretch: normal; line-height: normal;"><font face="helvetica neue" size="1"> debug print output</font></div></div></div></div></div><span></span></div><div><br /></div><div><br /></div></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-77186346007900293972020-05-25T14:51:00.004+08:002020-07-28T13:52:16.505+08:00Visual Studio Code 工具相關文件收集<br />
快速鍵(Shortcuts)<div><br /><ul style="text-align: left;"><li><a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf" target="_blank">VS Code keyboard shortcuts Windows pdf</a></li><li><a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf">VS Code keyboard shortcuts Macos pdf</a></li></ul>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-19967115887698269052020-05-13T19:38:00.004+08:002021-07-28T01:03:34.624+08:00使用 ffmpeg 指令合併的多個MP4檔案<br />
<span style="font-size: large;">產生 ffmpeg concat 清單</span><br />
<div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
使用指令如下<br />
<br /></div>
<span style="font-size: medium;"></span><br />
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div class="p1" style="font-family: "helvetica neue"; font-stretch: normal; line-height: normal;">
<span style="font-size: x-small;">cd 0512_mp4_files</span></div>
<div class="p1" style="font-family: "helvetica neue"; font-stretch: normal; line-height: normal;">
<span style="font-size: x-small;">ls *.mp4 | xargs printf "file '%s'\n" "$1" > filelist.txt</span></div>
</div>
</div>
</div>
<span style="font-size: medium;">
</span></div>
<div>
<br /></div>
<div>
合併用檔案清單 filelist.txt</div>
<div>
<div>
<span style="font-size: medium;"></span><br />
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div class="p1" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140005.mp4'</span></span></div>
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140106.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140206.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140306.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140406.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140506.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140607.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140707.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140807.mp4'</span></span><br />
<span style="font-size: medium;"><span style="font-family: "helvetica neue"; font-size: x-small;">file '140907.mp4'</span></span></div>
</div>
</div>
<span style="font-size: medium;">
</span></div>
<h4>
</h4>
</div>
<div>
<span style="font-family: ".pingfang tc"; font-size: large;">執行下列指令合併的多個MP4檔案</span><br />
<span style="font-family: ".pingfang tc"; font-size: large;"><br /></span>
<div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
使用指令</div>
<span style="font-size: medium;"></span><br />
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div class="p1" style="font-family: "helvetica neue"; font-stretch: normal; line-height: normal;">
<span style="font-size: x-small;">cd 0512_mp4_files</span></div>
<div class="p1" style="font-family: "helvetica neue"; font-stretch: normal; line-height: normal;">
<span style="font-family: "pingfang tc"; font-size: x-small;">ffmpeg -f concat -i ./filelist.txt -c copy your_target.mp4</span></div>
</div>
</div>
</div>
</div>
<span style="font-family: ".pingfang tc"; font-size: large;"><br /></span>
<span style="font-size: large;">範例</span></div>
<div>
<br /></div>
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<span style="font-family: "pingfang tc"; font-size: x-small;">$ ffmpeg -f concat -i ./filelist.txt -c copy 0512_all.mp4</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> built with Apple clang version 11.0.0 (clang-1100.0.33.17)</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavutil 56. 31.100 / 56. 31.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavcodec 58. 54.100 / 58. 54.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavformat 58. 29.100 / 58. 29.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavdevice 58. 8.100 / 58. 8.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavfilter 7. 57.100 / 7. 57.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libavresample 4. 0. 0 / 4. 0. 0</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libswscale 5. 5.100 / 5. 5.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libswresample 3. 5.100 / 3. 5.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> libpostproc 55. 5.100 / 55. 5.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd408016200] Auto-inserting h264_mp4toannexb bitstream filter</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">Input #0, concat, from './filelist.txt':</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Duration: N/A, start: 0.000000, bitrate: 1328 kb/s</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080, 1300 kb/s, 20.02 fps, 20 tbr, 90k tbn, 180k tbc</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Metadata:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> creation_time : 1983-04-09T07:52:37.000000Z</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> handler_name : xsj_vid</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, stereo, fltp, 27 kb/s</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Metadata:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> creation_time : 1983-04-09T07:52:37.000000Z</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> handler_name : xsj_aud</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">Output #0, mp4, to '0512_all.mp4':</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Metadata:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> encoder : Lavf58.29.100</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080, q=2-31, 1300 kb/s, 20.02 fps, 20 tbr, 90k tbn, 90k tbc</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Metadata:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> creation_time : 1983-04-09T07:52:37.000000Z</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> handler_name : xsj_vid</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, stereo, fltp, 27 kb/s</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Metadata:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> creation_time : 1983-04-09T07:52:37.000000Z</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> handler_name : xsj_aud</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">Stream mapping:</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:0 -> #0:0 (copy)</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"> Stream #0:1 -> #0:1 (copy)</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">Press [q] to stop, [?] for help</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd408016200] Auto-inserting h264_mp4toannexb bitstream filter</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd409004800] Auto-inserting h264_mp4toannexb bitstream filter</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:1; previous: 1920672, current: 1920000; changing to 1920673. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:1; previous: 1920673, current: 1920160; changing to 1920674. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd407800000] Auto-inserting h264_mp4toannexb bitstream filter</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[concat @ 0x7fd408009800] DTS 16200000 < 16203870 out of order</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">...</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd409004800] Auto-inserting h264_mp4toannexb bitstream filter</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[concat @ 0x7fd408009800] DTS 640980000 < 640988370 out of order</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:0; previous: 640988370, current: 640980000; changing to 640988371. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:1; previous: 113953720, current: 113952000; changing to 113953721. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:0; previous: 640988371, current: 640980900; changing to 640988372. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:1; previous: 113953721, current: 113952160; changing to 113953722. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:0; previous: 640988372, current: 640985400; changing to 640988373. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">[mp4 @ 0x7fd407004a00] Non-monotonous DTS in output stream 0:1; previous: 113953722, current: 113953232; changing to 113953723. This may result in incorrect timestamps in the output file.</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">frame=144301 fps=11366 q=-1.0 Lsize= 1171225kB time=01:59:42.11 bitrate=1335.9kbits/s speed= 566x</span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;"></span><br />
<span style="font-family: "pingfang tc"; font-size: x-small;">video:1143434kB audio:24298kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.299121%</span></div>
</div>
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br /></div><div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;"><h2 cid="n196" class="md-end-block md-heading" mdtype="heading" style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; break-after: avoid-page; break-inside: avoid; caret-color: rgb(51, 51, 51); color: #333333; cursor: text; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 1rem; margin-top: 1rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-plain md-expand" md-inline="plain" style="box-sizing: border-box;">延伸閱讀</span></h2><ul cid="n197" class="ul-list" data-mark="*" mdtype="list" style="background-color: white; box-sizing: border-box; caret-color: rgb(51, 51, 51); color: #333333; font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; margin: 0.8em 0px; padding-left: 30px; position: relative;"><li cid="n198" class="md-list-item md-focus-container" mdtype="list_item" style="box-sizing: border-box; margin: 0px; position: relative;"><p cid="n199" class="md-end-block md-p md-focus" mdtype="paragraph" style="box-sizing: border-box; line-height: inherit; margin: 0px 0px 0.5rem; orphans: 4; position: relative; white-space: pre-wrap;"><span class="md-meta-i-c md-link" md-inline="link" style="box-sizing: border-box;"><a href="https://ben6.blogspot.com/2021/07/ffmpeg-mp3.html" style="-webkit-user-drag: none; box-sizing: border-box; color: #4183c4; cursor: pointer;"><span class="md-plain" md-inline="plain" style="box-sizing: border-box;">ffmpeg 降低聲音品質來縮小 mp3 檔案大小</span></a></span></p></li></ul></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-51064105966628104882020-05-04T14:31:00.003+08:002020-05-13T19:45:46.654+08:00[TIPS] Git 常用指令範例匯整 (Useful use cases)<div class="p1" style="font-family: ".PingFang TC"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br /></div>
<h3 style="font-family: ".PingFang TC"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<span style="font-size: large;">移除已合併的分支</span></h3>
<h4>
<span style="font-weight: normal;">問題</span></h4>
<div class="p1" style="font-family: ".PingFang TC"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
當多人協作時,其他成員 git merge 後,自動刪除來源時,<br />
執行指令 git pull 有出現下列訊息:<br />
<br /></div>
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 80%;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<span style="font-family: "pingfang tc"; font-size: x-small; margin: auto;">Your configuration specifies to merge with the ref 'refs/heads/feature/your-branch-merged'<br />
from the remote, but no such ref was fetched.</span></div>
</div>
<div class="p1" style="font-family: ".PingFang TC"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br /></div>
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br /></div>
<h4 style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
解決方法</h4>
<div class="p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
git update command</div>
<div class="p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br />
使用指令如下擇一:</div>
<div class="p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<br /></div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 80%;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">git remote update -p</span><br />
<div class="p2" style="font-stretch: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"># or</span></div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "pingfang tc"; font-size: x-small;"></span><br /></span>
<br />
<div class="p2" style="font-stretch: normal; line-height: normal;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">git remote update -prune</span></div>
</div>
</div>
<div class="p1" style="font-family: ".pingfang tc"; font-size: medium; font-stretch: normal; line-height: normal;">
<br /></div>
<div class="p1" style="font-stretch: normal; line-height: normal;">
<div style="font-family: times; font-size: medium;">
<br /></div>
<h3 style="font-family: times;">
<span style="font-size: large;">查看 Log 方法</span></h3>
<div style="font-family: times; font-size: medium;">
date: 2020/05/13 v1</div>
<div class="p2" style="font-family: "helvetica neue"; font-size: medium; font-stretch: normal; line-height: normal;">
使用指令範例:</div>
<div class="p2" style="font-family: "helvetica neue"; font-size: medium; font-stretch: normal; line-height: normal;">
<br /></div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div style="font-size: medium;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">git log --oneline # 列出全部的 commits</span></div>
<div style="font-size: medium;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "pingfang tc"; font-size: x-small;"></span><br /></span></div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="font-size: medium;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-size: x-small;">git log --oneline | head -n 5 # </span><span style="font-size: x-small;">列出最近5個 commits</span></span></div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">Learnings$ git log --oneline | head -n 5</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">e4fea6a [new/make] syntax: value script and sorted filter out</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">509768f [new/make] example syntax to filter duplicated item by...</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">289b59d [fix/java] revise code to build on osx with android studio</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">a37b0fe [new/jni] example build script</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">336fce5 [new/py] create image file using pillow</span></div>
</div>
</div>
<div class="p1" style="font-family: ".pingfang tc"; font-size: medium; font-stretch: normal; line-height: normal;">
<br /></div>
<div class="p1" style="font-family: times; font-size: medium; font-stretch: normal; line-height: normal;">
<br /></div>
</div>
<div style="font-family: times; font-size: medium;">
<br /></div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-77297685458824201422019-10-23T14:41:00.003+08:002020-01-03T23:57:23.866+08:00[TIPS] 檢查CPU溫度 Raspberry PI <br />
<h3>
命令</h3>
/opt/vc/bin/vcgencmd<br />
<br />
<h4>
CPU溫度</h4>
<h4>
<table style="background-color: #e8e8e8; border: 1px solid black; color: black; font-size: 12px;"><tbody>
<tr><td><br />
pi@raspberrypi:~ $ /opt/vc/bin/vcgencmd version<br />
<br />
Jul 9 2019 14:40:53<br />
<br />
Copyright (c) 2012 Broadcom<br />
<br />
version 6c3fe3f096a93de3b34252ad98cdccadeb534be2 (clean) (release) (start)<br />
<br />
pi@raspberrypi:~ $ uname -a<br />
<br />
Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux<br />
<br />
pi@raspberrypi:~ $ /opt/vc/bin/vcgencmd measure_temp<br />
<br />
temp=45.1'C<br />
<br /></td></tr>
</tbody></table>
</h4>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-56764324441053963582019-09-23T22:02:00.010+08:002020-08-27T17:59:52.940+08:00阿班 Bash 常用指令範例Last Modified Date: 2020-08-27<br /><div></div>
<span><b><font size="5"><br /></font></b><span><b><font size="5">mkdir</font></b></span><br /><br />Date: 08-27 v1<br /><div><div class="p2" style="font-stretch: normal; line-height: normal;">建立新目錄</div><span style="font-size: medium;"></span><br /><h3>語法</h3><div><br /></div><div><div><div class="p2" style="font-stretch: normal; line-height: normal;"><div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;"><div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;"><div class="p1" style="font-stretch: normal; line-height: normal;"><span face=""><span style="font-size: x-small;">mkdir [-p] <目錄名></span></span></div></div></div></div></div><br /><br /><h3 style="text-align: left;">OPTION</h3>無參數: 如果該目錄不存在,才建立它。若該目錄在則顯示目錄已存在錯誤訊息,並且回傳值為1 </div><div>-p: 如果該目錄不存在,才建立它。若該目錄在則略過,並且回傳值為 0<br /></div><div><h3>範例</h3></div><div class="p2" style="font-stretch: normal; line-height: normal;"><div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;"><div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;"><div class="p1" style="font-stretch: normal; line-height: normal;"><div class="p1" style="font-stretch: normal; line-height: normal;"># mkdir new_directory</div><div class="p1" style="font-stretch: normal; line-height: normal;">#</div><div class="p1" style="font-stretch: normal; line-height: normal;"># mkdir new_directory</div><div class="p1" style="font-stretch: normal; line-height: normal;">mkdir: can't create directory 'new_directory': File exists</div><div class="p1" style="font-stretch: normal; line-height: normal;"># echo $?</div><div class="p1" style="font-stretch: normal; line-height: normal;">1<br /># mkdir -p new_directory</div><div class="p1" style="font-stretch: normal; line-height: normal;"># echo $?</div><div class="p1" style="font-stretch: normal; line-height: normal;">0</div></div></div></div></div></div><b><font size="5"><br /><br />mktemp</font></b></span><br />
<br />
Date: 05-14 v1<br />
<div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
產生暫存檔案或目錄</div>
<span style="font-size: medium;"></span><br />
<h3>
語法</h3>
<div>
<br /></div>
<div>
<div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div class="p1" style="font-stretch: normal; line-height: normal;">
<span face=""><span style="font-size: x-small;">mktemp [OPTION] ... [TEMPLATE]</span></span></div>
</div>
</div>
</div>
</div>
<br />
OPTION<br />
<br />
-u: --dry-run 不產生任何檔案或目錄,只顯示名稱 (不安全, 僅供測試, 因為有可能重複產生)<br /></div>
<div>
<h3>
範例</h3>
</div>
<div class="p2" style="font-stretch: normal; line-height: normal;">
<div style="background-color: #eeeeff; border: 1px solid black; overflow: auto; padding: 10px; width: 522.391px;">
<div class="p1" style="font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;">
<div class="p1" style="font-stretch: normal; line-height: normal;">
<span face=""><span style="font-size: x-small;">bash-5.0#</span><span style="font-size: x-small;"> mktemp -u /you_path/path2/your_prefix.XXXXXXXXXX</span></span><br />
<span face="" style="font-size: x-small;"></span><br />
<span face="" style="font-size: x-small;">/you_path/path2/your_prefix.zjvveu0Ncs</span><br />
<br />
<span face="" style="font-size: x-small;"># mktemp /tmp/your_prefix.XXXXXXXXXX</span><br />
<span face="" style="font-size: x-small;">/tmp/your_prefix.5eEu7vU0zi</span><br />
<span face="" style="font-size: x-small;"># ls -la /tmp/your_prefix.5eEu7vU0zi</span><br />
<span face="" style="font-size: x-small;"></span><br />
<span face="" style="font-size: x-small;">-rw------- 1 test test 0 May 15 00:06 /tmp/your_prefix.5eEu7vU0zi</span></div>
</div>
</div>
</div>
</div>
<br />
<br /><h2><font size="5">read</font></h2><div><font size="5"><br /></font></div><h3>語法</h3><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p><span style="background-color: #fce8b2;">read [argument1] [argument2] ...</span></p></blockquote><h3>範例</h3><div><br /></div><div><h3 style="font-size: 18px; line-height: 1;"><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px; line-height: 1;"><tbody style="line-height: 1;"><tr style="line-height: 1;"><td style="line-height: 1; min-width: 60px;"><p style="line-height: 1;"><font face="courier">bash-5.0# find . -type f | while read filename ; do echo "$fiilename" ; done</font></p></td></tr></tbody></table></h3></div><div><br /></div><br />
<h2 style="text-align: left;">sed</h2>
<div>
刪除空白行</div>
<h3>
語法</h3><div><div><span style="background-color: #fce8b2;"> sed -e "/^$/d" </span></div></div><h3>
範例</h3><div><h3 style="font-size: 18px; line-height: 1;"><br class="Apple-interchange-newline" /><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px; line-height: 1;"><tbody style="line-height: 1;"><tr style="line-height: 1;"><td style="line-height: 1; min-width: 60px;"><p style="line-height: 1;"><span style="font-family: courier;">bash-5.0# echo -e "te\n\nst" | sed "/^$/d"</span></p><p style="line-height: 1;"><font face="courier">te</font></p><p style="line-height: 1;"><font face="courier">st</font></p></td></tr></tbody></table></h3></div><h2>type</h2>
<div>
</div>
<h3>
語法</h3><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><span style="background-color: #fce8b2;">type command1 command2 ...</span></blockquote><h3>
範例</h3><div><h3 style="font-size: 18px; line-height: 1;"><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px; line-height: 1;"><tbody style="line-height: 1;"><tr style="line-height: 1;"><td style="line-height: 1; min-width: 60px;"><p style="line-height: 1;"><font face="courier">bash-5.0# type type</font></p><p style="line-height: 1;"><font face="courier">type is a shell builtin </font></p><p style="line-height: 1;"><font face="courier">type a b</font></p><p style="line-height: 1;"><font face="courier">a is a function</font></p><p style="line-height: 1;"><font face="courier">a ()</font></p><p style="line-height: 1;"><font face="courier">{</font></p><p style="line-height: 1;"><font face="courier"> echo 'a'</font></p><p style="line-height: 1;"><font face="courier">}</font></p><p style="line-height: 1;"><font face="courier">b is a function</font></p><p style="line-height: 1;"><font face="courier">b ()</font></p><p style="line-height: 1;"><font face="courier">{</font></p><p style="line-height: 1;"><font face="courier"> echo 'b'</font></p><p style="line-height: 1;"><font face="courier">}</font></p><p></p></td></tr></tbody></table></h3></div><div dir="ltr" style="background-color: #b0b0b0;" trbidi="on"><div style="margin-left: 10px; margin-top: 10px;"></div></div>
<h2 style="text-align: left;"><font size="5">
xargs</font></h2><h3 style="text-align: left;">語法</h3><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p style="text-align: left;"><span style="background-color: #fce8b2;">xargs [argument1] [argument2] ...</span></p></blockquote><h3 style="text-align: left;">範例</h3><div><br /></div><div><h3 style="font-size: 18px; line-height: 1;"><table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px; line-height: 1;"><tbody style="line-height: 1;"><tr style="line-height: 1;"><td style="line-height: 1; min-width: 60px;"><p style="line-height: 1;"><font face="courier">bash-5.0# find . -type f | xargs wc -l | sed -e "s/^[ \t]*//g"<br /></font></p><p><font face="courier">2 ./b.txt<br /></font><font face="courier"><font style="line-height: 1;">1 ./c.txt<br /></font></font><font face="courier">3 ./a.txt<br /></font><font face="courier"><font style="line-height: 1;">6 total</font></font></p><p></p></td></tr></tbody></table><br /></h3><div style="text-align: left;"><pre><br /></pre></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-79870408920984580222019-09-16T18:11:00.001+08:002019-09-23T22:02:09.953+08:00阿班 Docker 指令備忘範例<h2>
啟動 Docker Container</h2>
<div>
<br /></div>
<h3>
自動啟動 Container</h3>
<div>
編修日期: 2019-9-23<br />
<br /></div>
<h4>
使用情境</h4>
docker machine 重啟後,依設定規則來自動執行對應的 Docker Containers<br />
<h4>
參考文件</h4>
<a href="https://docs.docker.com/config/containers/start-containers-automatically/">https://docs.docker.com/config/containers/start-containers-automatically/</a><br />
<br />
<h4>
語法</h4>
<div dir="ltr" style="background-color: silver; text-align: left;" trbidi="on">
<div style="margin-left: 10px; margin-top: 20px;">
<div style="display: inline-block; font-size: 18px; height: 30px; visibility: visible; width: 480px;">
docker update --restart always container-id [...]</div>
</div>
</div>
<br />
or
<br />
<div dir="ltr" style="background-color: silver; text-align: left;" trbidi="on">
<div style="background-color: silver; margin-left: 10px; margin-top: 20px;">
<div style="display: inline-block; font-size: 18px; height: 30px; visibility: visible; width: 480px;">
docker update --restart always container-name [...]</div>
</div>
</div>
<h4>
範例</h4>
<div dir="ltr" style="background-color: silver; text-align: left;" trbidi="on">
<div style="margin-left: 10px; margin-top: 20px;">
<div style="display: inline-block; font-size: 18px; height: 30px; visibility: visible; width: 480px;">
docker update --restart always my-testapp my-testapp2</div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-79691950631370042732019-06-29T17:54:00.001+08:002019-08-30T00:53:59.488+08:00Bash Tip - Why .bashrc (dot bashrc) not loaded after new user created?<br />
<div>
Recently, I reinstalled ubuntu 16.04LTS on my desktop as a Linux server.<br />
<br />
After a new user created, ssh into the server each time, but .bashrc (dot bashrc) not loaded after new user created? Please try to modify the profile as bellow.<br />
<br />
<h2>
Append some commands into ~/.profile</h2>
<script src="https://gist.github.com/benwei/61f93076f6a25d4624f531d82add0ece.js"></script>
<h2>
result of test-cases.sh example</h2>
</div>
<div style="background-color: #eeeeff; border: 1px solid black; font-size: 0.9em; overflow: auto; padding: 10px; width: 200px;">
~$ source .profile<br />
load /home/ben/.bashrc by ~/.profile<br />
.bashrc has been executed once</div>
<div>
<br /></div>
<div>
<h2>
Appendix</h2>
</div>
<div>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)" target="_blank">wikipedia - Bash_(Unix_shell)</a></li>
<li><a href="https://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html" target="_blank">Bash Guide for Beginners -- Machtelt Garrels</a></li>
<li><a href="http://mywiki.wooledge.org/DotFiles" target="_blank">Configuring your login sessions with dot files</a></li>
</ul>
</div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-19180354618343508032019-05-13T23:17:00.000+08:002019-05-13T23:58:35.353+08:00開源 RISC OS Pi 系統 - 初探<a href="https://www.blogger.com/blogger.g?blogID=8128204435429155560" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<a href="https://www.blogger.com/blogger.g?blogID=8128204435429155560" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=8128204435429155560" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://www.blogger.com/blogger.g?blogID=8128204435429155560" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCzf6qa5O6JAthyrrizu8F41FZAyVmJg7h6OZfajlPHjCW4RtsTrdEgYJ1-ddSlKedBmviLdC7db6v6AqbP6LqB20oqjPEJUtkE4KOuBXFrlXDSg0xoqnBbozp7U8vcrTzboxE2b0WwTxI/s1600/s%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%258812+37+27.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="756" data-original-width="1008" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCzf6qa5O6JAthyrrizu8F41FZAyVmJg7h6OZfajlPHjCW4RtsTrdEgYJ1-ddSlKedBmviLdC7db6v6AqbP6LqB20oqjPEJUtkE4KOuBXFrlXDSg0xoqnBbozp7U8vcrTzboxE2b0WwTxI/s320/s%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%258812+37+27.jpg" width="320" /></a></div>
<br />
<br />
1987 開始發展的RISC OS, 終於在2018年10月以Apache 2.0 License 開源,允許商業使用。<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=8128204435429155560" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<br />
近來忙裡偷閒,用樹梅派最新版本 Raspberry Pi 3 Model B+ 安裝了RISC OS PI ,號稱是ARM 架構下快速也易於客制化的作業系統 (A fast and easily customized operating system for ARM devices)。<br />
<div class="NFQFxe oHglmf xzPb7d viOShc mod" data-md="32" lang="zh-Hant-TW" style="border-radius: 8px; clear: none; padding-bottom: 16px; padding-top: 0px;">
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
初步試用, 它的視窗環境用起來執行程式反應很快(相比Raspbian based X-Window 來說)。</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
並試了一些常用工具都有替代的APP可以使用<br />
Ex: <br />
<ul>
<li>Nettle(ssh/telnet client)</li>
<li>LanMan (Samba client)</li>
<li>NetSurf (Browser) ...</li>
</ul>
<br />
<br />
不過還需要更多開源高手投入時間進一步改善。</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
安裝方式是以NOOBS來安裝 RISC OS PI</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<a href="https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/3">https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/3</a></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsjZP396Ih8UYY2gi7kG4yHTIwXN7Bl-jeUjQe6wkcyBhfr_cxC1JRNgSqehpJ94c1LaDZwFA9SnbCOYpXVkXaXaTkEvf1f22bgv1zcLb68Iis4xACsfT0dL84z0i6P8fZu6pCN69gQzxU/s1600/s_noobs_%25E7%259B%25B8%25E7%2589%2587+2019-5-11+%25E4%25B8%258B%25E5%258D%258810+22+09.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1352" data-original-width="1600" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsjZP396Ih8UYY2gi7kG4yHTIwXN7Bl-jeUjQe6wkcyBhfr_cxC1JRNgSqehpJ94c1LaDZwFA9SnbCOYpXVkXaXaTkEvf1f22bgv1zcLb68Iis4xACsfT0dL84z0i6P8fZu6pCN69gQzxU/s320/s_noobs_%25E7%259B%25B8%25E7%2589%2587+2019-5-11+%25E4%25B8%258B%25E5%258D%258810+22+09.jpg" width="320" /></a></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<br /></div>
<h3 style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: left;">
小結</h3>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
待機耗電量約在 2.93W (4.89V, 0.6A)運行較吃CPU資源大約升高到 3.9W (4.89V, 0.8A),以一個迷你作業系統而言,還算省電。有興趣的朋友可以裝起來試玩看看。</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilgOmvN4DDLdwzt_GyqiqNDvFWKr0NxCff0asasDDcdfEE6GqQSdd_3JGBkbX_GPc3ppepBS0UYNzjxaxUIsh_pZZYAaXsDm68eTbemX8_su7dG0FkHZh7lLzy2ZaJ8wIBrQ-km18e3xUV/s1600/s2%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%25881+52+22.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="907" data-original-width="1210" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilgOmvN4DDLdwzt_GyqiqNDvFWKr0NxCff0asasDDcdfEE6GqQSdd_3JGBkbX_GPc3ppepBS0UYNzjxaxUIsh_pZZYAaXsDm68eTbemX8_su7dG0FkHZh7lLzy2ZaJ8wIBrQ-km18e3xUV/s400/s2%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%25881+52+22.jpg" width="400" /></a></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #222222; font-family: arial, sans-serif; font-size: small; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1UEL45zD7Qt142dwyxT8sT87EE0Z2n1uyW5wnLG-KAvurfO2LtDfyzVGlA_sucvCBf40YuQdYQE-axFcccrDO0hCGkarH7Bvfa7WyO43bF-HCBSzKceACwFcgssHj3Rdk4PPPqzLQ_L8E/s1600/s3%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%25881+40+47.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="907" data-original-width="1210" height="298" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1UEL45zD7Qt142dwyxT8sT87EE0Z2n1uyW5wnLG-KAvurfO2LtDfyzVGlA_sucvCBf40YuQdYQE-axFcccrDO0hCGkarH7Bvfa7WyO43bF-HCBSzKceACwFcgssHj3Rdk4PPPqzLQ_L8E/s400/s3%25E7%259B%25B8%25E7%2589%2587+2019-5-12+%25E4%25B8%258A%25E5%258D%25881+40+47.jpg" width="400" /></a></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<h2 style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
參考資料</h2>
<ul style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<li><a href="http://www.davidhill.co/risc-os-star-commands/" target="_blank">Link: RISC OS Star Commands</a></li>
</ul>
<ul style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<li><a href="https://lb.raspberrypi.org/forums/viewtopic.php?t=22093" target="_blank">STICKY: New to RISC OS? Read this</a></li>
</ul>
<ul style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<li><a href="https://zh.wikipedia.org/wiki/RISC_OS" target="_blank">Wikipedia RISC_OS</a></li>
</ul>
<ul style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<li><a href="https://www.riscosopen.org/news/articles/2018/10/22/risc-os-is-open-for-business" target="_blank">Link: RISC OS is open for business!</a></li>
</ul>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<br /></div>
<h2 style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
延伸閱讀</h2>
<ul style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;">
<li><a href="https://ben6.blogspot.com/2012/12/cubieboard.html" target="_blank">Cubieboard 耗電量實測</a></li>
<li><a href="https://ben6.blogspot.com/2012/07/f4osstm32f407.html" target="_blank">F4OS與STM32F407的那些事兒?</a></li>
</ul>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-21897578451469858362019-05-09T12:23:00.000+08:002019-05-09T12:24:30.518+08:00DevOps Tip - Got error - not found aws-iam-authenticator for kubectl using?<br />
<h2>
Problem</h2>
<div>
I've got error to run kubectl command with <span style="background-color: #f6f6f6;">aws-iam-authenticator not found</span><br />
<span style="background-color: #f6f6f6;"><br /></span></div>
<div style="background-color: #f6f6f6; border: 2px #ccc solid; padding: 10px;">
(venv) ➜ k8s git:(develop) ✗ kubectl get pod<br />
Unable to connect to the server: getting credentials: exec: exec: "aws-iam-authenticator": executable file not found in $PATH</div>
<div>
<br />
<br />
<h2>
Solutions</h2>
</div>
<h3>
Installation tool on OSX Mojave</h3>
<div style="background-color: #f6f6f6; border: 2px #ccc solid; padding: 10px;">
brew install aws-iam-authenticator</div>
<h3>
Example of installation</h3>
<div style="background-color: #f6f6f6; border: 2px #ccc solid; padding: 10px;">
<pre> (venv) ➜ k8s git:(develop) ✗ brew install aws-iam-authenticator
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and caskroom/cask).
==> New Formulae
..
==> Downloading https://homebrew.bintray.com/bottles/</pre>
<pre>aws-iam-authenticator-0.4.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/52...
######################################################################## 100.0%
==> Pouring aws-iam-authenticator-0.4.0.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/aws-iam-authenticator/0.4.0: 5 files, 31.1MB
</pre>
</div>
<h2>
References</h2>
<br />
<ul>
<li><a href="https://docs.aws.amazon.com/en_us/eks/latest/userguide/install-aws-iam-authenticator.html" target="_blank">Amazon EKS Guide - Installing aws-iam-authenticator</a></li>
</ul>
<div>
<h3 style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; margin: 0px; position: relative;">
Extended Reading</h3>
<ul style="line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;">
<li style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;"><a href="https://ben6.blogspot.com/2019/01/devops-tip-1-how-to-use-shared.html" target="_blank">DevOps Tip - How to use shared terraform plugins by -plugin-dir argument?</a></li>
<li style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;"><a href="https://ben6.blogspot.com/2019/01/devops-tip-how-to-use-terraform-apply.html" target="_blank">DevOps Tip - How to use terraform apply without prompt and input yes for CI/CD?</a></li>
</ul>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-57591691399837261122019-04-11T23:51:00.002+08:002019-04-12T00:01:42.992+08:00Python Tip - Examples of initialize variables with sequence number in different ways<h3>
Purpose</h3>
<div>
It is used to collect sample code for python's coding tips of initialization variables.</div>
<div>
<br /></div>
<h3>
A. Variables with constants</h3>
<div>
test_init_vars.py</div>
<h2>
<table border="1" cellspacing="0"><tbody>
<tr><td>#!/usr/bin/env python<br />
<br />
a=0<br />
b=1<br />
c=2<br />
d=3<br />
e=4<br />
f=5<br />
print(a, b, c, d, e, f)</td></tr>
</tbody></table>
</h2>
<div>
<h3>
B. Use range()</h3>
</div>
test_init_vars_by_range.py<br />
<div>
<br />
<table border="1" cellspacing="0"><tbody>
<tr><td>#!/usr/bin/env python<br />
<br />
a, b, c, d, e, f = range(6)<br />
<br />
print(a, b, c, d, e, f)</td></tr>
</tbody></table>
<br />
<h3>
C. Use enum since python 3.4 supported</h3>
<div>
test_init_vars_by_enum.py</div>
<div>
<br />
<table border="1" cellspacing="0"><tbody>
<tr><td>#!/usr/bin/env python3.6<br />
<br />
from enum import IntEnum,auto<br />
<br />
class Vars(IntEnum):<br />
a=0<br />
b=auto()<br />
c=auto()<br />
d=auto()<br />
e=auto()<br />
f=auto()<br />
<br />
print("{}, {}, {}, {}, {}, {}".format(Vars.a, Vars.b, Vars.c, Vars.d, Vars.e, Vars.f))</td></tr>
</tbody></table>
</div>
<div>
<br /></div>
<div>
</div>
<h2>
Result</h2>
<table border="1" cellspacing="0"><tbody>
<tr><td>$ python2.7 test_init_vars.py<br />
(0, 1, 2, 3, 4, 5)<br />
$ python3.6 test_init_vars.py<br />
0 1 2 3 4 5<br />
<div>
<br /></div>
$ python2.7 test_init_vars_by_range.py<br />
(0, 1, 2, 3, 4, 5)<br />
$ python3.6 test_init_vars_by_range.py<br />
0 1 2 3 4 5<br />
<br />
$ python2.7 test_init_vars_by_enum.py<br />
Traceback (most recent call last):<br />
File "test_init_vars_by_enum.py", line 3, in <module></module><br />
from enum import IntEnum,auto<br />
ImportError: cannot import name auto<br />
<div>
<br /></div>
$ python3.6 test_init_vars_by_enum.py<br />
0, 1, 2, 3, 4, 5</td></tr>
</tbody></table>
</div>
<h2>
References</h2>
<ul>
<li><a href="https://ben6.blogspot.com/2011/08/python-c.html">使用Python 直接載入 C 函式庫進行多平台測試</a></li>
<li><a href="https://ben6.blogspot.com/2011/05/python-mac-os-x.html">解決Python 跨平台相容性問題 (Mac OS X)</a></li>
<li><a href="https://ben6.blogspot.com/2012/05/shellcode.html">python + shellcode 實測 64/32</a></li>
<li><a href="https://docs.python.org/3/library/enum.html">python3.4 support for enumerations</a></li>
</ul>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-60023065387671232942019-03-21T18:12:00.000+08:002019-03-21T22:01:50.701+08:00 在執行期取得目前Makefile腳本檔所在的目錄 Absolute Path of current Makefile 含測試結果<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<h3 style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
範例程式取得Makefile所在絕對路徑 (Absolute Path of current Makefile)</h3>
<br />
<script src="https://gist.github.com/benwei/4e9869f7c102de6b785abe7b9d612253.js"></script>
<br />
<h3>
test results on linux</h3>
<div>
<br /></div>
<div>
<script src="https://gist.github.com/benwei/23b495bc2186a6228c4aa6b9b0cda406.js"></script></div>
<div>
<br /></div>
<br />
<h3>
參考</h3>
- <a href="https://www.systutorials.com/241620/how-to-get-the-full-path-and-directory-of-a-makefile-itself/">https://www.systutorials.com/241620/how-to-get-the-full-path-and-directory-of-a-makefile-itself/</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-3166744572980605712019-03-14T23:53:00.001+08:002019-03-15T00:51:19.953+08:00Bash Tip - Run Command with multiple arguments with ssh<br />
<br />
<div>
<br />
This is a note for logging my simple way to use ssh and bash with continuous integration on remote server.<br />
<br />
You can execute the following test-cases.sh on your host.<br />
<br />
It will execute remote script of the test with correct argument contents.<br />
<br />
<h2>
source code of test-cases.sh on host</h2>
</div>
<div>
<br /></div>
<script src="https://gist.github.com/benwei/70b0f532adaa75aef1be3dec7abfc975.js"></script>
<br />
<div>
<br /></div>
<div>
<br />
<h2>
directory layout of tester account on test-server</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRpjZViX0z5GOB1j73ab_UKZGIvAbr0lt7x4jzMQYVGbEDMdL6WmQq7dVff2w1IwKLrVaYo-ccA-1qhx4eaUL2B0tFlIoA-_aksWg5dBzo8FqaMjV4cvxpu2w8H5TdBafCBoeUqx1gr-rG/s1600/1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="201" data-original-width="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRpjZViX0z5GOB1j73ab_UKZGIvAbr0lt7x4jzMQYVGbEDMdL6WmQq7dVff2w1IwKLrVaYo-ccA-1qhx4eaUL2B0tFlIoA-_aksWg5dBzo8FqaMjV4cvxpu2w8H5TdBafCBoeUqx1gr-rG/s1600/1.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h2 style="clear: both; text-align: left;">
source code of tests.sh on test-server</h2>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<script src="https://gist.github.com/benwei/a31de51069aa31dc54f355bc5d599892.js"></script></div>
<div>
<br /></div>
<h2>
result of test-cases.sh example</h2>
source ./test-cases.sh</div>
<div>
<div>
<div>
➜ ~ run_cases "\"1\"\"" "b'\"" "c'#\"" "\"\"" "\'"</div>
<div>
ssh test-server cd test-cases; /bin/bash ./tests.sh "\"1\"\"" "b\'\"" "c\'\#\"" "\"\"" "\\'"</div>
<div>
argv[1]=["1""]</div>
<div>
argv[2]=[b\'"]</div>
<div>
argv[3]=[c\'\#"]</div>
<div>
argv[4]=[""]</div>
<div>
argv[5]=[\\']</div>
<div>
<br /></div>
</div>
<h2>
Notes</h2>
printf %q is use to make safe quote the argument if hashtag(#), quote('), double quote(") and so on.<br />
<br />
<h2>
Appendix</h2>
<br />
<ul>
<li><a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)" target="_blank">wikipedia - Bash_(Unix_shell)</a></li>
<li><a href="https://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html">Bash Guide for Beginners -- Machtelt Garrels</a></li>
</ul>
</div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-68196937744238376272019-02-22T23:47:00.000+08:002019-02-23T00:04:35.912+08:00Bash Tip - Use bash to implement like C's argc and argvTest bash script capacity<br />
<br />
I want to show how to write the advanced bash script with shift and array.<br />
Feature:<br />
<br />
<ul>
<li>filter the arguments with '-' leading character as options</li>
<li>the following inputs are the data arguments</li>
</ul>
<br />
<br />
Tested environments:
- bash 4.3.48 x86_64-pc-linux-gnu ubuntu-16.04.4 LTS
<br />
<br />
<script src="https://gist.github.com/benwei/9169dba050272967b3405353c1807e81.js"></script>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-20087618556991076012019-01-30T23:45:00.003+08:002019-01-30T23:45:45.895+08:00DevOps Tip - How to use terraform apply without prompt and input yes for CI/CD?<h3>
Problem</h3>
Took a memo about integration of CI/CD applied by terraform without prompt to input 'yes'<br />
It is annoying to input yes every time if you already make sure already by `terraform plan`.<br />
On the other hand, I need to integrate with different system for CI/CD. I need a way to approve it automatically.<br />
By tests with commands official documents, I found the correct command and arguments.<br />
<br />
<h3>
Tested Solutions</h3>
<br />
terraform apply -input=false -auto-approve<br />
<br />
or as my test, you can shorten to the following command<br />
<br />
terraform apply -auto-approve<br />
<br />
<h3>
Test Environments</h3>
<div>
<ul>
<li>Ubuntu 16.04.04 LTS</li>
<li>OSX 10.14</li>
</ul>
</div>
<h3>
Reference:</h3>
<br />
<ul>
<li><a href="https://learn.hashicorp.com/terraform/development/running-terraform-in-automation">https://learn.hashicorp.com/terraform/development/running-terraform-in-automation</a></li>
</ul>
<br />
<br />
<h3>
Extended Reading</h3>
<br />
<ul>
<li><a href="https://ben6.blogspot.com/2019/01/devops-tip-1-how-to-use-shared.html" target="_blank">DevOps Tip - How to use shared terraform plugins by -plugin-dir argument?</a></li>
</ul>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-16297505488701826342019-01-29T17:09:00.005+08:002019-01-30T23:47:04.885+08:00DevOps Tip - How to use shared terraform plugins by -plugin-dir argument?<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<h3>
<span style="font-family: inherit;">Problem</span></h3>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">If you executed `terraform init`, you may already have the .terraform in your folder.</span></div>
<span style="font-family: inherit;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: inherit;">Because you may have many terraform repo<span style="background-color: white; color: #222222; font-size: 16px;"> similar to another,</span> you can use the -plugin-dir to reduce the usage of disk space.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: inherit;"><span style="color: black; font-size: 10.5pt; vertical-align: baseline; white-space: pre;"><br /></span>
<span style="color: black; font-size: 10.5pt; vertical-align: baseline; white-space: pre;">As a shared plugins so that we don’t need many copies of plugins into different locations.</span></span></div>
<h3>
Example</h3>
<div>
<ul>
<li><span style="font-family: inherit;">Here I used my OSX Macbook as a Demo Environment.</span></li>
</ul>
</div>
<div>
====================<br />
<span style="font-family: inherit;"> cd /build/setupdev/</span></div>
<span style="font-family: inherit;"> sudo mkdir -p <span style="font-size: 14px; white-space: pre-wrap;"> /opt/terraform/terraform.d</span></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: inherit;"><span style="background-color: transparent; color: black; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> mv .terraform/plugins</span><span style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> to /opt/terraform/terraform.d/plugins</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div style="color: black; font-size: medium; font-style: normal; font-weight: 400; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div style="margin: 0px;">
<br /></div>
</div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: inherit;">
</span>
<br />
<ul>
<li><span style="background-color: transparent; color: black; font-family: inherit; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">Please run the following command to apply it.</span></li>
</ul>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div>
<span style="font-family: inherit;"> ====================</span></div>
<div>
</div>
<span style="font-family: inherit; font-size: 10.5pt; white-space: pre-wrap;"> terraform init -input=false \</span><br />
<span style="font-family: inherit; font-size: 10.5pt; white-space: pre-wrap;"> -plugin-dir=/opt/terraform/terraform.d/plugins/darwin_amd64</span></div>
<div>
<br />
<span style="font-family: "times";"><br /></span>
<br />
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAyfPsFuYZFkZs6T1k9NUjUi_RhneZ0CIFRPHeeVCfDrNuhB5USr8Zv2KsQyVOfrYJ_9yWt5g2xnQ-ppnHOS3lDh4tU_kOJKvXKjofc-BEQ3BSlv4TA0FJj0W2Wiy_7gxXvlDmQWRaN19y/s1600/Screen+Shot+2019-01-29+at+17.02.52.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1032" data-original-width="1600" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAyfPsFuYZFkZs6T1k9NUjUi_RhneZ0CIFRPHeeVCfDrNuhB5USr8Zv2KsQyVOfrYJ_9yWt5g2xnQ-ppnHOS3lDh4tU_kOJKvXKjofc-BEQ3BSlv4TA0FJj0W2Wiy_7gxXvlDmQWRaN19y/s400/Screen+Shot+2019-01-29+at+17.02.52.png" width="400" /></a></div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
<br /></div>
</div>
</div>
<h3>
<span style="background-color: transparent; color: black; font-family: inherit; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Tree of .terraform</span></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHJfADk294TzYbEsBW_GtGIjfxpXZElWkFJtlCscqTdIW8sd6uogqLb-0jUP7BszgeqvtWjKJkURkwP7MN46Wbvq2tD7Hs1-ZVM67tjXbYtW1KLJptO1pm6VmZUmQ5X5k9fJxDxuNC6rnf/s1600/Screen+Shot+2019-01-29+at+16.54.54.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="620" data-original-width="1104" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHJfADk294TzYbEsBW_GtGIjfxpXZElWkFJtlCscqTdIW8sd6uogqLb-0jUP7BszgeqvtWjKJkURkwP7MN46Wbvq2tD7Hs1-ZVM67tjXbYtW1KLJptO1pm6VmZUmQ5X5k9fJxDxuNC6rnf/s400/Screen+Shot+2019-01-29+at+16.54.54.png" width="400" /></a></div>
<h3 style="clear: both; text-align: left;">
<span style="font-family: inherit;">
Tree of terraform plugins</span></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidik6SxwZOJVmf_4Kf9NTSd_BEiyXtucGovhkf1EVizRAiXYsyF4q6td_CWfWWq2gdDS_o9NOwIWWZl8Fys8O5jyx_doaq4fkoq6zHF2mWScfQTi_LgQKxloX1RZCbM1fwNuJ7tkZuDChf/s1600/Screen+Shot+2019-01-29+at+16.56.03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="696" data-original-width="1244" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidik6SxwZOJVmf_4Kf9NTSd_BEiyXtucGovhkf1EVizRAiXYsyF4q6td_CWfWWq2gdDS_o9NOwIWWZl8Fys8O5jyx_doaq4fkoq6zHF2mWScfQTi_LgQKxloX1RZCbM1fwNuJ7tkZuDChf/s400/Screen+Shot+2019-01-29+at+16.56.03.png" width="400" /></a></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<h3>
<span style="font-family: inherit;">Reference</span></h3>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br />
<ul>
<li><a href="https://learn.hashicorp.com/terraform/development/running-terraform-in-automation" style="font-family: inherit; font-size: 11pt; white-space: pre-wrap;">https://learn.hashicorp.com/terraform/development/running-terraform-in-automation</a></li>
</ul>
<br />
<br />
<h3 style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; margin: 0px; position: relative;">
Extended Reading</h3>
<br />
<ul>
<li><a href="https://ben6.blogspot.com/2019/01/devops-tip-how-to-use-terraform-apply.html" target="_blank">DevOps Tip - How to use terraform apply without prompt and input yes for CI/CD?</a></li>
</ul>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-47171349758659789652019-01-27T17:01:00.003+08:002019-01-30T00:08:02.473+08:00OrangeOS's 作業系統實現範例出現微軟防毒Defender的誤偵測<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPocp678s8cAvAgbTa59N5N0BfZUT9wzuYAFGsrULNwX4F_OxQurFJ8k3C8AosA1tq-UnRV-24c00V6y87nYcZLwj8yahUAVItqKsWq2N5O4Bv5OfwFPVvXUXrXbuTULBc9QZftDJwosMu/s1600/window_defender_dos_killmbr0.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="605" data-original-width="546" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPocp678s8cAvAgbTa59N5N0BfZUT9wzuYAFGsrULNwX4F_OxQurFJ8k3C8AosA1tq-UnRV-24c00V6y87nYcZLwj8yahUAVItqKsWq2N5O4Bv5OfwFPVvXUXrXbuTULBc9QZftDJwosMu/s320/window_defender_dos_killmbr0.JPG" width="288" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
年關將近,最近繼續在整理舊書,偶然間翻到了一本放了很久的舊書 OrangeOS's 一個作業系統的實現。</div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
在Windows 10 系統中,想試試它的範例,發現 a.img 檔案複製不過來,覺得十分奇怪。</div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
突然跳出病毒移除警告,微軟的防毒軟體偵到 Trojan: DOS/Killmbr。<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIk1qoW09Hb7lFgH6OyUM3469zhdG3UdRyjjl1Oddv4DIxIEzlCltkM_tddB57YvRW7syQWI3KKXDhUjBcb9TUJ7vYdKwNC1eSGwSIyXjM-Ae6C2u5HN6W0x5nabVP5i0fmqipflGJz0U/s1600/window_defender_dos_killmbr_if_copying_a_img.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="313" data-original-width="449" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIk1qoW09Hb7lFgH6OyUM3469zhdG3UdRyjjl1Oddv4DIxIEzlCltkM_tddB57YvRW7syQWI3KKXDhUjBcb9TUJ7vYdKwNC1eSGwSIyXjM-Ae6C2u5HN6W0x5nabVP5i0fmqipflGJz0U/s320/window_defender_dos_killmbr_if_copying_a_img.JPG" width="320" /></a></div>
<br /></div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
出現的路徑剛好是範例1的Hello World boot.asm 所對應的檔案 a.img</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxZG1iLPU0k2WEGJNnERciYa8tIOgpqNAS0AatA_GJGCgfH9xlDpDgVGvL0A2Ex1gfQsOBEpW_KlYubcRa923stJetF5_NnTB3kkLQ01vjTYwPLnjo4qG9mU9FEyd7ZrZT8j16kFz-eey/s1600/window_defender_dos_killmbr.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="545" data-original-width="550" height="317" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxZG1iLPU0k2WEGJNnERciYa8tIOgpqNAS0AatA_GJGCgfH9xlDpDgVGvL0A2Ex1gfQsOBEpW_KlYubcRa923stJetF5_NnTB3kkLQ01vjTYwPLnjo4qG9mU9FEyd7ZrZT8j16kFz-eey/s320/window_defender_dos_killmbr.JPG" width="320" /></a></div>
<h2>
程式碼</h2>
<div>
原本的測試範例沒有Makefile, 筆者寫了一個測試用的<a href="https://gist.github.com/benwei/3d29ac4a59c437ac63f1fa5d7b1ef8cd" target="_blank">Makefile</a> 以方便在Ubuntu 16.04.4 重覆編譯<br />
<br />
<script src="https://gist.github.com/benwei/3d29ac4a59c437ac63f1fa5d7b1ef8cd.js"></script>
編譯測試檔案</div>
<table border="1" style="border-padding: 1px; border-spacing: 1px;">
<tbody>
<tr><td><pre>/Dev/orangeos/chapter1/a$ make
qemu-img create -f raw a.img 1440k
Formatting 'a.img', fmt=raw size=1474560
mkfs.msdos -s 1 a.img
mkfs.fat 3.0.28 (2015-05-16)
nasm boot.asm -f bin -o boot.bin
dd if=boot.bin of=./a.img bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.000185582 s, 2.8 MB/s
</pre>
</td></tr>
</tbody></table>
<div>
<br /></div>
<h4>
被偵測到有問題的boot.asm 範例</h4>
<br />
<table border="1" style="border-padding: 1px; border-spacing: 1px;">
<tbody>
<tr><td><pre> org 07c00h
mov ax, cs
mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, BootMessage
mov bp, ax
mov cx, 16
mov ax, 01301h
mov bx, 000ch
mov dl, 0
int 10h
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0
dw 0xaa55</pre>
</td></tr>
</tbody></table>
<br />
<br />
<h4>
通Defender 偵測的 boot.asm 範例</h4>
測試 ghaiklor 的 <span style="background-color: white; color: #24292e; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 14px;">Simple boot sector with </span>Hello World 範例編譯沒有問題<br />
source: https://gist.github.com/ghaiklor/89e243a3463569480d01188c9e55e077<br />
<br />
<script src="https://gist.github.com/ghaiklor/89e243a3463569480d01188c9e55e077.js"></script>
<br />
<br />
<br />
<br />
<h3>
執行編譯OK的Hello World </h3>
<div>
Windows 10 pro with qemu / make tools installed by choco</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvUFroCedcx4g2dXC7P_Nzclh5HXrsowGYLKfdOsP3gqA2vEVnYxchBhO5A85C-ek7y0Fvm5jp4k7MTw7z-GAhcNYKAPCwdAuYEukbRL9lC2tmuMIrQx2XtvzBqdF2hNH3rXFK_Gw2NHZ/s1600/window_defender_no_detect_one_on_win10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="637" data-original-width="720" height="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvUFroCedcx4g2dXC7P_Nzclh5HXrsowGYLKfdOsP3gqA2vEVnYxchBhO5A85C-ek7y0Fvm5jp4k7MTw7z-GAhcNYKAPCwdAuYEukbRL9lC2tmuMIrQx2XtvzBqdF2hNH3rXFK_Gw2NHZ/s320/window_defender_no_detect_one_on_win10.JPG" width="320" /></a></div>
<br />
<h2 style="clear: both;">
小結</h2>
<div class="" style="clear: both;">
比較程式的差異,通Defender 偵測的 boot.asm 範例,是比較好的寫法,有做處理停止中斷及結束。<br />
看到偵測有病毒檔案訊息,先不用緊張,確認問題點,調整一下寫法,就可避開 Defender 誤偵測,繼續快樂的作業系統程式開發與研究囉!<br />
<br /></div>
<div>
<h2>
延伸閱讀:</h2>
<br />
<ul>
<li><b style="background-color: white; color: #222222; font-family: sans-serif; font-size: 15.008px;"><a href="https://chocolatey.org/" target="_blank">Chocolatey</a></b><span style="background-color: white; color: #222222; font-family: sans-serif; font-size: 15.008px;">是一個</span>Windows<span style="background-color: white; color: #222222; font-family: sans-serif; font-size: 15.008px;">下類似OSX brew 的軟體套件管理工具 </span></li>
<li><a href="https://www.nasm.us/doc/" target="_blank">NASM - The Netwide Assembler 英文使用手冊</a> </li>
<li><a href="https://ben6.blogspot.com/2011/08/mac-os-xbenosqemu.html" target="_blank">在Mac OS X上編繹BenOS並使用Qemu執行</a></li>
<li><a href="https://ben6.blogspot.com/2011/04/oranges.html" target="_blank">讀"Orange's 一個作業系統的實現"的心得</a></li>
</ul>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8128204435429155560.post-90791606711235720542019-01-21T15:20:00.000+08:002019-01-21T15:20:10.415+08:00如何在Mac上將微軟測試用虛擬機Image的zip 檔案解壓縮到特定目錄?最近工作上,暫時會用到Windows 系統,<br />
配合我的工作機所使用Parallels 虛擬化的軟體,<br />
紀錄一下,在 MAC 上解壓縮微軟測試用虛擬機Image的zip 檔案到特定路徑並設定的方法<br />
<h3>
Step 1: 從微軟網站上下載虛擬機</h3>
<br />
<a href="https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/" target="_blank">下載相關檔案</a>:選擇你要使用的虛擬機版本,及對應的虛擬化平台。<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJKkOnDv0hre3nSibVbSOAWDq4hOy81fBLkqiZ3oaIs2RVBsNu17iBeDkMCt0CDvCyrCDz-hS4qGV8nb4tUzKkVkwmFq0tpQO6URfVBYFAYyX8OV1SxM_L1CYw5Fuku3O04pGn3zEOelye/s1600/Screen+Shot+2019-01-21+at+14.52.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="771" data-original-width="685" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJKkOnDv0hre3nSibVbSOAWDq4hOy81fBLkqiZ3oaIs2RVBsNu17iBeDkMCt0CDvCyrCDz-hS4qGV8nb4tUzKkVkwmFq0tpQO6URfVBYFAYyX8OV1SxM_L1CYw5Fuku3O04pGn3zEOelye/s320/Screen+Shot+2019-01-21+at+14.52.14.png" width="284" /></a></div>
<br />
<br />
<h3>
Step 2: 開啟 Terminal Console (我使用的是 iTerm2.app)</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEY-lE5VluVv3WITkkucPVWBLSF-KeDhFQUij-4oyZNol880NFWBezoI2QkXEALtp6Yx2D0ytLY-PN2BacjTWlEFgZ8zxYwXAoiz_CnT0nRs_Shgh8d29JOEh18-eKybHDw0FkPH3idy68/s1600/Screen+Shot+2019-01-21+at+14.23.08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="626" data-original-width="466" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEY-lE5VluVv3WITkkucPVWBLSF-KeDhFQUij-4oyZNol880NFWBezoI2QkXEALtp6Yx2D0ytLY-PN2BacjTWlEFgZ8zxYwXAoiz_CnT0nRs_Shgh8d29JOEh18-eKybHDw0FkPH3idy68/s320/Screen+Shot+2019-01-21+at+14.23.08.png" width="238" /></a></div>
<br />
<br />
<h3>
Step 3: 確認 unzip 指令在 Mac OS X (10.14.2 ) 的使用方法</h3>
在 terminal console 中輸入 man unzip, 可得知參數 -d exdir<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc4uCNO-dp_lR0NN4R9D-Unc19YFvAyy_XIVKuQDGoi6vg77Anai3G0gg6sAQirZTCd9YktUoXPdPukazfGuUMnSLz7_SCepamSkHyCI5NMyOj6zc5lXycZMl4b6EhRfY8L2TQeI4PxzRD/s1600/Screen+Shot+2019-01-21+at+14.31.49.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1066" data-original-width="1600" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc4uCNO-dp_lR0NN4R9D-Unc19YFvAyy_XIVKuQDGoi6vg77Anai3G0gg6sAQirZTCd9YktUoXPdPukazfGuUMnSLz7_SCepamSkHyCI5NMyOj6zc5lXycZMl4b6EhRfY8L2TQeI4PxzRD/s320/Screen+Shot+2019-01-21+at+14.31.49.png" width="320" /></a></div>
<br />
<br />
<h3>
Step 4: 解壓縮</h3>
以微軟30天測試用 Windows 7 Enterprise 虛擬機器 Parallels 檔案為例:<br />
<br />
➜ unzip IE11.Win7.Parallels.zip -d ~/vmspace/win7/<br />
Archive: IE11.Win7.Parallels.zip<br />
inflating: /Users/tester/vmspace/win7/.DS_Store<br />
creating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/config.pvs<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/floppy.fdd<br />
creating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/harddisk1.hdd/<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/harddisk1.hdd/DiskDescriptor.xml<br />
extracting: /Users/tester/vmspace/win7/IE11 - Win7.pvm/harddisk1.hdd/harddisk1.hdd<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/harddisk1.hdd/harddisk1.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/harddisk1.hdd/harddisk1.hdd.drh<br />
inflating: /Users/tester/vmspace/win7/IE11 - Win7.pvm/VmInfo.pvi<br />
➜ <br /><br />
<h3>
Step 5: 執行 pvm</h3>
即可在 /Users/tester/vmspace/win7 中找到 IE11 - Win7.pvm,點擊 pvm 檔案執行<br /><br /><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVq2tCdIrTiZVs607ve5fPs_4icBzdHzhq6R6-2Sismu4ErWSJCqgBTvInDclRa0N6JcXq0Hitvx8vhp8FquR1aQQG8k43JtMHq7wDAekueCRF2z0T8RTbR-HStLLsWp7LWWSUzLcBLfdn/s1600/Screen+Shot+2019-01-21+at+14.56.51.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="214" data-original-width="1076" height="63" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVq2tCdIrTiZVs607ve5fPs_4icBzdHzhq6R6-2Sismu4ErWSJCqgBTvInDclRa0N6JcXq0Hitvx8vhp8FquR1aQQG8k43JtMHq7wDAekueCRF2z0T8RTbR-HStLLsWp7LWWSUzLcBLfdn/s320/Screen+Shot+2019-01-21+at+14.56.51.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h3 style="clear: both; text-align: left;">
Step 6: 執行後會看到對應的 IE11-Win7 的虛擬桌面</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghwk_IJg1ErSTCNlX-YJMUpI6iai1xl_iEc3YFfFOgJJY_Z8Ukgqdc3tRupD0k9Kcy8XLY6QiaOH6vCt1f_WMh4iZNma7soVIEB2QK6ZcgPavp8tB2pecZqc8IgRXCO4GYfO47Y1jJgFxS/s1600/Screen+Shot+2019-01-21+at+15.00.54.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1260" data-original-width="1504" height="268" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghwk_IJg1ErSTCNlX-YJMUpI6iai1xl_iEc3YFfFOgJJY_Z8Ukgqdc3tRupD0k9Kcy8XLY6QiaOH6vCt1f_WMh4iZNma7soVIEB2QK6ZcgPavp8tB2pecZqc8IgRXCO4GYfO47Y1jJgFxS/s320/Screen+Shot+2019-01-21+at+15.00.54.png" width="320" /></a></div>
<h3 style="clear: both; text-align: left;">
Step 7:安裝 Parallels Tools</h3>
<div class="separator" style="clear: both; text-align: left;">
用以安裝虛擬機平台相關驅動程式及擴充功能,安裝完成後,虛擬機需要重新啟動。</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnPYwpEE1q3PczZlleaIPAS0VQoRVmkp8sfDJWc0Sh-SAwJcAe17cgcfibKXnLrSqtn4HROr7dfESTg5TXgdxk-dnLehyphenhyphenqWEaMyiDiK4kTjoIY5gvcuNHwj9QuIuJu83bcSHNABShowj3V/s1600/Screen+Shot+2019-01-21+at+15.03.08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1082" data-original-width="1280" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnPYwpEE1q3PczZlleaIPAS0VQoRVmkp8sfDJWc0Sh-SAwJcAe17cgcfibKXnLrSqtn4HROr7dfESTg5TXgdxk-dnLehyphenhyphenqWEaMyiDiK4kTjoIY5gvcuNHwj9QuIuJu83bcSHNABShowj3V/s320/Screen+Shot+2019-01-21+at+15.03.08.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<h3>
Step 8: 開始使用測試虛擬機</h3>
<br /><br />
<div class="separator" style="clear: both; text-align: left;">
請注意:虛擬機預設定密碼為 <span style="background-color: white; font-family: base, "Segoe UI", Segoe, "Segoe WP", "Lucida Grande", "Lucida Sans", Verdana, sans-serif; font-size: 15px;">Passw0rd!</span> </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn6cWOE7mgAuBkyl8jMO-O1gHZiyxtrAYNLp77hsaSHUm0ZSTR1zoN9uwKSpuagXilagvL0NcNipbsgI6gflKxEWuCN7uVWlZyqkxP3bw_tmgezgNCXGOrYXHGA9uK8bfKUyn43JU7OJzA/s1600/Screen+Shot+2019-01-21+at+15.17.38.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1428" data-original-width="1600" height="285" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn6cWOE7mgAuBkyl8jMO-O1gHZiyxtrAYNLp77hsaSHUm0ZSTR1zoN9uwKSpuagXilagvL0NcNipbsgI6gflKxEWuCN7uVWlZyqkxP3bw_tmgezgNCXGOrYXHGA9uK8bfKUyn43JU7OJzA/s320/Screen+Shot+2019-01-21+at+15.17.38.png" width="320" /></a></div>
<h3 style="clear: both; text-align: left;">
小結</h3>
<div class="separator" style="clear: both; text-align: left;">
虛擬化平台對於軟體在不同系統開發測試是必要工具,可減少重覆安裝系統的時間,搭配CI (持續整合),更能加速開發進度喔!<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />Unknownnoreply@blogger.com0