From 7605ea416d7e78f9f26ae81256a43b7393a11216 Mon Sep 17 00:00:00 2001 From: KeZekuan <715480954@qq.com> Date: Sat, 2 Apr 2016 22:18:49 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=AF=B7=E9=97=AE=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=AE=9E=E7=8E=B0=E5=8A=9F=E8=83=BD=E5=90=97=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assignments/shell/AddUsers/addUsers.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) mode change 100644 => 100755 assignments/shell/AddUsers/addUsers.sh diff --git a/assignments/shell/AddUsers/addUsers.sh b/assignments/shell/AddUsers/addUsers.sh old mode 100644 new mode 100755 index 2905c24..7996aa4 --- a/assignments/shell/AddUsers/addUsers.sh +++ b/assignments/shell/AddUsers/addUsers.sh @@ -1,9 +1,14 @@ -# -# -# useradd -# chpasswd -# chown -# chmod -# edquota -# - +#!/usr/bin/env bash +# useradd +# chpasswd +# chown +# chmod +# edquota +# +#~ case $1 in + #~ "add" ) echo 233;; + #~ "rm") + #~ "chpwd") + #~ + #~ *) echo "Unknown arguments.";; +#~ esac From cf5ebda48c61a1b44b6ea255b0248a5349485efe Mon Sep 17 00:00:00 2001 From: KeZekuan <715480954@qq.com> Date: Mon, 18 Apr 2016 17:05:26 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BC=BA=E8=A1=8C=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assignments/shell/AddUsers/addUsers.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/assignments/shell/AddUsers/addUsers.sh b/assignments/shell/AddUsers/addUsers.sh index 7996aa4..ed8d877 100755 --- a/assignments/shell/AddUsers/addUsers.sh +++ b/assignments/shell/AddUsers/addUsers.sh @@ -5,10 +5,13 @@ # chmod # edquota # -#~ case $1 in - #~ "add" ) echo 233;; - #~ "rm") - #~ "chpwd") - #~ - #~ *) echo "Unknown arguments.";; -#~ esac +case $1 in + "add" ) + echo "ad here" + ;; + "rm") + ;; + "chpwd") + ;; + *) echo "Unknown arguments.";; +esac From aa20749090f193bba644f98fefdb1df73f131153 Mon Sep 17 00:00:00 2001 From: KeZekuan <715480954@qq.com> Date: Mon, 18 Apr 2016 18:10:36 +0800 Subject: [PATCH 3/5] I forgot what I have done --- assignments/shell/AddUsers/addUsers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignments/shell/AddUsers/addUsers.sh b/assignments/shell/AddUsers/addUsers.sh index ed8d877..806c357 100755 --- a/assignments/shell/AddUsers/addUsers.sh +++ b/assignments/shell/AddUsers/addUsers.sh @@ -7,7 +7,7 @@ # case $1 in "add" ) - echo "ad here" + echo "add here" ;; "rm") ;; From de78adba49d879c617b1812deb0708eadfffb374 Mon Sep 17 00:00:00 2001 From: KeZekuan <715480954@qq.com> Date: Fri, 27 May 2016 21:45:10 +0800 Subject: [PATCH 4/5] Basically done? --- assignments/shell/AddUsers/addUsers.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/assignments/shell/AddUsers/addUsers.sh b/assignments/shell/AddUsers/addUsers.sh index 806c357..f357a4b 100755 --- a/assignments/shell/AddUsers/addUsers.sh +++ b/assignments/shell/AddUsers/addUsers.sh @@ -6,12 +6,12 @@ # edquota # case $1 in - "add" ) - echo "add here" - ;; - "rm") - ;; - "chpwd") - ;; - *) echo "Unknown arguments.";; + 'clean') for u in $(cat users.txt) + do sudo userdel $u + done + ;; + *) for u in $(cat users.txt) + do sudo useradd $u + done + ;; esac From 913a4807823bce52d5a77eed175184702d2c281a Mon Sep 17 00:00:00 2001 From: KeZekuan <715480954@qq.com> Date: Fri, 27 May 2016 21:46:15 +0800 Subject: [PATCH 5/5] 233 --- experiments/gcc-1-hello-world/main.c | 6 ---- experiments/gcc-2-multi-source/calculator.c | 17 --------- .../gcc-2-multi-source/include/calculator.h | 6 ---- experiments/gcc-2-multi-source/main.c | 12 ------- experiments/gcc-3-real-project/Makefile | 9 ----- experiments/gcc-3-real-project/calculator.c | 17 --------- .../gcc-3-real-project/include/calculator.h | 9 ----- experiments/gcc-3-real-project/main.c | 14 -------- experiments/gcc-4-optimize/Makefile | 36 ------------------- experiments/gcc-4-optimize/array.c | 26 -------------- experiments/gcc-4-optimize/calculator.c | 17 --------- experiments/gcc-4-optimize/include/array.h | 9 ----- .../gcc-4-optimize/include/calculator.h | 9 ----- experiments/gcc-4-optimize/main.c | 32 ----------------- experiments/gcc-5-gdb/Makefile | 33 ----------------- experiments/gcc-5-gdb/array.c | 26 -------------- experiments/gcc-5-gdb/include/array.h | 9 ----- experiments/gcc-5-gdb/main.c | 24 ------------- 18 files changed, 311 deletions(-) delete mode 100644 experiments/gcc-1-hello-world/main.c delete mode 100644 experiments/gcc-2-multi-source/calculator.c delete mode 100644 experiments/gcc-2-multi-source/include/calculator.h delete mode 100644 experiments/gcc-2-multi-source/main.c delete mode 100644 experiments/gcc-3-real-project/Makefile delete mode 100644 experiments/gcc-3-real-project/calculator.c delete mode 100644 experiments/gcc-3-real-project/include/calculator.h delete mode 100644 experiments/gcc-3-real-project/main.c delete mode 100644 experiments/gcc-4-optimize/Makefile delete mode 100644 experiments/gcc-4-optimize/array.c delete mode 100644 experiments/gcc-4-optimize/calculator.c delete mode 100644 experiments/gcc-4-optimize/include/array.h delete mode 100644 experiments/gcc-4-optimize/include/calculator.h delete mode 100644 experiments/gcc-4-optimize/main.c delete mode 100644 experiments/gcc-5-gdb/Makefile delete mode 100644 experiments/gcc-5-gdb/array.c delete mode 100644 experiments/gcc-5-gdb/include/array.h delete mode 100644 experiments/gcc-5-gdb/main.c diff --git a/experiments/gcc-1-hello-world/main.c b/experiments/gcc-1-hello-world/main.c deleted file mode 100644 index abfd4b3..0000000 --- a/experiments/gcc-1-hello-world/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("Hello world!\n"); - return 0; -} diff --git a/experiments/gcc-2-multi-source/calculator.c b/experiments/gcc-2-multi-source/calculator.c deleted file mode 100644 index 391fc7f..0000000 --- a/experiments/gcc-2-multi-source/calculator.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "include/calculator.h" - -int sum(int x, int y) { - return x + y; -} - -int subtract(int x, int y) { - return x - y; -} - -int multiply(int x, int y) { - return x * y; -} - -int divide(int x, int divisor) { - return x / divisor; -} diff --git a/experiments/gcc-2-multi-source/include/calculator.h b/experiments/gcc-2-multi-source/include/calculator.h deleted file mode 100644 index 7daefe5..0000000 --- a/experiments/gcc-2-multi-source/include/calculator.h +++ /dev/null @@ -1,6 +0,0 @@ - -int sum(int x, int y); -int subtract(int x, int y); -int multiply(int x, int y); -int divide(int x, int divisor); - diff --git a/experiments/gcc-2-multi-source/main.c b/experiments/gcc-2-multi-source/main.c deleted file mode 100644 index bdbb5b9..0000000 --- a/experiments/gcc-2-multi-source/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(void) { - int x, y; - - x = 2; - y = 3; - - printf("%d + %d = %d\n", x, y, sum(2, 3)); - - return 0; -} diff --git a/experiments/gcc-3-real-project/Makefile b/experiments/gcc-3-real-project/Makefile deleted file mode 100644 index 0531065..0000000 --- a/experiments/gcc-3-real-project/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -main:main.o calculator.o - gcc main.o calculator.o -o main -main.o:main.c - gcc -c main.c -calculator.o:calculator.c - gcc -c calculator.c - -clean: - rm main *.o diff --git a/experiments/gcc-3-real-project/calculator.c b/experiments/gcc-3-real-project/calculator.c deleted file mode 100644 index 391fc7f..0000000 --- a/experiments/gcc-3-real-project/calculator.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "include/calculator.h" - -int sum(int x, int y) { - return x + y; -} - -int subtract(int x, int y) { - return x - y; -} - -int multiply(int x, int y) { - return x * y; -} - -int divide(int x, int divisor) { - return x / divisor; -} diff --git a/experiments/gcc-3-real-project/include/calculator.h b/experiments/gcc-3-real-project/include/calculator.h deleted file mode 100644 index a5e00e3..0000000 --- a/experiments/gcc-3-real-project/include/calculator.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _CALC_H -#define _CALC_H - -int sum(int x, int y); -int subtract(int x, int y); -int multiply(int x, int y); -int divide(int x, int divisor); - -#endif //_CALC_H diff --git a/experiments/gcc-3-real-project/main.c b/experiments/gcc-3-real-project/main.c deleted file mode 100644 index 6798996..0000000 --- a/experiments/gcc-3-real-project/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#include "include/calculator.h" - -int main(void) { - int x, y; - - x = 2; - y = 3; - - printf("%d - %d = %d\n", x, y, subtract(2, 3)); - - return 0; -} diff --git a/experiments/gcc-4-optimize/Makefile b/experiments/gcc-4-optimize/Makefile deleted file mode 100644 index 121d85a..0000000 --- a/experiments/gcc-4-optimize/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -result:main array calculator - gcc main.o array.o calculator.o -o result - -main: main_clean main.c - gcc -c -O0 main.c -main_optimize: main_clean main.c - gcc -c -O2 main.c -main_clean: - if [ -e main.o ] ; then rm main.o ; fi - - -calculator:calculator.c - gcc -c calculator.c - -array: array_clean array.c - gcc -c -O0 array.c -array_optimize: array_clean array.c - gcc -c -O2 array.c -array_clean: - if [ -e array.o ] ; then rm array.o ; fi - - -release: main_optimize array_optimize calculator - gcc main.o array.o -o release - -diff: result release - ./result - ./release - -clean: - if [ -e result ] ; then rm result ; fi - - if [ -e release ] ; then rm release ; fi - - rm *.o - diff --git a/experiments/gcc-4-optimize/array.c b/experiments/gcc-4-optimize/array.c deleted file mode 100644 index e92db61..0000000 --- a/experiments/gcc-4-optimize/array.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "include/array.h" - -void array_fill_with(int *array, int length, int fillWith) { - int i; - for (i = 0; i < length; i++) { - array[i] = fillWith; - } -} - -void array_add(int *arrayX, int *arrayY, int *arrayZ, int length) { - int i; - for (i = 0; i < length; i++) { - arrayZ[i] = arrayX[i] + arrayY[i]; - } -} - -void array_print(int *array, int length) { - int i; - for (i =0; i < length; i++) { - printf("%d\t", array[i]); - } - - printf("\n"); -} diff --git a/experiments/gcc-4-optimize/calculator.c b/experiments/gcc-4-optimize/calculator.c deleted file mode 100644 index 391fc7f..0000000 --- a/experiments/gcc-4-optimize/calculator.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "include/calculator.h" - -int sum(int x, int y) { - return x + y; -} - -int subtract(int x, int y) { - return x - y; -} - -int multiply(int x, int y) { - return x * y; -} - -int divide(int x, int divisor) { - return x / divisor; -} diff --git a/experiments/gcc-4-optimize/include/array.h b/experiments/gcc-4-optimize/include/array.h deleted file mode 100644 index 3f079f4..0000000 --- a/experiments/gcc-4-optimize/include/array.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _ARRAY_H -#define _ARRAY_H - -void array_fill_with(int *array, int length, int fillWith); -void array_print(int *array, int length); - -void array_add(int *arrayX, int *arrayY, int *arrayZ, int length); - -#endif diff --git a/experiments/gcc-4-optimize/include/calculator.h b/experiments/gcc-4-optimize/include/calculator.h deleted file mode 100644 index a5e00e3..0000000 --- a/experiments/gcc-4-optimize/include/calculator.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _CALC_H -#define _CALC_H - -int sum(int x, int y); -int subtract(int x, int y); -int multiply(int x, int y); -int divide(int x, int divisor); - -#endif //_CALC_H diff --git a/experiments/gcc-4-optimize/main.c b/experiments/gcc-4-optimize/main.c deleted file mode 100644 index 7f314ff..0000000 --- a/experiments/gcc-4-optimize/main.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -#include "include/calculator.h" - -#include "include/array.h" - -#define VECTOR_LENGTH 2048 - -int main(void) { - - int vector_a[VECTOR_LENGTH], vector_b[VECTOR_LENGTH], vector_c[VECTOR_LENGTH]; - - double time_start, time_end; - array_fill_with(vector_a, VECTOR_LENGTH, 10); - array_fill_with(vector_b, VECTOR_LENGTH, 55); - - time_start = clock(); - - array_add(vector_a, vector_b, vector_c, VECTOR_LENGTH); - - time_end = clock(); - - //array_print(vector_c, VECTOR_LENGTH); - - printf("Time used: %10.9f\n", (double) ( (time_end - time_start) / 1000.0) ); - - return 0; -} - - - diff --git a/experiments/gcc-5-gdb/Makefile b/experiments/gcc-5-gdb/Makefile deleted file mode 100644 index a49a825..0000000 --- a/experiments/gcc-5-gdb/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -result:main array - gcc main.o array.o -o result - -main: main_clean main.c - gcc -c -O0 main.c -main_optimize: main_clean main.c - gcc -c -O2 main.c -main_clean: - if [ -e main.o ] ; then rm main.o ; fi - - -array: array_clean array.c - gcc -c -O0 array.c -array_optimize: array_clean array.c - gcc -c -O2 array.c -array_clean: - if [ -e array.o ] ; then rm array.o ; fi - - -release: main_optimize array_optimize - gcc main.o array.o -o release - -diff: result release - ./result - ./release - -clean: - if [ -e result ] ; then rm result ; fi - - if [ -e release ] ; then rm release ; fi - - rm *.o - diff --git a/experiments/gcc-5-gdb/array.c b/experiments/gcc-5-gdb/array.c deleted file mode 100644 index f12c568..0000000 --- a/experiments/gcc-5-gdb/array.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "include/array.h" - -void array_fill_with(int *array, int length, int fillWith) { - int i; - for (i = 0; i <= length; i++) { - array[i] = fillWith; - } -} - -void array_add(int *arrayX, int *arrayY, int *arrayZ, int length) { - int i; - for (i = 0; i <= length; i++) { - arrayZ[i] = arrayX[i] + arrayY[i]; - } -} - -void array_print(int *array, int length) { - int i; - for (i =0; i < length; i++) { - printf("%d\t", array[i]); - } - - printf("\n"); -} diff --git a/experiments/gcc-5-gdb/include/array.h b/experiments/gcc-5-gdb/include/array.h deleted file mode 100644 index 3f079f4..0000000 --- a/experiments/gcc-5-gdb/include/array.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _ARRAY_H -#define _ARRAY_H - -void array_fill_with(int *array, int length, int fillWith); -void array_print(int *array, int length); - -void array_add(int *arrayX, int *arrayY, int *arrayZ, int length); - -#endif diff --git a/experiments/gcc-5-gdb/main.c b/experiments/gcc-5-gdb/main.c deleted file mode 100644 index f6ff3da..0000000 --- a/experiments/gcc-5-gdb/main.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#include "include/array.h" - -#define VECTOR_LENGTH 16 - -int main(void) { - - int vector_a[VECTOR_LENGTH], vector_b[VECTOR_LENGTH], vector_c[VECTOR_LENGTH]; - - array_fill_with(vector_a, VECTOR_LENGTH, 10); - array_fill_with(vector_b, VECTOR_LENGTH, 55); - - - array_add(vector_a, vector_b, vector_c, VECTOR_LENGTH); - - - array_print(vector_c, VECTOR_LENGTH); - - return 0; -} - - -