tag:blogger.com,1999:blog-80375926897939847632024-03-14T22:58:11.796+08:00Sam's BlogAnonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.comBlogger76125tag:blogger.com,1999:blog-8037592689793984763.post-71413864919140852522017-09-26T11:08:00.000+08:002017-09-26T14:31:18.048+08:00Install sshpass<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Last updated on Sep 26th, 2017 by sammtcbn</span></div>
<b id="docs-internal-guid-dcbd7ef3-bce1-c508-8a94-8aef8ed991e0" style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">[1] Install sshpass on babun </span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">At first, download latest sshpass from sourceforge.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Next, launch babun shell and enter following commands to install it.</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># tar zxfv sshpass-1.05.tar.gz</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># cd sshpass-1.05</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># ./configure</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># make</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># make install</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Then, sshpass.exe will be installed in /usr/local/bin .</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Now I can use sshpass+ssh to login my server from my babun shell.</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># sshpass -p password ssh user@ip</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Example: Login and run command free to check memory usage.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># sshpass -p password ssh -o StrictHostKeyChecking=no user@ip free</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Example: Use sshpass+scp to upload file.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># sshpass -p password scp -o StrictHostKeyChecking=no file user@ip:Path</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">[2] Install sshpass on Ubuntu 16.04.2</span></div>
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ sudo apt-get update</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ sudo apt-get install sshpass</span></div>
<div>
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-14196051489025213742017-09-05T18:27:00.002+08:002017-09-06T10:00:02.160+08:00<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">automake 筆記</span></div>
<b id="docs-internal-guid-d0722786-5199-b390-64b3-4d6c74e03078" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls hello.c</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cat hello.c</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 451.27559055118115pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
#include stdio.h<br />
<pre><stdio .h="">
int main (void)
{
printf ("hello\n");
return 0;
}
</stdio></pre>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">
</span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ autoscan</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autoscan.log configure.scan hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cp configure.scan configure.ac</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ vi configure.ac</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 451.27559055118115pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># -*- Autoconf -*-</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Process this file with autoconf to produce a configure script.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_PREREQ([2.69])</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: red; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AM_INIT_AUTOMAKE(hello, 1.0)</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_CONFIG_SRCDIR([hello.c])</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_CONFIG_HEADERS([config.h])</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Checks for programs.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_PROG_CC</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Checks for libraries.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Checks for header files.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Checks for typedefs, structures, and compiler characteristics.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Checks for library functions.</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AC_OUTPUT</span><span style="background-color: transparent; color: red; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">(Makefile)</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autoscan.log configure.ac configure.scan hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ aclocal</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 autom4te.cache autoscan.log configure.ac configure.scan hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ autoheader</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 autom4te.cache autoscan.log config.h.in configure.ac configure.scan hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ autoconf</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 autoscan.log configure configure.scan</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autom4te.cache config.h.in configure.ac hello.c</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ vi Makefile.am</span></div>
<div dir="ltr" style="margin-left: 0pt;">
<table style="border-collapse: collapse; border: none; width: 451.27559055118115pt;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border-bottom: solid #000000 1pt; border-left: solid #000000 1pt; border-right: solid #000000 1pt; border-top: solid #000000 1pt; padding: 5pt 5pt 5pt 5pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">bin_PROGRAMS=</span><span style="background-color: transparent; color: red; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">hello</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: red; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">hello</span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">_SOURCES=</span><span style="background-color: transparent; color: blue; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">hello.c</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ touch NEWS README AUTHORS ChangeLog</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ automake --add-missing</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 autoscan.log config.h.in configure.scan hello.c Makefile.am NEWS</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AUTHORS ChangeLog configure COPYING INSTALL Makefile.in README</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autom4te.cache compile configure.ac depcomp install-sh missing</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ./configure</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 compile configure hello.c Makefile.in</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AUTHORS config.h configure.ac INSTALL missing</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autom4te.cache config.h.in configure.scan install-sh NEWS</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autoscan.log config.log COPYING Makefile README</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ChangeLog config.status depcomp Makefile.am stamp-h1</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ make</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">make all-am</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">make[1]: Entering directory '/home/samlin/hello'</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">gcc -DHAVE_CONFIG_H -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">mv -f .deps/hello.Tpo .deps/hello.Po</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">gcc -g -O2 -o hello hello.o</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">make[1]: Leaving directory '/home/samlin/hello'</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ls</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">aclocal.m4 ChangeLog config.log configure.scan hello.c Makefile NEWS</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">AUTHORS compile config.status COPYING hello.o Makefile.am README</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autom4te.cache config.h configure depcomp INSTALL Makefile.in stamp-h1</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">autoscan.log config.h.in configure.ac hello install-sh missing</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ./hello</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">hello</span></div>
</div>
Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-12718054673577279822014-12-08T14:04:00.002+08:002014-12-08T14:07:03.009+08:00在 Freebsd 上安裝 NIS Client<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">本篇介紹在 Freebsd 上建立 NIS Client 的步驟。</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">我的 OS 為 Freebsd 10.1 。</span></div>
<b id="docs-internal-guid-a070a065-2880-23ff-8539-6ec86196ed20" style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">首先,編輯 /etc/rc.conf,新增如下兩行。nisdomainname這行用來指定 NIS Server 的domain name,所以將之指定成跟 NIS Server 使用一樣的名字。</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nisdomainname="vmnism"</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">nis_client_enable="YES"</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">然後使用 vipw 指令編輯密碼檔,在最下面加入如下行:</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+:::::::::</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">再來使用編輯器在 /etc/group 最後面加上這行:</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">+:*::</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">編輯以上三個檔案就已經設定完成,如果要馬上可以運作,執行底下這兩行指令即可。不然的話,重新開機也是可以。</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># /etc/netstart</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># service ypbind start</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">要知道有沒有成功使用 NIS Server 提供的帳號資訊,可以在 NIS Client 機器上執行 ypcat passwd ,如果有成功連上 NIS Server,則會顯示 NIS Account 的資訊,我的範例如下:</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">root@bsd101:/usr/home/sam # ypcat passwd</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re63:*:2170:4000:User &:/home/re63:/bin/csh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re1026:*:3133:4000:User &:/home/re1026:/bin/csh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re1107:*:3214:4000:User &:/home/re1107:/bin/csh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re15892:*:17953:4000:User &:/home/re15892:/bin/csh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">re15973:*:18034:4000:User &:/home/re15973:/bin/csh</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">有正確連上 NIS Server 的話,用 domainname 指令也可顯示目前 NIS Client 機器上使用的 NIS domainname 是哪組。</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># domainname</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">vmnism</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">最後,ssh 時也可以使用 NIS Account 來 login 了,大功告成。</span></div>
<b style="font-weight: normal;"><br /></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ref:</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<a href="https://www.freebsd.org/doc/handbook/network-nis.html" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">https://www.freebsd.org/doc/handbook/network-nis.html</span></a></div>
<br />
<span id="docs-internal-guid-a070a065-2882-7759-67b2-63cb9b39d41f"><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Last updated on </span><span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Dec 8th, 2014</span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"> by Sam Lin</span></span>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-38055266590177467582014-01-15T11:41:00.000+08:002014-01-15T11:41:10.152+08:00PHP 去除 ASCII 控制字元<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Last updated on </span><span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Jan 15th, 2014</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> by Sam Lin <</span><a href="mailto:samlin35@gmail.com" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">samlin35@gmail.com</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">></span></div>
<b id="docs-internal-guid-7651d7fa-93fc-bfbc-cb16-81a647301425" style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">在寫一段 PHP 將檔案每一行讀出來並且用 XML 輸出的程式,結果意外地出現了錯誤。我將該行寫成 xml 並使用瀏覽器來看,顯示錯誤如下圖。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><img height="262px;" src="https://lh6.googleusercontent.com/xMDUQkqUV76SRV-apCRqMYLRUM4Svpf0rDnBctoIw_YS-_rtLWoCuCsOteuaTnR0WqU1Ez7qKc3L-haLs6eZs-6Tl3RFprZhNx-zlcJ1jsKXbENJWSP-gLXlHg" style="border: 0px solid transparent;" width="399px;" /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<b style="font-weight: normal;"><br /></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">使用 wget 將 test.xml 抓了下來,使用編輯器顯示其 hex,如下:</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><img height="89px;" src="https://lh6.googleusercontent.com/UXz_SQHLIY63P1lGPktmJKV5sgd6G0y4B81qNq70zQG3ibh7xf6FnOwichUQfKp8R4pq5aE4rFWlfXcptCOURKzOfnrol-3b4o0aCDMVfXoBZEat3tYQdtvNAw" style="border: 0px solid transparent;" width="624px;" /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">從上圖看到反白的字元 1F 恍然大悟,原來是 ASCII 的特殊字元所造成 xml 顯示錯誤。從 </span><a href="http://zh.wikipedia.org/wiki/ASCII" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Wikipedia ASCII</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> 可以知道從 0x00 到 0x 1F 都是 ASCII 的控制字元,所以如果我們要用 PHP 輸出的話,最好先過濾掉這些字元。要過濾的話,可以使用 preg_replace 這個 function 。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">範例如下,</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$output = preg_replace('/[^(\x20-\x7F)]*/','', htmlspecialchars($dumpstring));</span></div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">echo $output;</span>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-29965245911821362022014-01-11T01:01:00.003+08:002014-01-11T01:04:22.163+08:00遠通駭客事件之我感<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">看到遠通最近被駭的事件,姑且不論是真有其事或是誤會一場,但讓我想到開發一個系統或是將系統外包,驗收時業主應該都是針對功能去驗收,不曉得是否會針對系統安全性去做驗收呢?承包商開發時是否也會自發地在程式或系統中多注意系統的漏洞、程式的漏洞?</span></div>
<b id="docs-internal-guid-0aea72b5-7d1c-2144-8720-7d45bb5c21b4" style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">之前修一門系統安全的課程,老師提及了很多關於系統安全、病毒、惡意程式等等的介紹,並且也講了一些案例讓我們了解這重要性,甚至當場示範連到某政府官網,在頁面上輸入一些特別的字串 (使用 SQL injection 的做法),結果網頁可以查到民眾的部份個資,當下那一刻真是讓我們大開眼界,而且也讓我意識到,寫程式不只是把功能做好就好了,一些疏忽的漏洞反而帶來更大的危害。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">但是一般的程式撰寫的書,或是老師上課,都是教我們如何寫程式、如何把需要的功能寫出來,但是卻很少在教我們寫較安全的程式。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">說到系統安全,我想起曾經念某所大學 (打馬賽克,請勿人肉),而校方有開給每位學生 Unix 帳號,可能一般大家也不大會去使用,頂多進去看看信,不過有次我就連進那台 Unix 主機,在一些路徑切換著,意外地在某路徑發現很神奇的 meta file ,我 vi 一看檔案內容,疑似存著改過密碼的 user 列表及密碼,然後我就偷偷地存起來。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">當時那年代還在用電話撥接才能連上 Internet,而且是透過學校提供的帳號密碼才行,我無聊試試這些存下來的帳密,結果還真可以使用,我畢業後,學生帳號被刪除了,但是我還有這多組可以讓我繼續撥接。</span></div>
<br /><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">說這次的經驗不是要說我多厲害,而且我也只是到一些路徑逛逛而已,並不高招,但是這樣容易洩漏重要資訊的做法,是否你我之間都會犯錯呢?</span></div>
Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-44543691964606039962014-01-10T17:41:00.003+08:002014-01-11T01:15:04.943+08:00shell script 裡取絕對值<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Last updated on </span><span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Jan 10th, 2014</span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"> by Sam Lin <</span><a href="mailto:samlin35@gmail.com" style="line-height: 1.15; text-decoration: none;"><span style="color: #1155cc; font-family: Arial; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">samlin35@gmail.com</span></a><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">></span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">我臨時需要在 shell script 裡計算絕對值,經我參考一些網路上的文章與討論後,最後找到這樣的方法是可行的,寫成筆記並且跟大家分享。下面範例重點就在於 $price_down 這個變數後面使用 #- ,就可以將參數變成絕對值了。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">My environment: Freebsd 9.2</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ cat abs_ex.sh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/sh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">htc2012=1300</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">htc2013=123</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">price_down=`expr $htc2013 - $htc2012`</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo price_down=$price_down</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">echo abs=${price_down#-}</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$ ./abs_ex.sh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">price_down=-1177</span></div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">abs=1177</span>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com1tag:blogger.com,1999:blog-8037592689793984763.post-63131571452356818892014-01-06T16:14:00.001+08:002014-01-06T16:17:04.231+08:00Clear dmesg in Freebsd<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">My environment: Freebsd 9.2</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">root@freebsd91:/root # </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sysctl kern.msgbuf_clear=1</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">kern.msgbuf_clear: 0 -> 0</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">root@freebsd91:/root # </span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dmesg</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">root@freebsd91:/root #</span></div>
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Last updated on </span><span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Jan 6th, 2014</span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"> by Sam Lin <</span><a href="mailto:samlin35@gmail.com" style="text-decoration: none;"><span style="color: #1155cc; font-family: Arial; font-size: 15px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">samlin35@gmail.com</span></a><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">></span>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-5920638368431381292013-12-24T16:19:00.000+08:002013-12-24T16:21:42.093+08:00configure 時缺少 ncurses<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">OS:ubuntu 13.10</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">有時在對套件做 configure 時會遇到如下訊息,即在系統裡少了 ncurses library。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">configure: error: ncurses or ncursesw selected, but library not found (--without-ncurses to disable)</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">這時只要使用如下指令安裝 ncurses-dev 套件即可。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#</span><span style="background-color: transparent; color: blue; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">apt-get install libncurses-dev</span><br />
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Dec 24th, 2013 by samlin35</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Last Modified on Dec 24th, 2013</span></div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-49815986974123744332013-10-01T01:17:00.000+08:002013-10-01T22:53:03.497+08:00 sh infinite loop<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sh infinite loop</span></div>
<b id="docs-internal-guid-553ebb88-7481-d7df-24d4-d22ad24acdd5" style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Oct 1th, 2013 by Chuan-Hsien Lin</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: #222222; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Last Modified on Oct 1th, 2013</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">有時候我們在 </span><a href="http://en.wikipedia.org/wiki/Unix-like" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">unix-like</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> 的環境底下,需要簡單重複某些動作,例如用在測試程式、或是檢查狀態等等,簡單的方法是使用 </span><a href="http://en.wikipedia.org/wiki/Shell_script" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">shell script</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> 就可以做到這樣的無窮迴圈 (</span><a href="http://en.wikipedia.org/wiki/Infinite_loop" style="text-decoration: none;"><span style="background-color: transparent; color: #1155cc; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">infinite loop</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">),下面範例以 sh 為例,檔名取為 run.sh。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#!/bin/sh</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while :</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">do</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> echo "test"</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> sleep 1</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">done</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">以上程式存檔之後,記得要改為可執行權限,使用 chmod +x run.sh 指令修改其權限。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">然後在 command line 環境下執行 ./run.sh 即可。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">執行結果如下,就會不停地重複 while 裡面的動作。</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ingrasys:~# ./run.sh</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">test</span></div>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">...</span></div>
<div>
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
</div>
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span></div>
Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-11767559522820264302013-05-31T10:45:00.003+08:002013-05-31T10:47:52.255+08:00顯示檔案中第幾行的內容<h2>
顯示檔案中第幾行的內容</h2>
May 31th, 2013 by Chuan-Hsien Lin<br />
Last Modified on May 31th, 2013<br />
<br />
有同事問我怎麼在 Linux 中顯示出檔案中的某一行,像這樣的功能使用 sed 來做是非常簡單地就可以辦到了,由以下的簡單的範例來說明用法。<br />
<br />
[sam@sever ~]$ <span style="color: green;">cat testfile</span><br />
12345<br />
abcdefghijkl<br />
678901234<br />
mnopqrstuvwxyz<br />
[sam@sever ~]$ <span style="color: green;">sed -n '2p' testfile</span><br />
abcdefghijkl<br />
<br />
在 testfile 這個檔案裡有四行文字,接著使用 sed -n '2p' testfile 可以將第二行的內容顯示出來。如果要顯示別行,就將 2 改成該行號即可。Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-43225970645097467912013-01-11T14:33:00.001+08:002013-01-11T14:33:16.769+08:00Fedora 17 更改 host name<span style="font-weight: bold;">Fedora 17 更改 host name</span><br />
<br />
Jan 11th, 2013 by samlin35<br />
<br />
Environment: <br />
OS: Fedora 17 64bit<br />
ip address: 192.168.205.116 (by DHCP)<br />
netmask: 255.255.0.0<br />
hostname: testpc1<br />
<br />
假設我們要將原 host name 是 testpc1 設定成 testpc2,步驟如下:<br />
<br />
1. 使用 root 帳號。<br />
$ <span style="color: green;">su</span><br />
<br />
2. 編輯 /etc/hosts,將 host name 是 testpc1 的字眼都改成 testpc2。我的 /etc/hosts 如下:<br />
<br />
<span style="color: #6633ff;">127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 testpc2</span><br />
<span style="color: #6633ff;">::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 testpc2</span><br />
<br />
3. 編輯 /etc/sysconfig/network,將裡頭的 HOSTNAME 指定成你要的 hostname。我的 /etc/sysconfig/network 如下:<br />
<br />
<span style="color: #6633ff;">NETWORKING=yes</span><br />
<span style="color: #6633ff;">HOSTNAME=testpc2</span><br />
<br />
4. 使用 hostname 指令設定一次。<br />
<br />
# <span style="color: #006600;">hostname testpc2</span><br />
<br />
5. 重新登入後,就會看到提示符號有正常顯示,使用 hostname 指令查看,也可看到已使用新的 hostname 了。<br />
<br />
[sam@testpc2 ~]$<br />
# <span style="color: #006600;">hostname</span><br />
testpc2Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com2tag:blogger.com,1999:blog-8037592689793984763.post-46938092548575504942013-01-11T13:22:00.000+08:002013-01-11T13:22:40.939+08:00Fedora 17 切換 runlevel<span style="font-weight: bold;">Fedora 17 切換 runlevel</span><br />
<br />
Jan 11th, 2013 by samlin35<br />
<br />
如果要讓 Fedora 17 開機後就跑在文字模式 (Text Mode) 下的話,執行:<br />
# <span style="color: green; font-weight: bold;">ln -sf /lib/systemd/system/runlevel3.target
/etc/systemd/system/default.target</span><br />
<br />
如果要跑在圖形模式 (Graphical Mode) 的話,執行:<br />
# <span style="color: green; font-weight: bold;">ln -sf /lib/systemd/system/runlevel5.target
/etc/systemd/system/default.target</span><br />
<br />
以上動作記得使用 root 帳號來執行,不然會出現 Permission denied 的錯誤訊息。<br />
<br />
另外,從 <a href="http://docs.fedoraproject.org/en-US/Fedora/17/html/Installation_Guide/s1-boot-init-shutdown-sysv.html">Fedora Documentation</a> 可以知道 Fedora 現在定義的 Runlevel 如下,並且 level 2, level 4 已不再使用。<br />
<br />
0 — Halt<br />
1 — Single-user text mode<br />
2 — Not used (user-definable)<br />
3 — Full multi-user text mode<br />
4 — Not used (user-definable)<br />
5 — Full multi-user graphical mode (with an X-based login screen)<br />
6 — Reboot<br />
<br />
參考資料:<br />
<ul>
<li><a href="http://docs.fedoraproject.org/en-US/Fedora/17/html/Installation_Guide/s1-boot-init-shutdown-sysv.html">Fedora Documentation</a> </li>
</ul>
Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-13989112374003578812009-11-19T03:30:00.000+08:002009-11-18T13:58:43.332+08:00好閃的便當將近中午,11 點左右,我跟另外兩個同事一起拿便當要去蒸,這已經是我們幾年來的例行公事,就在我們剛踏進茶水間要蒸便當時,突然間竄出了一個同事也來蒸便當,他平常都是訂便當的,怎突然間帶起便當來了,原來是最近剛同居的女友幫他準備的,嗚,好閃阿,他拿著便當盒穿越我們,經過我們身邊時,好像有股風吹了起來,看在我們這些阿宅眼裡,那便當好像有種高高至上的感覺,閃閃發亮,眼睛都快睜不開了。Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com1tag:blogger.com,1999:blog-8037592689793984763.post-66603061262670629222009-11-17T15:01:00.000+08:002009-11-17T02:03:50.254+08:00白目買家<p>我最近新買了台傻瓜相機 Canon S90,所以想把手上的 Canon SX200 賣掉。</p>
<p>話說昨晚接到一通電話讓我喜出望外,是打來要跟我買相機的,於是昨晚就認真的找配件出來整理了一翻,一一的盤點無誤,內心有點忐忑不安,又幾分期待。</p>
<p>然後今天相約在某加樂福,等我們會面後,我拿出包裝來給買家看,結果他臉色一沉,原來他想買的是 Canon SX20,不是我這台
SX200,然後他一直說是我在二手買賣區貼文寫錯,我當然也不相信,因為我都用複製貼上的,已經貼過好多次了,怎可能手殘貼錯呢!明明就是他白目看錯吧!後來買家勉強把玩了一下我的相機,不過我知道他是不會買的,於是我跟他說,『如果不是你要的,
也沒關係啦。』想說也差不多該閃人了,買賣不成仁義在,也不用口出惡言罵他幾句白目!</p>
<p>結果我想說收拾一下要閃了,時間還早,還可以回公司加班趕東西,結果他好意的說要請我喝飲料,想說不喝白不喝,於是我們就在美食街坐下來聊天,聊了很多攝影方面的東西,其實我是還蠻想離開的,不過喝人家請的飲料,就陪他聊幾句也罷!大概聊了約半小時飲料都喝完後,我們就各自解散了,結束了這場鬧劇。</p>
<p>今天真的是遇到白目的買家了。</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-39864632254673446752009-07-15T10:16:00.000+08:002009-07-14T19:30:14.290+08:00Linux 上使用 NTFSLinux 上使用 NTFS
<p>July 14th, 2009 by Chuan-Hsien Lin <br>
Last Modified on July 14th, 2009 </p>
<p>先來說說我的環境,我是使用一塊 ARM 相容的開發板,Linux Kernel 採用 2.6.22.18。</p>
<p>可以看的出來,硬碟中有個 NTFS 的 Partition。</p>
<blockquote>
<pre>
-sh-3.2# fdisk -l
Disk /dev/sda: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 123 987966 7 HPFS/NTFS </pre>
</blockquote>
<p>尚未在 Linux Kernel 勾選支援 NTFS,直接去掛載 NTFS Partition 會出現問題。</p>
<blockquote>
<p> -sh-3.2# mount -t ntfs /dev/sda1 /mnt/hd1<br>
mount: mounting /dev/sda1 on /mnt/hd1 failed: No such device</p>
</blockquote>
<p>由於 Linux Kernel 本身就可支援 NTFS 了,所以我們 make menuconfig 來設定支援 NTFS,</p>
<blockquote>
<p> <*> NTFS file system support <br>
[*] NTFS write support </p>
</blockquote>
<p>再來執行一次 mount,成功的掛載了,</p>
<blockquote>
<p> -sh-3.2# mount -t ntfs /dev/sda1 /mnt/hd1<br>
NTFS volume version 3.1.</p>
<p>-sh-3.2# mount<br>
rootfs on / type rootfs (rw)<br>
/dev/root on / type nfs (rw,vers=2,rsize=4096,wsize=4096,hard,nolock,proto=udp,timeo=11,retrans=2,sec=sys,addr=192.168.51.15)<br>
proc on /proc type proc (rw)<br>
devpts on /dev/pts type devpts (rw)<br>
/dev/sda1 on /mnt/hd1 type ntfs (rw,uid=0,gid=0,fmask=0177,dmask=077,nls=iso8859-1,errors=continue,mft_zone_multiplier=1)</p>
</blockquote> <p>雖然掛載後,但卻是只能讀不能寫入,</p>
<blockquote>
<p>-sh-3.2# touch /mnt/hd1/testfile<br>
touch: /mnt/hd1/testfile: Permission denied</p>
</blockquote> <p>如果想要可以讀寫 NTFS,得使用別的方式,目前比較流行的是使用 ntfs-3g 這個套件。 </p>
<p>安裝好 ntfs-3g 去執行的話,會發現少了 fuse 套件,</p>
<blockquote>
<p> -sh-3.2# ./ntfs-3g /dev/sda1 /mnt/hd1<br>
modprobe: cannot parse modules.dep<br>
ntfs-3g-mount: fuse device is missing, try 'modprobe fuse' as root</p>
</blockquote>
<p>由於後來的 Linux Kernel 裡面都內建了 FUSE 了,所以在 make menuconfig 時指定,</p>
<blockquote>
<p> <*> Filesystem in Userspace support</p>
</blockquote>
<p>然後重新編譯 Linux Kernel 後,進到 target board 後再來 mount 一次就可成功了,</p>
<blockquote>
<p> ./ntfs-3g /dev/sda1 /mnt/hd1</p>
</blockquote>
<p>如果要可以格式化 NTFS 的 partition 的話,得再裝另一個套件 nefsprogs,
這套件裡有蠻多針對 NTFS 運作相關的程式,像我就會使用產生出來的 mkntfs 去格式化 NTFS,用 ntfslabel 去寫 label。</p>
<p>相關資源:</p>
<p>ntfs-3g<br>
<a href="http://www.ntfs-3g.org/">http://www.ntfs-3g.org/</a></p>
<p>nefsprogs<br>
<a href="http://www.linux-ntfs.org/">http://www.linux-ntfs.org/</a></p>
<p>NTFS FAQ (中文)<br>
<a href="http://www.linux-ntfs.org/doku.php?id=ntfs-zh_tw">http://www.linux-ntfs.org/doku.php?id=ntfs-zh_tw</a></p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-4783997670359800972009-07-07T02:21:00.000+08:002009-07-09T19:06:12.862+08:00學英語好用連結<p>學英語好用連結</p>
<p>
July 6th, 2009 by Chuan-Hsien Lin<br>
Last Modified on July 9th, 2009
</p>
<p>Yahoo!奇摩新聞 - 英語新聞<br>
<a href="http://tw.digest.news.yahoo.com/">http://tw.digest.news.yahoo.com/</a><br>
</p>
<p>台灣英語網<br>
<a href="http://www.english.com.tw/">http://www.english.com.tw/</a><br>
</p>
<p>english-test.net<br>
<a href="http://www.english-test.net/">http://www.english-test.net/</a><br>
</p>
<p>線上英漢字典與翻譯 - n詞酷<br>
<a href="http://www.nciku.com.tw/">http://www.nciku.com.tw/</a><br>
不只有字典查詢功能,還有豐富的情境會話。可建立自己的單字本,進行測驗。<br>
</p>
<p>Yahoo!奇摩字典<br>
<a href="http://tw.dictionary.yahoo.com/">http://tw.dictionary.yahoo.com/</a></br>
</p>
<p>Google 字典<br>
<a href="http://www.google.com.tw/dictionary">http://www.google.com.tw/dictionary</a><br>
</p>
<p>Longman English Dictionary Online<br>
<a href="http://www.ldoceonline.com/">http://www.ldoceonline.com/</a><br>
</p>
<p>cdict 線上英漢字典<br>
<a href="http://cdict.net/">http://cdict.net/</a><br>
</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-65252866624563503372009-07-05T11:26:00.000+08:002009-07-06T16:35:30.291+08:00Linux 好用網站<p>Linux 好用網站</p>
<p>July 4th, 2009 by Chuan-Hsien Lin<br>
Last Modified on July 6th, 2009</p>
<p>
Jserv's blog<br>
<a href="http://blog.linux.org.tw/~jserv/">http://blog.linux.org.tw/~jserv/</a><br>
</p>
<p>
鳥哥的 Linux 私房菜<br>
<a href="http://linux.vbird.org/">http://linux.vbird.org/</a><br>
</p>
<p>
IBM developerWorks 的 Linux 專區<br>
<a href="http://www.ibm.com/developerworks/linux/">http://www.ibm.com/developerworks/linux/</a><br>
<a href="http://www.ibm.com/developerworks/cn/linux/">http://www.ibm.com/developerworks/cn/linux/</a> (中國)<br>
</p>
<p>
The Linux Kernel Archives<br>
<a href="http://www.kernel.org/">http://www.kernel.org/</a><br>
要下載 Linux Kernel 的 Source code 就是這。
</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-19977811243271524192009-06-23T14:00:00.000+08:002009-06-23T00:02:01.913+08:00被坑的蝦仁炒飯<p>
上週六跟朋友們吃飯,去南崁吃一間義大利麵,
菜單一看,義大利麵平均約兩百塊,飯就比較貴,幾乎都要三百塊,
因為我肚子很餓,所以我不想點麵吃,特地點個飯來吃,
我就選了一個名字很長很長的,ㄟ,名字忘了,
鮪魚 xxxx 蝦仁炒飯,大概有十幾個字組成的一道菜,寫的很好聽,
點餐後,老闆跟我說沒有鮪魚了,於是我就想換別的,
結果老闆強列建議我點原來那道,不希望我換,
說這道很好吃,很推薦,說鮪魚沒有了所以蝦仁會給我多點,
我看老闆這麼堅持,好吧,聽老闆的一次。
</p>
<p>
結果等菜上來後,我發現,這根本就是蝦仁炒飯嘛!
那名字還取的這麼好聽!
然後,我朋友們的義大利麵上來,
竟然看到他們麵裡有鮪魚!
是怎樣!!!!!
</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com2tag:blogger.com,1999:blog-8037592689793984763.post-35566405670022581732009-06-16T13:03:00.000+08:002009-06-15T22:06:04.640+08:00好貴的漫遊費<p>
今天下班回到家後,剛好看到手機帳單寄來了,拆開後嚇了我ㄧ大跳。日前我去美國玩時有用中華電信手機漫遊,當時是用手機打回家裡的市內電話跟媽媽報名安,因為時段不同,所以費率也會不一樣,帳單上列了三筆費用,
</p>
<p>
第一通 14 秒,09:57:41 - 09:57:55,代收漫遊網路費 76.75,台灣處理費 7.68,金額 84.43。</p>
<p>
第二通 37 秒,10:22:25 - 10:23:02,代收漫遊網路費 76.75,台灣處理費 7.68,金額 84.43。</p>
<p>
第三通 25 秒,17:23:15 - 17:23:40,代收漫遊網路費 59.81,台灣處理費 5.98,金額 65.79。</p>
<p>
所以總共三通電話,才講了 76 秒,要花電話費 234 元!我的天啊!真是貴死了,還好當初沒有太長舌。以後有出國的話,要乖乖的用網路電話才是上策。
</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-8805764921269678102009-05-16T12:26:00.000+08:002009-05-16T00:46:02.170+08:00團購靈骨塔<p>自從我們公司有了團購系統後,我們的團購真是源源不絕,而且種類玲瑯滿目,今天就收到一封很嚇人的團購信。</p>
<p style="color: rgb(51, 102, 255);">標題:團購:朋友賣靈骨塔, 友情幫忙, (看?來質量挺高的) -- 截止日:2009/6/30 下午 06:00:00</p>
<p style="color: rgb(51, 102, 255);">內容:</p>
<pre>
<span style="color: rgb(51, 102, 255);">安藤忠雄的生命的殿堂-森的靈園</span>
<span style="color: rgb(51, 102, 255);">http://www.wretch.cc/blog/lunascall/196972</span>
<span style="color: rgb(51, 102, 255);">有興趣的可以聯絡0933xxxxxx 小彭</span>
</pre>
<p>這是怎樣,以後大家掛了之後當鄰居嗎?XD</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-46319852967687874502009-05-06T23:40:00.000+08:002009-05-06T23:46:54.327+08:00美簽面試<p>終於到了要美簽面試的日子了,預約的時間是今天早上 7:45,這時間還真早呢!當初在網路上預約時,故意挑很早的時間,看是否會因為很早而人潮少點,到了現場才知道錯了。</p>
<p>預約的時間是一大早,所以我 6 點初就起床了,真是要命的早!然後飆了一個小時的車終於抵達美國在台協會,然後就在 AIT 門口大排長龍下等待了。在門口有個指揮及宣導的工作人員,一臉臭臭地穿梭在排隊人潮中,三番兩次地一直提醒一些事項,態度一點也不親切,場面充滿著肅殺之氣,害我以為進入 AIT 之後接連而來的將是一場硬仗!</p>
<p>等進入 AIT 後,到了一個大廳,裡面又是滿滿的排隊人潮,倒是都很有秩序就是了。接下來就是有四道關卡等著你一一破關:1.資料處理 2.指紋掃描 3.面談 4.快遞。不過在打這四關前,還得先打一小關卡,就是源訊科技的櫃檯,會先基本地看過每個人帶來的申請表格有沒有遺漏等等,會提醒你要補填,以及會整理帶來的匯款收據,已確認申請者繳費。</p>
<p>第一關 - 資料處理,沒做什麼,就只是把申請文件收去,也不知他做了什麼就好了。</p>
<p>第二關 - 指紋掃描,就是把你每隻手指的指紋都給掃描,現場只有兩個窗口在做指紋掃描,
我看過關速度這麼慢,大概就是卡在這關了,因為有很多人反覆地一直掃描,可能是指紋不清楚怎的。</p>
<p>第三關 - 面試,就是最最最重要的一關了。為了這關,我可是昨天辛苦地在公司申請在職證明,簽到部門主管又簽到總經理那才辦下來,然後我自己又將我們美國行的航班資訊、住宿資訊、旅遊行程等資料都印出來,以便官員如果臨時抽問的話;另外,我還把所得稅扣繳憑單也都準備了,希望對面試有所幫助。</p>
<p>有四個窗口是在做面試,有三個老外兩男一女,一個華裔美國女生,有時說英文有時說中文,
我發現最左邊的那個老外比較斯文,而且很客氣彬彬有禮的,而且問的問題都很少,所以我在心裡盤算著,等等要輪到我,我要想辦法衝去那個窗口才是對策。</p>
<p>我像是上考場的考生一樣,在排隊時還不時地翻閱我準備的旅行資料,怕官員抽問我的話,以便我可以回答的流暢點。終於輪到我了,結果本來想排的那位老外沒排到,而去排了一個有些嚴肅帶點殺氣的華裔美國女生,嗚!怎會這樣!我不是要選她啦!不過也容不得我再換了,只好咬緊牙關硬著頭皮上了。</p>
<p>然後,女官員收了我的表格過去後,劈頭問了我,要去美國做什麼?我簡潔有力回答去觀光。
接著她在電腦前敲敲打打的,也不知在做什麼!我則好整以暇地在等待她再問我事情。時間像是暫停了似的,當時也不知過了多久時間,其實又好像沒很久,只是太嚴肅的場面,難免覺得有些空白。</p>
<p>然後她總算開口了,開口就說『好了』。疑?我聽她這樣說,當時還愣住,一臉狐疑,直到他把護照收去,把條碼單撕下來給我,我才意會到我通過了!我當時真的是有點傻了,蝦米!我通過了?因為我看有不少人都被官員問一些問題,而我就這樣被問第一個問題就過關了,心裡還真不是滋味耶!最噢的是我準備了一堆資料結果都沒用上,搞什麼嘛!我這是幹嘛這麼辛苦阿我!
所以通過了,其實並沒有很大的喜悅,反而是伴隨著錯愕。</p>
<p>然後,帶著條碼單邁向第四關也就是最後一關 - 快遞,就是填填快遞表格,會將美簽及護照寄給你啦!等過完最後一關後,踏出 AIT 大門剛好整整辦理了一個小時,比我想像中的快耶!
這時才早上 8:40。早知道我根本不用請假半天,只要請假一兩個小時就可以了,真失算。</p>
<p>於是,我又趕回桃園監理站,順便將國際駕照也給辦一辦。今天算是還蠻順利的,現在前往美國的入場卷都有了,就只等出發囉。</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com1tag:blogger.com,1999:blog-8037592689793984763.post-69585989441905068562009-05-01T13:31:00.000+08:002009-05-01T01:38:36.683+08:00高調了主管生日<p>昨天當我在其他部門工作時,突然被同事一通電話緊急召回,幾個同事要討論關於我們部門經理今天的生日活動,講到後來我才發現,原來是要我出錢啦!這群死小孩!因為他們幾個抱怨我尾牙中獎沒吐出基金,既然被抓包了!好吧!出來混遲早要還,我二話不說,蛋糕就由我出資了。</p>
<p>33 都建議好了,叫我訂桃園有名的佳樂蛋糕,巧克力波士頓派 x 2,原味波士頓派 x 1,我看分明是她想吃的吧。</p>
<p>話說我們經理可是很低調的,以前同事生日我們要慶祝時,他還希望我們去小會議室裡慶祝,別吵到人,還說別塗奶油追來追去之類的。而這次竟然要高調幫經理慶祝,老實講,我還真怕被主管白眼呢。</p>
<p>昨晚就打電話跟店家訂好,請店家今天送來,只是電話預訂的時候,我ㄧ直以為我是在跟詐騙集團訂蛋糕,因為店家她問了好多好多的資料,而且講話有點像詐騙集團的大陸腔,有點漏風的國語呢。</p>
<p>昨晚也跑去買了一張很漂亮的大張卡片,在今天早上的時候傳給部門同事,讓大家寫些祝福的話語,雖然大家寫的都很沒創意,但也是我們一番心意。</p>
<p>下午重頭戲就來了,大約一點半的時候,跟幾個同事一起演練了一下流程,結果把蛋糕拿出來時,發現竟然沒蠟燭,於是我又非常苦命用跑的去附近的 85 度 C 買蠟燭,等我回來都滿身大汗了,真是意外的插曲。</p>
<p>然後兩點我就在辦公室呼叫大家集合,說福委會有事情要宣佈,等大家集合過來後,我就開始說 『福委會有幾件事情要宣布,然後第一點就是,慶祝 xxx 生日快樂』接著就開始唱生日快樂歌了。</p>
<p>只是這梗好像跟我昨天演練的不一樣啦,我怎突然走調了,事後還被同事唸說我昨天說好的梗,好好的梗怎麼說成這樣了,我可能當時太緊張了,看到主管一直看著我,就糊裡糊塗地提早破梗了。</p>
<p>原本的梗應該是我講:</p>
<p>『公司關於豬流感有幾件事情要宣布,然後第一點就是,豬流感 ~ 豬~~~~~~~ 豬你生日快樂~~~~』然後就開始唱歌。</p>
<p>之後就開始切蛋糕許願,圓滿落幕,雖然好像沒有很流暢,但總算是把主管給高調了一次,
多虧我的功勞,只是不知道會不會從此變黑了,主管以前還交代別塗奶油之類的,33 這次竟然敢太歲頭上動土,結果還推說是我叫她塗的,真是冤枉阿!主管你要是看到這篇,就知道,我是無辜的啦!</p>
<p>主管也感謝我們替他慶生,說下週要請我們吃下午茶呢!嘿嘿!又可以吃下午茶嚕。</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com2tag:blogger.com,1999:blog-8037592689793984763.post-87590949128366280762009-04-30T12:36:00.000+08:002009-04-29T21:44:41.651+08:00拍美簽用照片<p>下禮拜就要去 AIT 辦美簽了,申請美簽需要的照片是 5x5 的,真是麻煩,所以也不能拿以前大頭照剩下的來用,只得再去重拍,今天下班的時候,特地去家裡附近的照相館拍照。</p>
<p>老闆還在招呼其他客人時,我趁機觀摩一下他的攝影設備,原來老闆還在用 Nikon D70 機身在拍,鏡頭用 Nikon AF 35-70 F2.8D 這顆,後來老闆迅速的幫我拍了幾張照片後,就收工了,但是真的是無敵貴的,只給四張照片,這樣要價 350,貴!但又無可奈何。
</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0tag:blogger.com,1999:blog-8037592689793984763.post-13592313119502113932009-04-26T14:41:00.000+08:002009-04-26T00:44:26.763+08:00野上麵包撲空<pre>
今天大概早上十點多,我殺去了南崁想買野上麵包,
第一次出爐的時間是 11 點,
想說今天會不會因為下雨而讓排隊的人潮變少,
所以是個不錯的排隊時機,自己也覺得這個策略不錯,
在南崁稍微找了一下,總算發現那間店了,
遠遠的一看發現都沒有人在排隊,
頓時心花怒放小鹿亂撞的,
心裡暗爽著今天野上麵包店裡的麵包們,
你們通通逃不出我的手掌心了,
等到我騎車已經靠近店了,停在店門口,
赫然發現怎麼店家沒開,大門深鎖,
這真是晴天霹靂,
疑,現在正下著雨,
應該說是『屋漏偏逢連夜雨』比較貼切點,
走近一看,店家鐵門貼著一張紙,
無情地寫著幾個字,
『每週六公休』,
簡短的幾個字,徹底地打擊了一顆脆弱的心靈,
只好萬分無奈地回家去了。
</pre>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com4tag:blogger.com,1999:blog-8037592689793984763.post-44473536982695959082009-04-23T12:43:00.000+08:002009-04-23T12:50:05.455+08:00被嫌的笑話<p>一早到公司,打開電腦上 msn 後,有朋友傳來這則笑話,</p>
<p style="color: rgb(51, 102, 255);">商務艙</p>
<p style="color: rgb(51, 102, 255);">台灣某飛日本的旅行團,團員清一色阿公阿媽。登機時,阿公阿媽一看到商務艙比較豪華就往前鑽,坐商務艙的旅客請他們起來,他們竟說:「這是博愛座,少年ㄟ去坐後面。」</p>
<p style="color: rgb(51, 102, 255);">連服務員也沒辦法,於是班機就延誤了。</p>
<p style="color: rgb(51, 102, 255);">在後面的另一團導遊等得不耐煩了,於是上前察探,在明白情況後就說:「早說嘛,這我有經驗,看我的。」</p>
<p style="color: rgb(51, 102, 255);">只見那導遊上前去,大聲向那群阿公阿媽說:「阿公阿媽!這頭前是要飛美國的啦,飛日本ㄟ要坐後面啦。」</p>
<p style="color: rgb(51, 102, 255);">於是一大群阿公阿媽慌慌張張爬起來衝到後面去…</p>
<p>我想說還蠻好笑的,就貼給一些朋友看,結果都被兔槽 >_<</p>
<p>同事b:很早之前就有這個笑話了</p>
<p>同事e:不好笑</p>
<p>同事b:你lag很久囉ch</p>
<p>朋友-阿草:這笑話有點老,這笑話我大學的時後就聽過了,你應該是搭時光機來2009年的吧,快走吧,地球是很危險的</p>
<p>朋友-阿君:哈哈~蠻幽默ㄉ耶!你在哪兒找到的笑話啊?</p>
<p>阿君得知我都被兔槽後說,『真的假的!原來我們都遇見未來人啊!』</p>
<p>我接著說,『我們還是回到過去吧』</p>Anonymoushttp://www.blogger.com/profile/04935503815045570096noreply@blogger.com0