Skip to content

Commit

Permalink
Modify the structure of README.md
Browse files Browse the repository at this point in the history
Instead of having exercises in their own separate section,
they are now part of the main topics sections.

This should make the learning process easier to follow
where users have both exercises and questions in the same
place.

In addition, added a couple of new questions & exercises
and modified existing scripts accordingly.
  • Loading branch information
abregman committed Jul 11, 2021
1 parent dfbe979 commit e54648d
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 81 deletions.
194 changes: 117 additions & 77 deletions README.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion coding/python/binary_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import random


def binary_search(arr, lb, ub, target):
"""
A Binary Search Example which has O(log n) time complexity.
A Binary Search Example which has O(log n) time complexity.
"""
if lb <= ub:
mid = ub + lb // 2
Expand All @@ -17,6 +18,7 @@ def binary_search(arr, lb, ub, target):
else:
return -1


if __name__ == '__main__':
rand_num_li = sorted([random.randint(1, 50) for _ in range(10)])
target = random.randint(1, 50)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

### Bonus

Containerize the app of the project you forked using any containerization technology you want.
Containerize the app of the project you forked using any containerization technology you would like.
19 changes: 19 additions & 0 deletions exercises/git/branch_01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Git Commit 01

### Objective

Learn how to work with Git Branches

### Instructions

1. Pick up a Git repository (or create a new one) with at least one commit
2. Create a new branch called "dev"
3. Modify one of the files in the repository
4. Create a new commit
5. Verify the commit you created is only in "dev" branch

### After you complete the exercise

Answer the following:

1. Why branches are useful? Give an example of one real-world scenario for using branches
20 changes: 20 additions & 0 deletions exercises/git/commit_01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Git Commit 01

### Objective

Learn how to commit changes in Git repositories

### Instructions

1. Create a new directory
2. Make it a git repository
3. Create a new file called `file` with the content "hello commit"
4. Commit your new file
5. Run a git command to verify your commit was recorded

### After you complete the exercise

Answer the following:

* What are the benefits of commits?
* Is there another way to verify a commit was created?
20 changes: 20 additions & 0 deletions exercises/git/solutions/branch_01_solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Branch 01 - Solution

```
cd some_repository
echo "master branch" > file1
git add file1
git commit -a -m "added file1"
git checkout -b dev
echo "dev branch" > file2
git add file2
git commit -a -m "added file2"
```

Verify:

```
git log (you should see two commits)
git checkout master
git log (you should see one commit)
```
10 changes: 10 additions & 0 deletions exercises/git/solutions/commit_01_solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Git Commit 01 - Solution

```
mkdir my_repo && cd my_repo
git init
echo "hello_commit" > file
git add file
git commit -a -m "It's my first commit. Exciting!"
git log
```
14 changes: 14 additions & 0 deletions exercises/jenkins/remove_builds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Jenkins - Remove Jobs

#### Objective

Learn how to write a Jenkins script that interacts with builds by removing builds older than X days.

#### Instructions

1. Pick up (or create) a job which has builds older than X days
2. Write a script to remove only the builds that are older than X days

#### Hints

X can be anything. For example, remove builds that are older than 3 days. Just make sure that you don't simply remove all the builds (since that's different from the objective).
10 changes: 10 additions & 0 deletions exercises/jenkins/remove_jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Jenkins - Remove Jobs

#### Objective

Learn how to write a Jenkins script to remove Jenkins jobs

#### Instructions

1. Create three jobs called: test-job, test2-job and prod-job
2. Write a script to remove all the jobs that include the string "test"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"REMOVE_ME"/ }
def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"test"/ }

jobs.each { job ->
println job.name
Expand Down
2 changes: 1 addition & 1 deletion scripts/count_questions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# We dont care about non alphanumerics filenames so we just ls | grep to shorten the script.

echo $(( $(ls -R ./exercises/ | grep ".*md" -c) + $(grep \</summary\> -c README.md) ))
echo $(( $(grep \</summary\> -c README.md) + $(grep -i Solution README.md | grep \.md -c) ))

0 comments on commit e54648d

Please sign in to comment.