From c5a8b2c72841ad0b58fb36870624737634778056 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 13 Oct 2018 03:10:03 +0200 Subject: HTMLize instructions and use jinja2 to render them Only fixed tasks for the kpov_2018 class for now. --- .../tasks/copy_rename_20_files_tail_env/task.py | 113 +++++++++------------ 1 file changed, 50 insertions(+), 63 deletions(-) (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env') 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': '''\ +

+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. Pazite, 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 pet sekund 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 spletni strani, 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.py, 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. + +

+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 /home/student/mama_ukaz. + +

+Write a program (which may be a shell script) that will track the contents of /var/log/syslog for five seconds. 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 one-second interval. Store the script in /home/student/syslog_ukaz.sh. + +

+Install the package cowsay and test it. 😊 + +

+Using the curl command 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. +''', } computers = { -- cgit v1.2.1