You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils_shell.ipynb 7.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "markdown",
  5. "metadata": {},
  6. "source": [
  7. "# 2.1. Learning the basics of the Unix shell"
  8. ]
  9. },
  10. {
  11. "cell_type": "code",
  12. "execution_count": 1,
  13. "metadata": {},
  14. "outputs": [
  15. {
  16. "name": "stdout",
  17. "output_type": "stream",
  18. "text": [
  19. "~/git/cookbook-2nd/chapter02_best_practices\n"
  20. ]
  21. }
  22. ],
  23. "source": [
  24. "pwd"
  25. ]
  26. },
  27. {
  28. "cell_type": "code",
  29. "execution_count": 2,
  30. "metadata": {},
  31. "outputs": [
  32. {
  33. "name": "stdout",
  34. "output_type": "stream",
  35. "text": [
  36. "00_intro.md 03_git.md 07_high_quality.md\n",
  37. "01_shell.md 04_git_advanced.md 08_test.md\n",
  38. "02_py3 05_workflows.md 09_debugging.md\n",
  39. "02_py3.md 06_tips.md images\n"
  40. ]
  41. }
  42. ],
  43. "source": [
  44. "ls"
  45. ]
  46. },
  47. {
  48. "cell_type": "code",
  49. "execution_count": 3,
  50. "metadata": {},
  51. "outputs": [
  52. {
  53. "name": "stdout",
  54. "output_type": "stream",
  55. "text": [
  56. "total 100\n",
  57. "-rw-rw-r-- 1 owner 769 Dec 12 10:23 00_intro.md\n",
  58. "-rw-rw-r-- 1 owner 2473 Dec 12 14:21 01_shell.md\n",
  59. "...\n",
  60. "-rw-rw-r-- 1 owner 9390 Dec 12 11:46 08_test.md\n",
  61. "-rw-rw-r-- 1 owner 5032 Dec 12 10:23 09_debugging.md\n",
  62. "drwxrwxr-x 2 owner 4096 Aug 1 16:49 images\n"
  63. ]
  64. }
  65. ],
  66. "source": [
  67. "ls -l"
  68. ]
  69. },
  70. {
  71. "cell_type": "code",
  72. "execution_count": 4,
  73. "metadata": {},
  74. "outputs": [],
  75. "source": [
  76. "cd images"
  77. ]
  78. },
  79. {
  80. "cell_type": "code",
  81. "execution_count": 5,
  82. "metadata": {},
  83. "outputs": [
  84. {
  85. "data": {
  86. "text/plain": [
  87. "~/git/cookbook-2nd/chapter02_best_practices/images"
  88. ]
  89. },
  90. "execution_count": 5,
  91. "metadata": {},
  92. "output_type": "execute_result"
  93. }
  94. ],
  95. "source": [
  96. "pwd"
  97. ]
  98. },
  99. {
  100. "cell_type": "code",
  101. "execution_count": 6,
  102. "metadata": {},
  103. "outputs": [
  104. {
  105. "name": "stdout",
  106. "output_type": "stream",
  107. "text": [
  108. "folder.png github_new.png\n"
  109. ]
  110. }
  111. ],
  112. "source": [
  113. "ls"
  114. ]
  115. },
  116. {
  117. "cell_type": "code",
  118. "execution_count": 7,
  119. "metadata": {},
  120. "outputs": [],
  121. "source": [
  122. "cd .."
  123. ]
  124. },
  125. {
  126. "cell_type": "code",
  127. "execution_count": 8,
  128. "metadata": {},
  129. "outputs": [
  130. {
  131. "data": {
  132. "text/plain": [
  133. "~/git/cookbook-2nd/chapter02_best_practices"
  134. ]
  135. },
  136. "execution_count": 8,
  137. "metadata": {},
  138. "output_type": "execute_result"
  139. }
  140. ],
  141. "source": [
  142. "pwd"
  143. ]
  144. },
  145. {
  146. "cell_type": "code",
  147. "execution_count": 9,
  148. "metadata": {},
  149. "outputs": [
  150. {
  151. "name": "stdout",
  152. "output_type": "stream",
  153. "text": [
  154. "total 20\n",
  155. "drwxr-xr-x 5 cyrille 4096 Nov 14 16:16 .\n",
  156. "drwxr-xr-x 93 cyrille 4096 Dec 12 10:50 ..\n",
  157. "drwxr-xr-x 2 cyrille 4096 Nov 14 16:16 extensions\n",
  158. "drwxr-xr-x 2 cyrille 4096 Nov 14 16:16 nbextensions\n",
  159. "drwxr-xr-x 7 cyrille 4096 Dec 12 14:18 profile_default\n"
  160. ]
  161. }
  162. ],
  163. "source": [
  164. "ls -la ~/.ipython"
  165. ]
  166. },
  167. {
  168. "cell_type": "code",
  169. "execution_count": 10,
  170. "metadata": {},
  171. "outputs": [
  172. {
  173. "name": "stdout",
  174. "output_type": "stream",
  175. "text": [
  176. "00_intro.md 05_workflows.md\n",
  177. "01_shell.md 06_tips.md\n",
  178. "02_py3.md 07_high_quality.md\n",
  179. "03_git.md 08_test.md\n",
  180. "04_git_advanced.md 09_debugging.md\n"
  181. ]
  182. }
  183. ],
  184. "source": [
  185. "# We create an empty directory:\n",
  186. "mkdir md_files\n",
  187. "# We copy all Markdown files into the new directory:\n",
  188. "cp *.md md_files\n",
  189. "# We rename the directory:\n",
  190. "mv md_files markdown_files\n",
  191. "ls markdown_files"
  192. ]
  193. },
  194. {
  195. "cell_type": "code",
  196. "execution_count": 11,
  197. "metadata": {},
  198. "outputs": [
  199. {
  200. "name": "stdout",
  201. "output_type": "stream",
  202. "text": [
  203. "rmdir: failed to remove 'markdown_files':\n",
  204. " Directory not empty\n"
  205. ]
  206. }
  207. ],
  208. "source": [
  209. "rmdir markdown_files"
  210. ]
  211. },
  212. {
  213. "cell_type": "code",
  214. "execution_count": 12,
  215. "metadata": {},
  216. "outputs": [],
  217. "source": [
  218. "rm markdown_files/*"
  219. ]
  220. },
  221. {
  222. "cell_type": "code",
  223. "execution_count": 13,
  224. "metadata": {},
  225. "outputs": [],
  226. "source": [
  227. "rmdir markdown_files"
  228. ]
  229. },
  230. {
  231. "cell_type": "code",
  232. "execution_count": 14,
  233. "metadata": {},
  234. "outputs": [
  235. {
  236. "name": "stdout",
  237. "output_type": "stream",
  238. "text": [
  239. "# Learning the basics of the Unix shell\n",
  240. "\n",
  241. "Learning how to interact with the operating system (...)\n"
  242. ]
  243. }
  244. ],
  245. "source": [
  246. "# Show the first three lines of a text file:\n",
  247. "head -n 3 01_shell.md"
  248. ]
  249. },
  250. {
  251. "cell_type": "code",
  252. "execution_count": 15,
  253. "metadata": {},
  254. "outputs": [
  255. {
  256. "name": "stdout",
  257. "output_type": "stream",
  258. "text": [
  259. "We will also cover more general topics (...)\n"
  260. ]
  261. }
  262. ],
  263. "source": [
  264. "# Show the last line of a text file:\n",
  265. "tail -n 1 00_intro.md"
  266. ]
  267. },
  268. {
  269. "cell_type": "code",
  270. "execution_count": 16,
  271. "metadata": {},
  272. "outputs": [
  273. {
  274. "name": "stdout",
  275. "output_type": "stream",
  276. "text": [
  277. "Hello world!\n"
  278. ]
  279. }
  280. ],
  281. "source": [
  282. "# We display some text:\n",
  283. "echo \"Hello world!\""
  284. ]
  285. },
  286. {
  287. "cell_type": "code",
  288. "execution_count": 17,
  289. "metadata": {},
  290. "outputs": [],
  291. "source": [
  292. "# We redirect the output of a command to\n",
  293. "# a text file with `>`:\n",
  294. "echo \"Hello world!\" > myfile.txt"
  295. ]
  296. },
  297. {
  298. "cell_type": "code",
  299. "execution_count": 18,
  300. "metadata": {},
  301. "outputs": [
  302. {
  303. "name": "stdout",
  304. "output_type": "stream",
  305. "text": [
  306. "Hello world!\n"
  307. ]
  308. }
  309. ],
  310. "source": [
  311. "# We display the entire contents of the file:\n",
  312. "cat myfile.txt"
  313. ]
  314. },
  315. {
  316. "cell_type": "code",
  317. "execution_count": 19,
  318. "metadata": {},
  319. "outputs": [
  320. {
  321. "name": "stdout",
  322. "output_type": "stream",
  323. "text": [
  324. "Unix shell\n",
  325. "Unix shell\n",
  326. "Unix subsystem\n",
  327. "Unix shell\n",
  328. "(...)\n",
  329. "Unix shell\n",
  330. "Unix shell\n"
  331. ]
  332. }
  333. ],
  334. "source": [
  335. "grep -Eo \"Unix \\w+\" 01_shell.md"
  336. ]
  337. },
  338. {
  339. "cell_type": "code",
  340. "execution_count": 20,
  341. "metadata": {},
  342. "outputs": [
  343. {
  344. "name": "stdout",
  345. "output_type": "stream",
  346. "text": [
  347. "Unix shell\n"
  348. ]
  349. }
  350. ],
  351. "source": [
  352. "echo \"This is a Unix shell\" | grep -Eo \"Unix \\w+\""
  353. ]
  354. }
  355. ],
  356. "metadata": {
  357. "kernelspec": {
  358. "display_name": "Python 3",
  359. "language": "python",
  360. "name": "python3"
  361. },
  362. "language_info": {
  363. "codemirror_mode": {
  364. "name": "ipython",
  365. "version": 3
  366. },
  367. "file_extension": ".py",
  368. "mimetype": "text/x-python",
  369. "name": "python",
  370. "nbconvert_exporter": "python",
  371. "pygments_lexer": "ipython3",
  372. "version": "3.5.2"
  373. }
  374. },
  375. "nbformat": 4,
  376. "nbformat_minor": 2
  377. }

机器学习越来越多应用到飞行器、机器人等领域,其目的是利用计算机实现类似人类的智能,从而实现装备的智能化与无人化。本课程旨在引导学生掌握机器学习的基本知识、典型方法与技术,通过具体的应用案例激发学生对该学科的兴趣,鼓励学生能够从人工智能的角度来分析、解决飞行器、机器人所面临的问题和挑战。本课程主要内容包括Python编程基础,机器学习模型,无监督学习、监督学习、深度学习基础知识与实现,并学习如何利用机器学习解决实际问题,从而全面提升自我的《综合能力》。