summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/copy_rename_20_files_tail_env
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-13 03:10:03 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-13 03:17:06 +0200
commitc5a8b2c72841ad0b58fb36870624737634778056 (patch)
tree01259a4a3338777031ae730366ea0193f86db222 /kpov_judge/tasks/copy_rename_20_files_tail_env
parent1cbc2f75ac1adf5ee70971052c819cdca1a0948c (diff)
HTMLize instructions and use jinja2 to render them
Only fixed tasks for the kpov_2018 class for now.
Diffstat (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env')
-rw-r--r--kpov_judge/tasks/copy_rename_20_files_tail_env/task.py113
1 files changed, 50 insertions, 63 deletions
diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
index aa57d3e..b65161d 100644
--- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
+++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
@@ -1,69 +1,56 @@
# kpov_util should be imported by add_assignment.py
-# TODO (polz):
instructions = {
- 'si':"""
-Prijavi se na sistem kot uporabnik student z geslom vaje.
-V domači mapi najdeš imenik {file_rename_dirname} z 20 datotekami.
- - Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
- - Napiši najkrajši ukaz v bash, ki vse datoteke iz imenika {mv_src_dir}
- premakne v imenik {mv_dst_dir}. Ukaz spravi v
- /home/student/mv_ukaz. Pazi, da bodo ob testiranju v izvornem imeniku ISTE
- datoteke, kot so bile, ko je bila virtualka nova, ciljni imenik pa bo
- prazen. To pomeni, da boste verjetno morali po vsakem testiranju datoteke
- premakniti nazaj. Za krajšanje ukaza lahko izkoristite imeni imenikov.
- - Napiši ukaz, ki s pomočjo ukaza grep v datoteko ~/mama.txt izpiše imena vseh
- navadnih (ne skritih) datotek v trenutnem imeniku, ki vsebujejo niz "mama",
- v datoteko ~/napake.txt pa izpiše vse morebitne napake (npr. to, da so nekateri
- objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave).
- Ukaz spravite v datoteko /home/student/mama_ukaz.
- - Napiši program (lahko v bash), ki bo 5s sledil vsebini /var/log/syslog. V
- primeru, da se v syslogu pojavi niz "zmeda", naj program izpiše "imam ga".
- Poleg tega naj program med sledenjem syslog-u odšteva od 5 do 1 (vsako sekundo
- naj se izpiše naslednja številka. Program naj bo v /home/student/syslog_ukaz.sh
- - Namesti paket "cowsay" in ga preizkusi :)
- - S pomočjo programa cURL preštej število pojavitev niza "images" v html kodi,
- ki jo dobiš na naslovu http://localhost/{curl_fname} na malishell in število zapiši
- v spremenljivko $images na simpleArbiterDhcpGW v lupini, kjer poganjaš
- task_check.py
- - V imeniku {wc_dirname} najdeš datoteko count.txt. Preštej število prehodov
- v novo vrstico v count.txt in rezultat zapiši v novo datoteko - lines.txt
- v istem imeniku.
-""",
- 'en':"""
-Log into the system as student using vaje as your password.
-In your home folder you will find a directory called {file_rename_dirname}
- containing 20 files.
- - Rename all files in that directory replacing all dashes with
- underscores
- - Find the shortest command for copying all the files located in
- {mv_src_dir} into the folder {mv_dst_dir}.
- Create a shell script /home/student/mv_ukaz containing this command.
- Before running test_task, make sure {mv_src_dir} contains the same
- files as when you downloaded your virtual disk. This probably means
- that you will have to move the files back from {mv_dst_dir} to
- {mv_src_dir} after each test. You can use the directory na
- - Come up with a command or sequence of commands in bash which will,
- using grep, write the names all normal (not hidden) files which contain
- the string "mama" and are located in the working directory (pwd)
- into the file ~/mama.txt while writing errors such as files in current
- directory being folders or symbolic links in the file called
- "napake.txt". Write this command to mama_ukaz.
- - Write a program (which may be a shell script) that will track the contents
- of /var/log/syslog for 5s. Every time an entry containing the string "zmeda"
- appears in the syslog, the script should output "imam ga".
- In addition, the script should count down from 5 to 1 with a 1 second
- interval. Store the script in /home/student/syslog_ukaz.sh .
- - Install the packet "cowsay" and test it :)
- - With the help of cURL count the number of occurences of the string
- "images" on the web page accessible from malishell at
- http://localhost/{curl_fname}.
- On simpleArbiterDhcpGW within the shell where you are running test_task.py, set
- the environment variable $images to this number.
- - In the directory {wc_dirname} there is a file called count.txt. Write the
- number of newlines in this file into the file lines.txt in the same
- directory.
-"""
+ 'si': '''\
+<p>
+Prijavi se na sistem kot uporabnik <code>student</code> z geslom <code>vaje</code>.
+
+<p>
+V domači mapi najdeš imenik <code>{{file_rename_dirname}}</code> z 20 datotekami. Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji.
+
+<p>
+Napiši najkrajši ukaz v <code>bash</code>, ki vse datoteke iz imenika <code>{{mv_src_dir}}</code> premakne v imenik <code>{{mv_dst_dir}}</code>. Ukaz spravi v <code>/home/student/mv_ukaz</code>. Pazite, da bodo ob testiranju v izvornem imeniku <em>iste</em> datoteke, kot so bile, ko je bila virtualka nova, ciljni imenik pa bo prazen. To pomeni, da boste verjetno morali po vsakem testiranju datoteke premakniti nazaj. Za krajšanje ukaza lahko izkoristite imeni imenikov.
+
+<p>
+Napiši ukaz, ki s pomočjo ukaza <code>grep</code> v datoteko <code>~/mama.txt</code> izpiše imena vseh navadnih (ne skritih) datotek v trenutnem imeniku, ki vsebujejo niz <code>mama</code>, v datoteko <code>~/napake.txt</code> pa izpiše vse morebitne napake (npr. to, da so nekateri objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave). Ukaz spravite v datoteko <code>/home/student/mama_ukaz</code>.
+
+<p>
+Napiši program (lahko v <code>bash</code>), ki bo pet sekund sledil vsebini <code>/var/log/syslog</code>. V primeru, da se v syslogu pojavi niz <code>zmeda</code>, naj program izpiše <code>imam ga</code>. Poleg tega naj program med sledenjem syslog-u odšteva od 5 do 1 (vsako sekundo naj se izpiše naslednja številka). Program naj bo v <code>/home/student/syslog_ukaz.sh</code>.
+
+<p>
+Namesti paket <code>cowsay</code> in ga preizkusi. 😊
+
+<p>
+S pomočjo programa <code>curl</code> preštej število pojavitev niza <code>images</code> v spletni strani, ki jo dobiš na naslovu <code>http://localhost/{{curl_fname}}</code> na <em>malishell</em> in število zapiši v spremenljivko <code>$images</code> na <em>simpleArbiterDhcpGW</em> v lupini, kjer poganjaš <code>task_check.py</code>.
+
+<p>
+V imeniku <code>{{wc_dirname}}</code> najdeš datoteko <code>count.txt</code>. Preštej število prehodov v novo vrstico v <code>count.txt</code> in rezultat zapiši v novo datoteko <code>lines.txt</code> v istem imeniku.
+''',
+ 'en': '''\
+<p>
+Log into the system as <code>student</code> using <code>vaje</code> as your password.
+
+<p>
+In your home folder you will find a directory called <code>{{file_rename_dirname}}</code> containing 20 files. Rename all files in that directory replacing all dashes with underscores
+
+<p>
+Find the shortest command for copying all the files located in <code>{{mv_src_dir}}</code> into the folder <code>{{mv_dst_dir}}</code>. Create a shell script <code>/home/student/mv_ukaz</code> containing this command. Before running <code>test_task.py</code>, make sure <code>{{mv_src_dir}}</code> contains the same files as when you downloaded your virtual disk. This probably means that you will have to move the files back from <code>{{mv_dst_dir}}</code> to <code>{{mv_src_dir}}</code> after each test.
+
+<p>
+Come up with a command or sequence of commands in bash which will, using <code>grep</code>, write the names all normal (not hidden) files which contain the string <code>mama</code> and are located in the working directory (<code>pwd</code>) into the file <code>~/mama.txt</code> while writing errors such as files in current directory being folders or symbolic links in the file called <code>napake.txt</code>. Write this command to <code>/home/student/mama_ukaz</code>.
+
+<p>
+Write a program (which may be a shell script) that will track the contents of <code>/var/log/syslog</code> for five seconds. Every time an entry containing the string <code>zmeda</code> appears in the syslog, the script should output <code>imam ga</code>. In addition, the script should count down from 5 to 1 with a one-second interval. Store the script in <code>/home/student/syslog_ukaz.sh</code>.
+
+<p>
+Install the package <code>cowsay</code> and test it. 😊
+
+<p>
+Using the <code>curl</code> command count the number of occurences of the string <code>images</code> on the web page accessible from <em>malishell</em> at <code>http://localhost/{{curl_fname}}</code>. On <em>simpleArbiterDhcpGW</em> within the shell where you are running <code>test_task.py</code>, set the environment variable <code>$images</code> to this number.
+
+<p>
+In the directory <code>{{wc_dirname}}</code> there is a file called <code>count.txt</code>. Write the number of newlines in this file into the file <code>lines.txt</code> in the same directory.
+''',
}
computers = {