Here you can find source code for simple fractal implementation
written in bash for hackerrank,
which looks like this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func getEmployee(id string) (Employee, int) { | |
| e, err := db.GetEmployeeByID(id) | |
| if err != nil { | |
| // error handling provided earlier | |
| } | |
| return e, 200 | |
| } | |
| func GetEmployeeName(id string) (string, int) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func withEmployee(id string, cb func(Employee) (string, int)) (string, int) { | |
| e, err := db.GetEmployeeByID(id) | |
| if err != nil { | |
| // error handling provided earlier | |
| } | |
| return cb(e) | |
| } | |
| func GetEmployeeName(id string) (string, int) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if err != nil { | |
| httpErrorCode := 500 | |
| switch err { | |
| case ErrorInvalidID: | |
| httpErrorCode = 400 | |
| case ErrorUnauthorized: | |
| httpErrorCode = 401 | |
| case ErrorEmployeeNotFound: | |
| httpErrorCode = 404 | |
| // other errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "containerDefinitions": [ | |
| { | |
| "name": "$(YourServiceName)", | |
| "image": "$(YourUserID).dkr.ecr.us-east-1.amazonaws.com/$(YourImage):$(YourTag)", | |
| "portMappings": [ | |
| { | |
| "protocol": "tcp", | |
| "hostPort": 8080, | |
| "containerPort": 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| build_and_push_image: | |
| docker build \ | |
| -t $(YourUserID).dkr.ecr.us-east-1.amazonaws.com/$(YourImage):$(YourTag) \ | |
| -f deploy/Dockerfile . | |
| eval $(shell aws ecr get-login --no-include-email) | |
| docker push $(YourUserID).dkr.ecr.us-east-1.amazonaws.com/$(YourImage):$(YourTag) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deploy: | |
| aws ecs update-service --cluster=$(YourCluster) --service=$(YourSrvc) --task-definition=`\ | |
| aws ecs register-task-definition --cli-input-json file://AWSTaskDefinition.json \ | |
| | grep -Eo $(YourSrvc)':[0-9]+' \ | |
| ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| delete_old_versions: | |
| aws ecs list-task-definitions --sort=DESC \ | |
| | grep -Eo $(YourSrvc)':[0-9]+' \ | |
| | tail -n +2 \ | |
| | while read v; do aws ecs deregister-task-definition --task-definition=$$v; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| "os" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "executions": [ | |
| { | |
| "id": 132, | |
| "status": "succeeded", | |
| "project": "TEST-Sylvain", | |
| "executionType": "user", | |
| "user": "sthirard", | |
| "date-started": { | |
| "unixtime": 1560946609000, |
