From 7c8d2689f6e21c7f16e2d38e5428320b59af029b Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Sun, 16 Apr 2017 15:18:53 +0800 Subject: [PATCH 1/8] Key for homework01.txt Key for homework01.txt --- homework/Key_01.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 homework/Key_01.txt diff --git a/homework/Key_01.txt b/homework/Key_01.txt new file mode 100644 index 0000000..ff163af --- /dev/null +++ b/homework/Key_01.txt @@ -0,0 +1,26 @@ +根据如下表格,在可以操作的地方打上圈号,不可以操作的地方打上叉号。 + +目录权限 0 1 2 3 4 5 6 7 + --- --x -w- -wx r-- r-x rw- rwx + +ls X X X X OX O OX O +/bin/ls X X X X OX O OX O +cp file X O X O X O X O +rm file X X X O X N X O +nano file X O X O X O X O +cd X O X O X O X O + +注:OX为如下的奇怪结果,只显示出文件名无其他信息。 +captain@ubuntu:~$ ls -l linux* +ls: cannot access linux-homework/homework01: Permission denied +total 0 +-????????? ? ? ? ? ? homework01 + + + +文件权限 0 1 2 3 4 5 6 7 + --- --x -w- -wx r-- r-x rw- rwx + +cp file X X X X O O O O +nano file X X X X O O O O +run X X X X X O X O From 5983cfb8b1e5c9bfeff458d21181d925f64eac96 Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Sun, 16 Apr 2017 15:23:55 +0800 Subject: [PATCH 2/8] Update Key_01.txt --- homework/Key_01.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homework/Key_01.txt b/homework/Key_01.txt index ff163af..acbddbc 100644 --- a/homework/Key_01.txt +++ b/homework/Key_01.txt @@ -6,7 +6,7 @@ ls X X X X OX O OX O /bin/ls X X X X OX O OX O cp file X O X O X O X O -rm file X X X O X N X O +rm file X X X O X X X O nano file X O X O X O X O cd X O X O X O X O From df27f1164998f59917fe067c8f464f508bd9c08b Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Fri, 12 May 2017 09:23:39 -0500 Subject: [PATCH 3/8] Create codes4homework02.sh --- homework/codes4homework02.sh | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 homework/codes4homework02.sh diff --git a/homework/codes4homework02.sh b/homework/codes4homework02.sh new file mode 100644 index 0000000..0e61736 --- /dev/null +++ b/homework/codes4homework02.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Program: +# This program prints a 9*9 table on your screen. +# History: +# 2017/05/12 Captain First release + +function mul +{ + local x=$1 + local y=$2 + return $((x * y)) +} + +echo +echo "Let's rock!" +echo + +for ((i = 1; i <= 9; i++)) +do + if [ $i == 5 ] + then + echo "----------------:(----------------" + else + for ((j = 1; j <= 9; j++)) + do + mul $i $j + result=$? + echo -n $result + if [ $result -gt 9 ] + then + echo -n " " + else + echo -n " " + fi + done + echo + fi +done + +echo +echo "That's all." +echo From d5352c9622df2dd5528bb8ce8719e1d9df70f0aa Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Sun, 21 May 2017 21:00:01 -0500 Subject: [PATCH 4/8] bash script for homework03 A bash script to output the top n words given a English text file. --- homework/homework03.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 homework/homework03.sh diff --git a/homework/homework03.sh b/homework/homework03.sh new file mode 100644 index 0000000..51f872f --- /dev/null +++ b/homework/homework03.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Author : Captain +# Date : May 22, 2017 +# Purpose : Ouptput the top n words in a given English text file +# +if [ $# -ne 2 -a $# -ne 1 ]; then + echo "usage: `basename $0` [n] Input_File" + echo + exit +fi + +if [ $# -eq 1 ]; then + I_TOP=10 + I_FILE=$1 +fi + +if [ $# -eq 2 ]; then + I_TOP=$1 + I_FILE=$2 +fi + +tr -sc 'A-Za-z' '[\012*]' < $I_FILE | \ +tee debug.txt | \ +tr 'A-Z' 'a-z' | \ +sort | \ +uniq -c | \ +sort -k1 -n -r | \ +head -$I_TOP | nl + + + From 22020e755244cc7b19c4c11a861c928b43f8d3e6 Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Fri, 2 Jun 2017 09:58:29 -0500 Subject: [PATCH 5/8] Create homework04.txt --- homework04.txt | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 homework04.txt diff --git a/homework04.txt b/homework04.txt new file mode 100644 index 0000000..39b0f77 --- /dev/null +++ b/homework04.txt @@ -0,0 +1,53 @@ +//add.c + +int add(int x, int y) { + return x+y; +} + +//add.h +#ifndef _ADD_H_ +#define _ADD_H_ + +int add(int x, int y); + +#endif + +//calc.c + +#include +#include "add.h" + +int main() { + int x = 100; + int y = 100; + printf("%d + %d = %d\n", x, y, add(x, y)); + return 0; +} + +#Makefile +calc: calc.o libadd.a + gcc calc.o -o calc -I. -L. -ladd + +calc.o: calc.c + gcc -c calc.c -o calc.o + +libadd.a: add.o + ar -crv libadd.a add.o + +add.o: add.c + gcc -c add.c -o add.o + +clean: + rm -f calc calc.o libadd.a add.o adder.tar.gz + +install: calc + sudo cp calc /usr/local/bin/calc + +uninstall: + sudo rm -f hello /usr/local/bin/calc + +dist: clean + mkdir adder + cp add.h add.c calc.c Makefile adder/ + tar czvf adder.tar.gz adder + rm -fr adder From b6d9a8c0b338bb4037c548863c46514fb6ca53de Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Fri, 2 Jun 2017 09:59:22 -0500 Subject: [PATCH 6/8] Delete homework04.txt --- homework04.txt | 53 -------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 homework04.txt diff --git a/homework04.txt b/homework04.txt deleted file mode 100644 index 39b0f77..0000000 --- a/homework04.txt +++ /dev/null @@ -1,53 +0,0 @@ -//add.c - -int add(int x, int y) { - return x+y; -} - -//add.h -#ifndef _ADD_H_ -#define _ADD_H_ - -int add(int x, int y); - -#endif - -//calc.c - -#include -#include "add.h" - -int main() { - int x = 100; - int y = 100; - printf("%d + %d = %d\n", x, y, add(x, y)); - return 0; -} - -#Makefile -calc: calc.o libadd.a - gcc calc.o -o calc -I. -L. -ladd - -calc.o: calc.c - gcc -c calc.c -o calc.o - -libadd.a: add.o - ar -crv libadd.a add.o - -add.o: add.c - gcc -c add.c -o add.o - -clean: - rm -f calc calc.o libadd.a add.o adder.tar.gz - -install: calc - sudo cp calc /usr/local/bin/calc - -uninstall: - sudo rm -f hello /usr/local/bin/calc - -dist: clean - mkdir adder - cp add.h add.c calc.c Makefile adder/ - tar czvf adder.tar.gz adder - rm -fr adder From 45c59f1d35023b63c42bb5d4ac7afcf2de2e728b Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Fri, 2 Jun 2017 10:00:11 -0500 Subject: [PATCH 7/8] 4 4th --- homework/homework04.txt | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 homework/homework04.txt diff --git a/homework/homework04.txt b/homework/homework04.txt new file mode 100644 index 0000000..39b0f77 --- /dev/null +++ b/homework/homework04.txt @@ -0,0 +1,53 @@ +//add.c + +int add(int x, int y) { + return x+y; +} + +//add.h +#ifndef _ADD_H_ +#define _ADD_H_ + +int add(int x, int y); + +#endif + +//calc.c + +#include +#include "add.h" + +int main() { + int x = 100; + int y = 100; + printf("%d + %d = %d\n", x, y, add(x, y)); + return 0; +} + +#Makefile +calc: calc.o libadd.a + gcc calc.o -o calc -I. -L. -ladd + +calc.o: calc.c + gcc -c calc.c -o calc.o + +libadd.a: add.o + ar -crv libadd.a add.o + +add.o: add.c + gcc -c add.c -o add.o + +clean: + rm -f calc calc.o libadd.a add.o adder.tar.gz + +install: calc + sudo cp calc /usr/local/bin/calc + +uninstall: + sudo rm -f hello /usr/local/bin/calc + +dist: clean + mkdir adder + cp add.h add.c calc.c Makefile adder/ + tar czvf adder.tar.gz adder + rm -fr adder From ae5386eea54ead3e98aee87b3fd05fe853cbe9b1 Mon Sep 17 00:00:00 2001 From: Zang ZhiQiang Date: Mon, 12 Jun 2017 13:30:24 +0800 Subject: [PATCH 8/8] 5th homeowrk A LaTeX file --- homework/homework05.tex | 129 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 homework/homework05.tex diff --git a/homework/homework05.tex b/homework/homework05.tex new file mode 100644 index 0000000..ce9e53b --- /dev/null +++ b/homework/homework05.tex @@ -0,0 +1,129 @@ +\documentclass[UTF8,12pt,a4paper]{ctexart} +\ctexset{ + section/format += \raggedright +} +%\usepackage[UTF8, heading = true]{ctex} +\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} +\usepackage{listings} +\usepackage{xcolor} +\usepackage{amsmath, amssymb} +\usepackage[hidelinks]{hyperref} + + +\usepackage{graphicx} +\usepackage{wrapfig} +\usepackage{subcaption} +\usepackage[font=small]{caption} + +\usepackage{fancyhdr} +\pagestyle{fancy} +\lhead{ + \includegraphics[width=0.05\textwidth]{./BUPT_LOGO.png} +} +\chead{北京邮电大学} +\rhead{captain@bupt.edu.cn} +\lfoot{} +\cfoot{\thepage} +\rfoot{} +\renewcommand{\headrulewidth}{0.4pt} +\renewcommand{\headwidth}{\textwidth} +\renewcommand{\footrulewidth}{0pt} + +\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry} +\setlength{\headheight}{26pt} +\usepackage{setspace} +\setstretch{1}%单倍行距 + +\usepackage{fontspec} +% 衬线字体:Linux Libertine +\setmainfont{Linux Libertine O} +% 无衬线字体:Linux Biolinum +\setsansfont{Linux Biolinum O} +% 等宽/打印机字体:Linux Libertine Mono +\setmonofont{Linux Libertine Mono O} + +% 衬线字体:Noto Serif CJK SC +\setCJKmainfont{Noto Serif CJK SC} +% 无衬线字体:Noto Sans CJK SC +\setCJKsansfont{Noto Sans CJK SC} +% 等宽字体/打印机字体:Noto Sans Mono CJK SC +\setCJKmonofont{Noto Sans Mono CJK SC} + +\usepackage{chemfig} +\usepackage{skak} + +\begin{document} + \begin{center} + \large + \textbf{Linux操作系统第五次作业} + + 臧志强 2014210358 + + \today + \end{center} + + \section{有趣的示例} + \begin{figure}[htbp] + \centering + \begin{subfigure}[b]{0.45\textwidth} + \centering + \newgame + + \showboard + \caption{国际象棋} + \label{fig:chess} + \end{subfigure} + ~ + \begin{subfigure}[b]{0.45\textwidth} + \centering + \chemfig{ + NO_2-[:90]*6(=-(-NO_2)=(-CH_3)-(-O_2N)=-)} + \caption{2,4,6 -- 三硝基甲苯(TNT)} + \label{fig:TNT} + \end{subfigure} + \caption{有趣的示例} + \label{fig:demoes} + \end{figure} + + \section{Apocalypse Tank(天启坦克)} + + \begin{quote} + The apocalypse has begun! + \end{quote} + The successor to the old Soviet Mammoth tank, the \textit{Apocalypse Assault Tank} (seen in figure \ref{fig:icon}) was a powerful heavy tank used by the USSR during the first and second iterations of the Third World War. It featured twin 120mm cannons, anti-air missiles, very heavy armour, and self-repair abilities, making it a force to be reckoned with on the battlefield. + \begin{figure}[h] + \centering + \begin{subfigure}[c]{0.1\textwidth} + \includegraphics[width=\textwidth]{RA2_Apocalypse_Tank_Icons.png} + \newline + \newline + \includegraphics[width=\textwidth]{RA2_Apocalypse_Tank_Veteran_Icons.png} + \end{subfigure} + ~~ + \begin{subfigure}[c]{0.5\textwidth} + \includegraphics[width=\textwidth]{RA2_Black_Guard_with_anti-aliasing.jpg} + \end{subfigure} + \caption{Apocalypse tank} + \label{fig:icon} + \end{figure} +% 作为老式苏维埃猛犸坦克的继承者,\textbf{天启突击坦克}是苏联在第三次世界大战的两次重演中使用的一种强大的重型坦克。 它装备有一对120mm火炮、对空导弹,同时拥有重装甲和自我修复能力,无疑是战场上的中坚力量。 + + +% \begin{figure} +% \begin{center} +% \includegraphics[width=0.38\textwidth]{RA2_Apocalypse_Tank.png}\\ +% \end{center} +% \label{fig:RA2_APOC} +% \end{figure} + + +% \chemfig{ +% H_3C-[:72]{\color{blue}N}*5(- +% *6(-(={\color{red}O})- +% {\color{blue}N}(-CH_3)- +% (={\color{red}O})- +% {\color{blue}N}(-CH_3)-=)-- +% {\color{blue}N}=-)} + + +\end{document}