Git cpp bash: Difference between revisions
(Uus lehekülg: '== GIT == * Save work progress in a repository ** For example [https://github.com/ github.com] * Use [http://nvie.com/posts/a-successful-git-branching-model/ branches] ** one for...') |
No edit summary |
||
Line 1: | Line 1: | ||
Elementary knowledge of GIT, BASH, C++ will be tested. | |||
Task may be completed on any Linux distribution (recommended debian/ubuntu) | |||
== GIT == | == GIT == | ||
* Save work progress in a repository | * Save work progress in a repository | ||
** For example [https://github.com/ github.com] | ** For example [https://github.com/ github.com] | ||
* Use [http://nvie.com/posts/a-successful-git-branching-model/ | * Use branches ([http://nvie.com/posts/a-successful-git-branching-model/ help]) | ||
** | ** One branch for implementing bash script and another branch for c++ | ||
** commit often, | ** commit often, total number of commits should be 10+ | ||
** when checking out a random revision, it should compile. | ** when checking out a random revision, it should compile. | ||
** | ** Branches start from master and must be merged back into master | ||
== BASH == | == BASH == | ||
=== Script 1 - Show memory usage === | |||
Script has 1 optional argument, path to meminfo file (contains current memory status). | |||
If it's not provided use '''/proc/meminfo''' | |||
Use standard unix tools like '''awk''', '''grep''', '''sed''' to parse the input file. | |||
Example of input file | |||
cat /proc/meminfo | |||
MemTotal: 7969612 kB | |||
MemFree: 4582768 kB | |||
Buffers: 707368 kB | |||
Cached: 1122984 kB | |||
SwapCached: 0 kB | |||
Active: 1742408 kB | |||
Inactive: 1203472 kB | |||
[ ... ] | |||
output: | output: | ||
RAM: | ./script1.sh /proc/meminfo | ||
RAM: 4582 MB used / 7969 MB total ( 3387 MB free) | |||
=== Script 2 === | === Script 2 - compile c++ application === | ||
Compiles the C++ application | Compiles the C++ application | ||
Probably only has 1 useful line, g++ with some linker options. | Probably only has 1 useful line, g++ with some linker options. | ||
example: | |||
./script2.sh | |||
Compilation started | |||
Compilation finished | |||
== C++ == | == C++ == | ||
=== List files in directory === | |||
=== | |||
Program takes one argument: path to directory. | Program takes one argument: path to directory. | ||
Outputs list of files. | |||
Application must print out the name of directory. | Application must print out the name of directory. | ||
Line 92: | Line 56: | ||
At the end, show total run time. | At the end, show total run time. | ||
Use boost libraries: format, | Use [http://www.boost.org/ boost] libraries: [http://www.boost.org/doc/libs/1_53_0/libs/format/doc/format.html format], [http://www.boost.org/doc/libs/1_53_0/doc/html/date_time.html date_time], [http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/index.htm filesystem]. | ||
Output format: | Output format: | ||
./prog /path/to/directory | |||
List of files in '/path/to/directory' | List of files in '/path/to/directory' | ||
Time: 00:00:00.123456 file: 'filename1' | Time: 00:00:00.123456 file: 'filename1' | ||
Time: 00:00:01.123456 file: ' | Time: 00:00:01.123456 file: 'filename2' | ||
Time: 00:00:02.123456 file: ' | Time: 00:00:02.123456 file: 'filename3' | ||
Total running time was: 00:00:10.654321 | Total running time was: 00:00:10.654321 |
Latest revision as of 16:23, 6 March 2013
Elementary knowledge of GIT, BASH, C++ will be tested.
Task may be completed on any Linux distribution (recommended debian/ubuntu)
GIT
- Save work progress in a repository
- For example github.com
- Use branches (help)
- One branch for implementing bash script and another branch for c++
- commit often, total number of commits should be 10+
- when checking out a random revision, it should compile.
- Branches start from master and must be merged back into master
BASH
Script 1 - Show memory usage
Script has 1 optional argument, path to meminfo file (contains current memory status). If it's not provided use /proc/meminfo
Use standard unix tools like awk, grep, sed to parse the input file.
Example of input file
cat /proc/meminfo MemTotal: 7969612 kB MemFree: 4582768 kB Buffers: 707368 kB Cached: 1122984 kB SwapCached: 0 kB Active: 1742408 kB Inactive: 1203472 kB [ ... ]
output:
./script1.sh /proc/meminfo RAM: 4582 MB used / 7969 MB total ( 3387 MB free)
Script 2 - compile c++ application
Compiles the C++ application Probably only has 1 useful line, g++ with some linker options.
example:
./script2.sh Compilation started Compilation finished
C++
List files in directory
Program takes one argument: path to directory. Outputs list of files.
Application must print out the name of directory. List all files in that directory. Each line must be preceded with the current running time of application. At the end, show total run time.
Use boost libraries: format, date_time, filesystem.
Output format:
./prog /path/to/directory List of files in '/path/to/directory' Time: 00:00:00.123456 file: 'filename1' Time: 00:00:01.123456 file: 'filename2' Time: 00:00:02.123456 file: 'filename3' Total running time was: 00:00:10.654321