Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryVasanth authored Oct 30, 2024
2 parents 1e81e99 + 17187ec commit da6665e
Show file tree
Hide file tree
Showing 22 changed files with 671 additions and 38 deletions.
5 changes: 5 additions & 0 deletions employment-tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Test tasks from the real job interviews

This folder is used to store test tasks from the real job interviews. The tasks are stored in the `test-tasks` folder. Each task is stored in a separate folder with the name of the company that provided the task. Inside the company folder, there is a `README.md` file with the task description.

The real job interviews prepare students and junior specialists for the real job interviews. The tasks are designed to test the knowledge and skills of the candidates. The tasks are usually taken from the job position interviews and the company's technology stack.
38 changes: 38 additions & 0 deletions employment-tasks/devops/basic-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Site Reliability Engineer - Basic API Hosting Task

## Part 1 – The Web Service

Write a web service in any language that takes in a JSON payload, does
some basic validation against an expected message format and content,
and then puts that payload into a queue of your choice or a file.

Example valid payload:

```json
{
"ts": "1530228282",
"sender": "curler-user",
"message": {
"foo": "bar",
"hash": "bash"
},
"sent-from-ip": "1.2.3.4"
}
```

Validation rules:
● “ts” must be present and a valid Unix timestamp
● “sender” must be present and a string
● “message” must be present, a JSON object, and have at least one
field set
● If present, “sent-from-ip” must be a valid IPv4 address
● All fields not listed in the example above are invalid, and
should result in the message being rejected.

## Part 2 – Terraform

Deploy this application to your favourite cloud provider using Terraform.

## Part 3 – NewRelic

Implement NewRelic monitoring for this application using Terraform.
24 changes: 24 additions & 0 deletions employment-tasks/devops/notbad-task/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Senior DevOps Engineer - NotBad Header based API

Look at the following tasks and estimate how much time you will spend on them.

## Preconditions

### Technical & Knowledge

You need at least:

- Experience with AWS stack
- Experience with CI/CD
- Experience with Bash scripts
- Experience in at least one programming language (Java, Python, PHP, Perl, etc.)
- A text editor of your choice

## The tasks

1. We have a Terraform securitygroups.tf file. Every time Terraform runs, it says the security group in that file will be updated in place. Find a way to prevent this.

2. Look into keycloak folder. What can be improved?
3. Provide infrastructure and create CI/CD with a web app that will listen to 8089 port and return "ReallyNotBad" string when POST request contains header "NotBad" with value "true", eg. `curl -X POST -H "NotBad: true" https://someurl:8089/` should return "ReallyNotBad".
Use any technology you want to deploy the application to AWS. It can be Ansible, Terraform, etc. or a combination of some of them.
Hint: https://aws.amazon.com/free/
1 change: 1 addition & 0 deletions employment-tasks/devops/notbad-task/keycloak/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
7 changes: 7 additions & 0 deletions employment-tasks/devops/notbad-task/keycloak/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# alpeso-test

alpeso-test

## How-to use

Simple run `./keycloack.sh test test1` where test = keycloak user id and test1 = keycloak client secret.
8 changes: 8 additions & 0 deletions employment-tasks/devops/notbad-task/keycloak/keycloak.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

CLIENTID=$1
CLIENTSECRET=$2

TOKEN=$(curl -k -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic $(echo -n ${CLIENTID}:${CLIENTSECRET} | base64 )" --data "grant_type=client_credentials" "http://mydomain.com/auth/realms/myrealm/protocol/openid-connect/token" -s | jq -r .access_token)

echo $TOKEN
66 changes: 66 additions & 0 deletions employment-tasks/software-engineer/game-task/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Software Engineer - Game Task

### Tools and technologies used:

1. Go
2. PostgreSQL
3. Docker
4. Makefile
5. Postman

All database tables are in `migrations` folder. To run them, use `make` command.

1. `make migrate-up` - to run up migrations
2. `make migrate-down` - to run down migrations
3. `make migrate-force` - to force run migrations if you have some errors like `error: Dirty database version -1. Fix and force version.`

### Tables:

1. `users` - contains users data
2. `transaction` - contains transactions data

### Endpoints to test:

1. `GET /users` - to get all users
2. `GET /users/{user_id}` - to get user by id, check his balance
3. `GET /transactions/{user_id}` - to get all transactions by user id (check if user has any transactions)
4. `POST /process-record/{user_id}` - to process record by user id

Process record request body example:

```
{
"amount": 10,
"transaction_id": "64338a05-81e5-426b-b01e-927e447c9e33",
"state": "win"
}
```

Transaction id is unique, so you can't process the same transaction twice, provide UUID v4 format.
State can be `win` or `lose`.
Amount is a number should be positive but to have a negative balance you should provide a `lose` state.

### Required header for all endpoints:

1. `Source-Type: game` - available values: `game`, `server`, `payment`

Postman collection is in `postman` folder to test endpoints.

## To run the app locally:

1. Create `.env` file in root folder and add all required variables from `.env.example` file
2. To run migrations you should have migrate tool installed. You can install it with `brew install golang-migrate` (https://github.com/golang-migrate/migrate/tree/master/cmd/migrate)
3. To run any `make` command you should have `make` tool installed. You can install it with `sudo apt install make` command (https://linuxhint.com/install-make-ubuntu/)
4. Run `make migrate-up` command to run migrations and create all tables with test user (user_id: `63e83104-b9a7-4fec-929e-9d08cae3f9b9`)
5. Run `make run` command to run application
6. Take a look at `postman` folder to take collection for testing all endpoints

Test user with id `63e83104-b9a7-4fec-929e-9d08cae3f9b9` will be created automatically when you run migrations.
This user has 50 amount of his balance for testing.

## To run application in docker container:

1. Create `.env` file in root folder and add all required variables from `.env.example` file
2. To run docker container you should have `docker` and `docker-compose` tools installed (Tested on `Docker version 26.1.3, build b72abbb` and `Docker Compose version v2.27.1`)
3. `docker-compose up` - to run application in docker container
4. `docker-compose down` - to stop application in docker container
8 changes: 5 additions & 3 deletions subjects/ai/emotions-detector/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Emotion detector
## Emotions detector

### Overview

Expand Down Expand Up @@ -67,7 +67,9 @@ Your goal is to implement a program that takes as input a video stream that cont
This dataset was provided for this past [Kaggle challenge](https://www.kaggle.com/competitions/challenges-in-representation-learning-facial-expression-recognition-challenge/overview).
It is possible to find more information about on the challenge page. Train a CNN on the dataset `train.csv`. Here is an [example of architecture](https://www.quora.com/What-is-the-VGG-neural-network) you can implement.
**The CNN has to perform more than 60% on the test set**. You can use the `test_with_emotions.csv` file for this. You will see that the CNNs take a lot of time to train.
You don't want to overfit the neural network. I strongly suggest to use early stopping, callbacks and to monitor the training using the `TensorBoard` 'note: Integrating TensorBoard is not optional'.
You don't want to overfit the neural network. I strongly suggest to use early stopping, callbacks and to monitor the training using the `TensorBoard`.

> Note: Integrating TensorBoard is mandatory.
You have to save the trained model in `final_emotion_model.keras` and to explain the chosen architecture in `final_emotion_model_arch.txt`. Use `model.summary())` to print the architecture.
It is also expected that you explain the iterations and how you end up choosing your final architecture. Save a screenshot of the `TensorBoard` while the model's training in `tensorboard.png` and save a plot with the learning curves showing the model training and stopping BEFORE the model starts overfitting in `learning_curves.png`.
Expand Down Expand Up @@ -160,7 +162,7 @@ Preprocessing ...

### Tips

Balance technical prowess with psychological insight: as you fine-tune your CNN and optimize your video processing, remember that understanding the nuances of human facial expressions is key to creating a truly effective emotion detection system.
Balance technical prowess with psychological insight: as you fine-tune your CNN and optimize your video processing, remember that understanding the nuances of human facial expressions is key to creating a truly effective emotion detection system. Good luck!

### Resources

Expand Down
182 changes: 182 additions & 0 deletions subjects/ai/emotions-detector/audit/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,185 @@
#### Emotions detector

##### Preliminary

###### Does the structure of the project is equivalent to the one described in the subject `Delivery` section?

###### Does the README file summarize how to run the code and explain the global approach?

###### Does the environment contain all libraries used and their versions that are necessary to run the code?

###### Do the text files explain the chosen architectures?

#### CNN emotion classifier

###### Is the model trained only with the training set?

###### Is the accuracy on the test set higher than 60%?

###### Do the learning curves prove that the model is not overfitting?

###### Has the training been stopped early enough to avoid the overfitting?

###### Does the screenshot show the usage of the `TensorBoard` to monitor the training?

###### Does the text document explain why the architecture was chosen, and what were the previous iterations?

###### Does the following command `python ./scripts/predict.py` run without any error and returns an accuracy greater than 60%?

```prompt
python ./scripts/predict.py
Accuracy on test set: 62%
```

#### Face detection on the video stream

###### Does the preprocessing pipeline take as input the webcam video stream of minimum 20 sec and save in a separate folder at least 20 preprocessed\* images?

###### Do all images contain a face?

###### Are all images reshaped and centered on the face?

###### Is the algorithm that detects the face imported via cv2?

###### Is the image converted to 48 x 48 grayscale pixels' image?

###### If there's an issue related to the webcam, does the code take as input a video recorded video stream?

###### Does the following command `python ./scripts/predict_live_stream.py` run without any error and return the following?

```prompt
python ./scripts/predict_live_stream.py
Reading video stream ...
Preprocessing ...
11:11:11s : Happy , 73%
Preprocessing ...
11:11:12s : Happy , 93%
Preprocessing ...
11:11:13s : Surprise , 71%
Preprocessing ...
11:11:14s : Neutral , 82%
...
Preprocessing ...
11:13:29s : Happy , 63%
```

#### Hack the CNN - guidelines:

The neural network trains by updating its weights given the training error. If an image is misclassified the neural network changes its weight to classify it correctly. The trick is to keep the neural network's weights unchanged and to modify the input pixels in order to force the neural network to predict the wanted class.
This part is validated if:

##### Choose an image from the database that gives more than 90% probability of `Happy`

###### Does the neural network modify the input pixels to predict Sad?

###### Can you recognize easily the chosen image? The modified image is SLIGHTLY changed. It means that you recognize very easily the original image.

Here are three resources that detail similar approaches:

- https://github.com/XC-Li/Facial_Expression_Recognition/tree/master/Code/RAFDB
- https://github.com/karansjc1/emotion-detection/tree/master/with%20flask
- https://www.kaggle.com/drbeanesp21/aliaj-final-facial-expression-recognition (simplified)

#### Emotion detector

##### Preliminary

###### Does the structure of the project is equivalent to the one described in the subject `Delivery` section?

###### Does the README file summarize how to run the code and explain the global approach?

###### Does the environment contain all libraries used and their versions that are necessary to run the code?

###### Do the text files explain the chosen architectures?

#### CNN emotion classifier

###### Is the model trained only the training set?

###### Is the accuracy on the test set higher than 60%?

###### Do the learning curves prove that the model is not overfitting?

###### Has the training been stopped early enough to avoid the overfitting?

###### Does the screenshot show the usage of the `TensorBoard` to monitor the training?

###### Does the text document explain why the architecture was chosen, and what were the previous iterations?

###### Does the following command `python ./scripts/predict.py` run without any error and returns an accuracy greater than 60%?

```prompt
python ./scripts/predict.py
Accuracy on test set: 62%
```

#### Face detection on the video stream

###### Does the preprocessing pipeline take as input the webcam video stream of minimum 20 sec and save in a separate folder at least 20 preprocessed\* images?

###### Do all images contain a face?

###### Are all images reshaped and centered on the face?

###### Is the algorithm that detects the face imported via cv2?

###### Is the image converted to 48 x 48 grayscale pixels' image?

###### If there's an issue related to the webcam, does the code take as input a video recorded video stream?

###### Does the following command `python ./scripts/predict_live_stream.py` run without any error and return the following?

```prompt
python ./scripts/predict_live_stream.py
Reading video stream ...
Preprocessing ...
11:11:11s : Happy , 73%
Preprocessing ...
11:11:12s : Happy , 93%
Preprocessing ...
11:11:13s : Surprise , 71%
Preprocessing ...
11:11:14s : Neutral , 82%
...
Preprocessing ...
11:13:29s : Happy , 63%
```

#### Hack the CNN - guidelines:

The neural network trains by updating its weights given the training error. If an image is misclassified the neural network changes its weight to classify it correctly. The trick is to keep the neural network's weights unchanged and to modify the input pixels in order to force the neural network to predict the wanted class.
This part is validated if:

##### Choose an image from the database that gives more than 90% probability of `Happy`

###### Does the neural network modify the input pixels to predict Sad?

###### Can you recognize easily the chosen image? The modified image is SLIGHTLY changed. It means that you recognize very easily the original image.

Here are three resources that detail similar approaches:

- https://github.com/XC-Li/Facial_Expression_Recognition/tree/master/Code/RAFDB
- https://github.com/karansjc1/emotion-detection/tree/master/with%20flask
- https://www.kaggle.com/drbeanesp21/aliaj-final-facial-expression-recognition (simplified)

#### Emotion detector

##### Preliminary
Expand Down
Loading

0 comments on commit da6665e

Please sign in to comment.