Add foolsday tasks.

This commit is contained in:
Arseny Balobanov 2021-03-31 22:15:03 +03:00
parent 183503ebfb
commit 785e997a72
8 changed files with 90 additions and 0 deletions

View file

@ -1,3 +1,14 @@
- group: April Fools' Day
start: 01-04-2021 00:00
deadline: 01-04-2021 23:59
tasks:
- task: foolsday1
score: 50
- task: foolsday2
score: 50
- task: foolsday3
score: 50
- group: HTTP - group: HTTP
start: 25-03-2021 18:00 start: 25-03-2021 18:00
deadline: 04-04-2021 23:59 deadline: 04-04-2021 23:59

5
foolsday1/README.md Normal file
View file

@ -0,0 +1,5 @@
# foolsday1
В этой задаче нужно прислать в телеграм чат курса уникальный и субъективно смешной мем!
После этого сдать флаг `FLAG{foolsday1:april-first:229383d33b0798ef58a74040fc618baa}`.

3
foolsday2/README.md Normal file
View file

@ -0,0 +1,3 @@
# foolsday-2
Чур без спойлеров!

11
foolsday2/flag_test.go Normal file
View file

@ -0,0 +1,11 @@
// +build private
package main
import "testing"
const flag = "FLAG{foolsday2:hidden-gem:07a5e6469f2178616cba4e9a0410e050}"
func TestHiddenGem(t *testing.T) {
t.Logf("Here's your flag: %s", flag)
}

3
foolsday3/README.md Normal file
View file

@ -0,0 +1,3 @@
# foolsday3
Если вы совсем застряли: [подсказка](https://bit.ly/3wipKMz).

9
foolsday3/lambda.go Normal file
View file

@ -0,0 +1,9 @@
// +build !solution
package foolsday3
import "context"
func lambda(ctx context.Context) interface{} {
return nil
}

31
foolsday3/lambda_test.go Normal file
View file

@ -0,0 +1,31 @@
package foolsday3
import (
"context"
"testing"
"time"
)
func TestLambda(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
var doNotPrint bool
var validateLambdaFunc = func(end time.Time) bool {
return time.Now() == end
}
result := lambda(ctx)
end := time.Now()
if validateLambdaFunc(end) == true {
t.Logf("[%s] Great! Your function is very fast!", end.Format("15:04:05.999999"))
if doNotPrint != true {
t.Log("Congrats!")
return
}
t.Log(result)
t.FailNow()
}
t.Logf("[%s] result of your slow function:", end.Format("15:04:05.999999"))
t.Log(result)
t.FailNow()
}

View file

@ -0,0 +1,17 @@
// +build solution
package foolsday3
import (
"context"
"time"
)
var true = false
func lambda(ctx context.Context) interface{} {
time.AfterFunc(time.Microsecond, func() {
true = int(0) == 0
})
return nil
}