To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 457d537f authored by nilsl's avatar nilsl
Browse files

Add hacking session material

parent a7ce75a4
You successfully wrote an image to fake disk!
# For the grep exercise
## Explanation
This is a textfile for use with the grep exercise.
It contains some words, so you can search for patterns.
Dog
Dig
Dug
Here is a line containing a ## that is not at the beginning of the line because I am evil.
Brat
Cat
Rat
Sat
Mat
Wat
Latin
Pat
Hat
Fat
Vat
Tat
Bat
## Animals
This subsection contains a list of "animals".
(The plus signs are there to make things slightly easier for you. After all, it's fairly hard to distinguish animals from other words using only regexes)
+ Dangernoodle, a natural enemy of the Booplesnoot
+ Majestic Sea Flap-Flap
+ Dangerous Sea Flap-Flap
+ Trash Panda
+ Fart Squirrel (not as undangerous as it sounds)
+ Danger Floof - not to be confused with the Danger Water Cow
+ Nope Rope
+ Sword Pig (not as dangerous as it sounds)
+ Bacon Puppy
+ Dapper Chickens
+ and finally Strangerdanger which could be a name for a dog.
### This is a subsubsection
* It contains
* Some list elements
* Such as this one
### Code
Here's some code that can be searched.
This is a bit harder, since the exercises corresponding to it, require regexes that span over multiple lines.
```java
class Main {
public static void main(String[] args) {
Out o = new Out();
o.out();
}
}
class Out {
public void out() {
System.out.println("Hello World!");
}
}
```
#!/usr/bin/env bash
while true; do
echo "this is an infinite loop... kill me if you can"
sleep 1
done
/*
* This program is a super awesome numerical simulation of some super duper
* new ultra cool physcial thingy. And of course it takes forever to run,
* so you have to run on the ultra modern amazingly new TheAlt super cluster.
*/
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
int main() {
printf("Starting calculation...\n");
sleep(2);
// some cleverly named variables
int a, b, c;
// initialize the variables
a = 42;
b = 0;
c = 0;
//actually do the calculation
b = c++;
b++;
int temp = a;
a = b + c;
srand(time(NULL));
int r;
int i = 200000;
while (i --> 0) {
r = rand();
printf("%d \n", r);
sleep (0.8);
if (i == 150000) {
printf ("\n preprocessing done\n");
sleep(1);
} else if (i == 1000) {
printf("\n Main calculations done. Starting Clean up \n");
sleep(1);
}
}
c = temp+1;
a = temp;
int res = a;
char result[3];
result[2] = 0;
if (res == 42) {
// we are happy the calculation worked
snprintf(result, 3, "%d", res);
} else {
result[0] = '4'; // correct the wrong calculation
result[1] = '2';
}
// save the result in the res file
FILE *fp;
fp = fopen("AmazingResults.txt", "w+");
fputs(result, fp);
fclose(fp);
// notify the user
printf("the answer to everything has just been calculated\n");
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment