Merge branch '36-foolsday' into 'master'

Resolve "foolsday"

Closes #36

See merge request slon/shad-go-private!48
This commit is contained in:
verytable 2021-03-31 21:03:33 +00:00
commit 02eb666f77
8 changed files with 92 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 @@
# foolsday2
Чур без спойлеров!

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
}

33
foolsday3/lambda_test.go Normal file
View file

@ -0,0 +1,33 @@
// +build !race
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()
}

17
foolsday3/solution.go Normal file
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.Nanosecond, func() {
true = int(0) == 0
})
return nil
}