├── 0-OSI_model ├── 0x04-loops_conditions_and_parsing ├── .7-clock.swp ├── 0-RSA_public_key.pub ├── 1-for_best_school ├── 10-fizzbuzz ├── 100-read_and_cut ├── 101-tell_the_story_of_passwd ├── 102-lets_parse_apache_logs ├── 103-dig_the-data ├── 2-while_best_school ├── 3-until_best_school ├── 4-if_9_say_hi ├── 5-4_bad_luck_8_is_your_chance ├── 6-superstitious_numbers ├── 7-clock ├── 8-for_ls ├── 9-to_file_or_not_to_file └── README.md ├── 0x05-processes_and_signals ├── .102-zombie.c.swp ├── 0-what-is-my-pid ├── 1-list_your_processes ├── 100-process_and_pid_file ├── 101-manage_my_process ├── 102-zombie.c ├── 2-show_your_bash_pid ├── 3-show_your_bash_pid_made_easy ├── 4-to_infinity_and_beyond ├── 5-dont_stop_me_now ├── 6-stop_me_if_you_can ├── 7-highlander ├── 8-beheaded_process ├── README.md ├── manage_my_process └── zombie ├── 0x06-regular_expressions ├── 0-simply_match_school.rb ├── 1-repetition_token_0.rb ├── 100-textme.rb ├── 2-repetition_token_1.rb ├── 3-repetition_token_2.rb ├── 4-repetition_token_3.rb ├── 5-beginning_and_end.rb ├── 6-phone_number.rb ├── 7-OMG_WHY_ARE_YOU_SHOUTING.rb └── README.md ├── 0x07-networking_basics ├── 0-OSI_model ├── 1-types_of_network ├── 2-MAC_and_IP_address ├── 3-UDP_and_TCP ├── 4-TCP_and_UDP_ports ├── 5-is_the_host_on_the_network └── README.md ├── 0x08-networking_basics_2 ├── .0-change_your_home_IP.swp ├── 0-change_your_home_IP ├── 1-show_attached_IPs ├── 100-port_listening_on_localhost └── README.md ├── 0x09-web_infrastructure_design ├── 0-simple_web_stack ├── 1-distributed_web_infrastructure ├── 2-secured_and_monitored_web_infrastructure ├── 3-scale_up └── README.md ├── 0x0A-configuration_management ├── 0-create_a_file.pp ├── 1-install_a_package.pp ├── 2-execute_a_command.pp ├── README.md └── killmenow ├── 0x0B-ssh ├── .2-ssh_config.swp ├── .web-01.swo ├── .web-01.swp ├── 0-use_a_private_key ├── 1-create_ssh_key_pair ├── 100-puppet_ssh_config.pp ├── 2-ssh_config ├── README.md └── web-01 ├── 0x0C-web_server ├── .2-setup_a_domain_name.swp ├── 0-transfer_file ├── 1-install_nginx_web_server ├── 2-setup_a_domain_name ├── 3-redirection ├── 4-not_found_page_404 ├── 7-puppet_install_nginx_web_server.pp ├── README.md └── web-01 ├── 0x0D-web_stack_debugging_0 ├── 0-give_me_a_page └── README.md ├── 0x0E-web_stack_debugging_1 ├── 0-nginx_likes_port_80 ├── 1-debugging_made_short └── README.md ├── 0x0F-load_balancer ├── .1-install_load_balancer.swp ├── 0-custom_http_response_header ├── 1-install_load_balancer ├── 2-puppet_custom_http_response_header.pp ├── README.md ├── lb-01 ├── web-01 └── web-02 ├── 0x10-https_ssl ├── .0-world_wide_web.swp ├── 0-world_wide_web ├── 1-haproxy_ssl_termination ├── 100-redirect_http_to_https └── README.md ├── 0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter ├── 0-blog_post ├── 1-what_happen_when_diagram ├── 2-contribution-to_what-happens-when_github_answer └── README.md ├── 0x12-web_stack_debugging_2 ├── 0-iamsomeoneelse ├── 1-run_nginx_as_nginx ├── 100-fix_in_7_lines_or_less └── README.md ├── 0x14-mysql ├── 4-mysql_configuration_primary ├── 4-mysql_configuration_replica ├── 5-mysql_backup ├── README.md ├── lb-01 ├── web-01 └── web-02 ├── 0x15-api ├── 0-gather_data_from_an_API.py ├── 1-export_to_CSV.py ├── 2-export_to_JSON.py ├── 3-dictionary_of_list_of_dictionaries.py ├── README.md └── todo_all_employees.json ├── 0x16-api_advanced ├── 0-main.py ├── 0-subs.py ├── 1-main.py ├── 1-top_ten.py ├── 100-count.py ├── 100-main.py ├── 2-main.py ├── 2-recurse.py ├── README.md └── __pycache__ │ ├── 0-subs.cpython-35.pyc │ ├── 1-top_ten.cpython-35.pyc │ ├── 100-count.cpython-35.pyc │ └── 2-recurse.cpython-35.pyc ├── 0x17-web_stack_debugging_3 ├── 0-strace_is_your_friend.pp └── README.md ├── 0x18-webstack_monitoring ├── 0-strace_is_your_friend.pp ├── 2-setup_datadog └── README.md ├── 0x19-postmortem └── README.md ├── 0x1A-application_server ├── 2-app_server-nginx_config ├── 3-app_server-nginx_config ├── 4-app_server-nginx_config ├── 4-reload_gunicorn_no_downtime ├── 5-app_server-nginx_config ├── README.md └── gunicorn.service ├── 0x1B-web_stack_debugging_4 ├── 0-the_sky_is_the_limit_not.pp ├── 1-user_limit.pp └── README.md ├── README.md ├── attack_is_the_best_defense ├── 0-sniffing ├── 1-dictionary_attack ├── README.md └── user_authenticating_into_server ├── command_line_for_the_win ├── 0-first_9_tasks.PNG ├── 0-first_9_tasks.jpg ├── 1-next_9_tasks.JPG ├── 1-next_9_tasks.PNG ├── 2-next_9_tasks.JPG ├── 2-next_9_tasks.PNG └── README.md ├── lb-01 ├── web-01 └── web-02 /0-OSI_model: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/.7-clock.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x04-loops_conditions_and_parsing/.7-clock.swp -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/0-RSA_public_key.pub: -------------------------------------------------------------------------------- 1 | ---- BEGIN SSH2 PUBLIC KEY ---- 2 | Comment: "rsa-key-20230428" 3 | AAAAB3NzaC1yc2EAAAADAQABAAABAQCgI2Rr3l/vjPhyovkvvvFO+yFCHvctBUQj 4 | 8pJXtetSODYOkGwwjJstdMQpCRL17iv5368y49qqFfQqNdEAL6gdabqW2jyNNDZe 5 | OJRdXYER/GsV1puLmbMW/qjDgQMi2/nIIG/ZusA7LVNECD0xGusvlD+ljZGT9tsW 6 | EBvIkPctclTpyW5i6uh0i1W0NINQgaxvctXUrIQFg4oFUoPevkY6uq8Vrsr8YhSD 7 | rgEM9kpmWN5j7RomfqhieupVXSO3J2mbNDGIs9zzkm/+Zbd5Unv84jCcQSZ+/pv7 8 | rM3k/CNMJGd/h4It+A9lhUrZOo1/BR1EPz4bn4P2iXBJS1FYyQLx 9 | ---- END SSH2 PUBLIC KEY ---- 10 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/1-for_best_school: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display "Best School" 10 times with echo in for loop 3 | 4 | for (( i=0; i<10; i++ )) 5 | do 6 | echo "Best School" 7 | done 8 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/10-fizzbuzz: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Program prints FizzBuzz sequence if divisible to 5 and 3. 3 | 4 | for i in {1..100} 5 | do 6 | if [ $((i % 5)) -eq 0 -a $((i % 3)) -eq 0 ] 7 | then 8 | echo "FizzBuzz" 9 | elif [ $((i % 3)) -eq 0 ] 10 | then 11 | echo "Fizz" 12 | elif [ $((i % 5)) -eq 0 ] 13 | then 14 | echo "Buzz" 15 | else 16 | echo "$i" 17 | fi 18 | done 19 | 20 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/100-read_and_cut: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays `/etc/passwd`username, user id, and user directory. 3 | 4 | while read passwd; do 5 | echo "$passwd" | cut -d ':' -f1,3,6 6 | done < "/etc/passwd" 7 | 8 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/101-tell_the_story_of_passwd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tells a story based on the contents of the file `/etc/passwd`. 3 | 4 | while IFS=':' read username password uid gid info home shell; do 5 | echo "The user $username is part of the $gid gang,"\ 6 | "lives in $home and rides $shell."\ 7 | "$uid's place is protected by the passcode $password,"\ 8 | "more info about the user here: $info" 9 | done < "/etc/passwd" 10 | 11 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/102-lets_parse_apache_logs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Parses Apache log files in list format line by line. 3 | # then Displays the IP and HTTP status code. 4 | 5 | awk '{print $1 " " $9}' apache-access.log 6 | 7 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/103-dig_the-data: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Parses Apache log files in list format line by line. 3 | # Groups visitors by IP and HTTP status code and display. 4 | 5 | awk '{ print $1 " " $9}' apache-access.log | sort | uniq -c | sort -rn 6 | 7 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/2-while_best_school: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display "Best School" 10 times with echo in while loop 3 | 4 | counter=1 5 | while [ $counter -le 10 ] 6 | do 7 | echo "Best School" 8 | counter=$(( counter + 1 )) 9 | done 10 | 11 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/3-until_best_school: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display "Best School" 10 times with echo in using until 3 | 4 | counter=0 5 | until [ $counter -gt 9 ] 6 | do 7 | echo "Best School" 8 | ((counter++)) 9 | done 10 | 11 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/4-if_9_say_hi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display "Best School" and print "Hi" at 9th counter 3 | 4 | counter=0 5 | while [ $counter -lt 10 ] 6 | do 7 | if [ $counter -eq 9 ] 8 | then 9 | echo "Hi" 10 | fi 11 | echo "Best School" 12 | ((counter++)) 13 | done 14 | 15 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/5-4_bad_luck_8_is_your_chance: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display "Best School", print "bad luck" when counter=4 and "good luck" 0n 8. 3 | 4 | counter=1 5 | while [ $counter -le 10 ] 6 | do 7 | if [ $counter -eq 4 ] 8 | then 9 | echo "bad luck" 10 | elif [ $counter -eq 8 ] 11 | then 12 | echo "good luck" 13 | else 14 | echo "Best School" 15 | fi 16 | ((counter++)) 17 | done 18 | 19 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/6-superstitious_numbers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #Creating a script that uses case statements after 4,9,17 3 | 4 | counter=1 5 | while [ $counter -le 20 ] 6 | do 7 | echo "$counter" 8 | case $counter in 9 | 4) echo "bad luck from China";; 10 | 9) echo "bad luck from Japan";; 11 | 17) echo "bad luck from Italy";; 12 | esac 13 | ((counter++)) 14 | done 15 | 16 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/7-clock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # display the time: fist minutes for 59 then houre for 12 times. 3 | 4 | hour_count=0 5 | while [ $hour_count -le 12 ] 6 | do 7 | echo "Hour: $hour_count" 8 | minute_count=1 9 | while [ $minute_count -lt 60 ] 10 | do 11 | echo "$minute_count" 12 | ((minute_count++)) 13 | done 14 | ((hour_count++)) 15 | done 16 | 17 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/8-for_ls: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #Creating a script that lists files from existin file 3 | 4 | files="$(ls)" 5 | for file in $files; 6 | do 7 | echo "$file" | cut -f 2- -d '-' 8 | done 9 | 10 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/9-to_file_or_not_to_file: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # give us info about the school file in the curunt directory. 3 | 4 | file="school" 5 | if [ -e $file ] 6 | then 7 | echo "$file file exists" 8 | 9 | if [ -s $file ] 10 | then 11 | echo "$file file is not empty" 12 | else 13 | echo "$file file is empty" 14 | fi 15 | 16 | if [ -f $file ] 17 | then 18 | echo "$file is a regular file" 19 | fi 20 | else 21 | echo "$file file does not exist" 22 | fi 23 | 24 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/README.md: -------------------------------------------------------------------------------- 1 | # 0x04. Loops, conditions and parsing 2 | 3 | ## Background Context 4 | 5 | ... 6 | 7 | ## Resources 8 | 9 | Read or watch: 10 | 11 | - [Loops sample](RESOURCE_LINK_1) 12 | - [Variable assignment and arithmetic](RESOURCE_LINK_2) 13 | - [Comparison operators](RESOURCE_LINK_3) 14 | - [File test operators](RESOURCE_LINK_4) 15 | - [Make your scripts portable](RESOURCE_LINK_5) 16 | 17 | man or help: 18 | 19 | - env 20 | - cut 21 | - for 22 | - while 23 | - until 24 | - if 25 | 26 | ## Learning Objectives 27 | 28 | At the end of this project, you are expected to be able to explain to anyone, without the help of Google: 29 | 30 | ### General 31 | 32 | - How to create SSH keys 33 | - What is the advantage of using `#!/usr/bin/env bash` over `#!/bin/bash` 34 | - How to use while, until, and for loops 35 | - How to use if, else, elif, and case condition statements 36 | - How to use the cut command 37 | - What are files and other comparison operators, and how to use them 38 | 39 | ## Requirements 40 | 41 | ### General 42 | 43 | - Allowed editors: vi, vim, emacs 44 | - All your files will be interpreted on Ubuntu 20.04 LTS 45 | - All your files should end with a new line 46 | - A README.md file, at the root of the folder of the project, is mandatory 47 | - All your Bash script files must be executable 48 | - You are not allowed to use awk 49 | - Your Bash script must pass Shellcheck (version 0.7.0) without any error 50 | - The first line of all your Bash scripts should be exactly `#!/usr/bin/env bash` 51 | - The second line of all your Bash scripts should be a comment explaining what is the script doing 52 | 53 | ## Copyright - Plagiarism 54 | 55 | You are tasked to come up with solutions for the tasks below yourself to meet with the above learning objectives. You will not be able to meet the objectives of this or any following project by copying and pasting someone else’s work. You are not allowed to publish any content of this project. Any form of plagiarism is strictly forbidden and will result in removal from the program. 56 | 57 | ## More Info 58 | 59 | ### Shellcheck 60 | 61 | Shellcheck is a tool that will help you write proper Bash scripts. It will make recommendations on your syntax and semantics and provide advice on edge cases that you might not have thought about. Shellcheck is your friend! All your Bash scripts must pass Shellcheck without any error or you will not get any points on the task. 62 | 63 | Shellcheck is available on the school’s computers. If you want to use it on your own computer, [here is how to install it](RESOURCE_LINK_SHELLCHECK_INSTALLATION). 64 | 65 | Examples: 66 | 67 | Not passing Shellcheck: 68 | ```bash 69 | $ shellcheck my_script 70 | ... 71 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/.102-zombie.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x05-processes_and_signals/.102-zombie.c.swp -------------------------------------------------------------------------------- /0x05-processes_and_signals/0-what-is-my-pid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays Bash script that displays its own PID. 3 | 4 | echo $$ 5 | 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/1-list_your_processes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Display in a user-oriented format. 3 | # Must show all processes, for all users. 4 | # including those which might not have a TTY. 5 | 6 | ps -auxf 7 | 8 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/100-process_and_pid_file: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Creates the file /var/run/myscript.pid containing its PID 3 | # Displays To infinity and beyond indefinitely 4 | # Displays I hate the kill command when receiving a SIGTERM signal 5 | # Displays Y U no love me?! when receiving a SIGINT signal 6 | # Deletes the file /var/run/myscript.pid 7 | 8 | terminator() { 9 | rm /var/run/holbertonscript.pid 10 | exit 11 | } 12 | 13 | echo "$$" > /var/run/holbertonscript.pid 14 | 15 | while true 16 | do 17 | echo "To infinity and beyond" 18 | sleep 2 19 | trap 'echo "Y U no love me?!"' SIGINT 20 | trap 'echo "I hate the kill command" && terminator' SIGTERM 21 | trap 'terminator' SIGQUIT 22 | done 23 | 24 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/101-manage_my_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Write a manage_my_process Bash script that: 3 | # When passing the argument start: 4 | # Starts manage_my_process 5 | # Creates a file containing its PID in /var/run/my_process.pid 6 | # Displays manage_my_process started 7 | # When passing the argument stop: 8 | # Stops manage_my_process 9 | # Deletes the file /var/run/my_process.pid 10 | # Displays manage_my_process stopped 11 | # When passing the argument restart 12 | # Stops manage_my_process 13 | # Deletes the file /var/run/my_process.pid 14 | # Starts manage_my_process 15 | # Creates a file containing its PID in /var/run/my_process.pid 16 | # Displays manage_my_process restarted 17 | # Displays Usage: manage_my_process {start|stop|restart} 18 | # if any other argument or no argument is passed 19 | 20 | if [ "$1" == "start" ] 21 | then 22 | ./manage_my_process & 23 | echo $$ > /var/run/my_process.pid 24 | echo "manage_my_process started" 25 | 26 | elif [ "$1" == "stop" ] 27 | then 28 | kill "$(pgrep -f /manage_my_process)" 29 | rm /var/run/my_process.pid 30 | echo "manage_my_process stopped" 31 | 32 | elif [ "$1" == "restart" ] 33 | then 34 | kill "$(pgrep -f /manage_my_process)" 35 | rm /var/run/my_process.pid 36 | ./manage_my_process & 37 | echo $$ > /var/run/my_process.pid 38 | echo "manage_my_process restarted" 39 | 40 | else 41 | echo "Usage: manage_my_process {start|stop|restart}" 42 | fi 43 | 44 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/102-zombie.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /** 8 | * infinite_while_loop - Run infinite while loop. 9 | * Return: Always 0. 10 | */ 11 | int infinite_while_loop(void) 12 | { 13 | while (1) 14 | { 15 | sleep(1); 16 | } 17 | return (0); 18 | } 19 | 20 | /** 21 | * main - Creates the 5 zombie processes. 22 | * Return: Always 0. 23 | */ 24 | int main(void) 25 | { 26 | pid_t pid; 27 | char counter = 0; 28 | 29 | while (counter < 5) 30 | { 31 | pid = fork(); 32 | if (pid > 0) 33 | { 34 | printf("Zombie process created, PID: %d\n", pid); 35 | sleep(1); 36 | counter++; 37 | } 38 | else 39 | exit(0); 40 | } 41 | 42 | infinite_while_loop(); 43 | 44 | return (EXIT_SUCCESS); 45 | } 46 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/2-show_your_bash_pid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays a list of current running processes with the bash keyword. 3 | # The third line of your script must be # shellcheck disable=SC2009 4 | 5 | ps -aux | grep bash 6 | 7 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/3-show_your_bash_pid_made_easy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # displays the PID, along with the process name 3 | # of processes whose name contain the word bash. 4 | 5 | pgrep bash -l 6 | 7 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/4-to_infinity_and_beyond: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays To infinity and beyond indefinitely. 3 | # In between each iteration of the loop, add a sleep 2. 4 | 5 | while true 6 | do 7 | echo "To infinity and beyond" 8 | sleep 2 9 | done 10 | 11 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/5-dont_stop_me_now: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Write a Bash script that stops 4-to_infinity_and_beyond process. 3 | 4 | kill "$(pgrep -f 4-to_infinity_and_beyond)" 5 | 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/6-stop_me_if_you_can: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Write a Bash script that stops 4-to_infinity_and_beyond process. 3 | 4 | pkill -f 4-to_infinity_and_beyond 5 | 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/7-highlander: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # With a sleep 2 in between each iteration. 3 | # Displays I am invincible!!! when receiving a SIGTERM signal. 4 | 5 | while true 6 | do 7 | echo "To infinity and beyond" 8 | sleep 2 9 | trap 'echo "I am invincible"' SIGTERM 10 | done 11 | 12 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/8-beheaded_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Write a Bash script that kills the process 7-highlander. 3 | 4 | pkill -f -SIGKILL 7-highlander 5 | 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/README.md: -------------------------------------------------------------------------------- 1 | # 0x05. Processes and signals 2 | 3 | ## Resources 4 | 5 | Read or watch: 6 | 7 | - [Linux PID](RESOURCE_LINK_1) 8 | - [Linux process](RESOURCE_LINK_2) 9 | - [Linux signal](RESOURCE_LINK_3) 10 | - [Process management in Linux](RESOURCE_LINK_4) 11 | 12 | man or help: 13 | 14 | - ps 15 | - pgrep 16 | - pkill 17 | - kill 18 | - exit 19 | - trap 20 | 21 | ## Learning Objectives 22 | 23 | At the end of this project, you are expected to be able to explain to anyone, without the help of Google: 24 | 25 | ### General 26 | 27 | - What is a PID 28 | - What is a process 29 | - How to find a process’ PID 30 | - How to kill a process 31 | - What is a signal 32 | - What are the 2 signals that cannot be ignored 33 | 34 | ## Copyright - Plagiarism 35 | 36 | You are tasked to come up with solutions for the tasks below yourself to meet with the above learning objectives. You will not be able to meet the objectives of this or any following project by copying and pasting someone else’s work. You are not allowed to publish any content of this project. Any form of plagiarism is strictly forbidden and will result in removal from the program. 37 | 38 | ## Requirements 39 | 40 | ### General 41 | 42 | - Allowed editors: vi, vim, emacs 43 | - All your files will be interpreted on Ubuntu 20.04 LTS 44 | - All your files should end with a new line 45 | - A README.md file, at the root of the folder of the project, is mandatory 46 | - All your Bash script files must be executable 47 | - Your Bash script must pass Shellcheck (version 0.7.0 via apt-get) without any error 48 | - The first line of all your Bash scripts should be exactly `#!/usr/bin/env bash` 49 | - The second line of all your Bash scripts should be a comment explaining what is the script doing 50 | 51 | ## More Info 52 | 53 | For those who want to know more and learn about all signals, check out [this article](RESOURCE_LINK_SIGNALS_ARTICLE). 54 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/manage_my_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Indefinitely writes "I am alive" to the file /tmp/my_process. 3 | 4 | while true 5 | do 6 | echo "I am alive!" >> /tmp/my_process 7 | sleep 2 8 | done 9 | 10 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/zombie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x05-processes_and_signals/zombie -------------------------------------------------------------------------------- /0x06-regular_expressions/0-simply_match_school.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/School/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/1-repetition_token_0.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt{2,5}n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/100-textme.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/\[from:(.*?)\] \[to:(.*?)\] \[flags:(.*?)\]/).join(",") 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/2-repetition_token_1.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hb?t?n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/3-repetition_token_2.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt+n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/4-repetition_token_3.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt*n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/5-beginning_and_end.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/^h.n$/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/6-phone_number.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/^\d{10,10}$/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/7-OMG_WHY_ARE_YOU_SHOUTING.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/[A-Z]*/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/README.md: -------------------------------------------------------------------------------- 1 | # 0x06. Regular Expression 2 | 3 | ## Description 4 | 5 | This project involves building regular expressions using the Oniguruma library in Ruby. The provided Ruby code in `example.rb` demonstrates the use of regular expressions to extract specific patterns from input strings. 6 | 7 | ## Usage 8 | 9 | To use the provided example: 10 | 11 | ```bash 12 | ./example.rb 127.0.0.2 13 | # Output: 127.0.0.2 14 | 15 | ./example.rb 127.0.0.1 16 | # Output: 127.0.0.1 17 | 18 | ./example.rb 127.0.0.a 19 | # No output as it doesn't match the expected pattern 20 | -------------------------------------------------------------------------------- /0x07-networking_basics/0-OSI_model: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | -------------------------------------------------------------------------------- /0x07-networking_basics/1-types_of_network: -------------------------------------------------------------------------------- 1 | 3 2 | 2 3 | 1 4 | -------------------------------------------------------------------------------- /0x07-networking_basics/2-MAC_and_IP_address: -------------------------------------------------------------------------------- 1 | 2 2 | 1 3 | -------------------------------------------------------------------------------- /0x07-networking_basics/3-UDP_and_TCP: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 1 4 | -------------------------------------------------------------------------------- /0x07-networking_basics/4-TCP_and_UDP_ports: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays listening ports. From the listening sockets. 3 | # the PID and name of the program to each socket belongs. 4 | 5 | netstat -l --program 6 | 7 | -------------------------------------------------------------------------------- /0x07-networking_basics/5-is_the_host_on_the_network: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Pings an IP address as an argument 5 times and reverse it. 3 | 4 | if [ $# -eq 0 ] 5 | then 6 | echo "Usage: 5-is_the_host_on_the_network {IP_ADDRESS}" 7 | else 8 | ping -c 5 "$1" 9 | fi 10 | -------------------------------------------------------------------------------- /0x07-networking_basics/README.md: -------------------------------------------------------------------------------- 1 | # 0x07. Networking basics #0 2 | 3 | ## Resources 4 | 5 | Read or watch: 6 | - [OSI model](link-to-osi-model) 7 | - [Different types of network](link-to-different-types-of-network) 8 | - [LAN network](link-to-lan-network) 9 | - [WAN network](link-to-wan-network) 10 | - [Internet](link-to-internet) 11 | - [MAC address](link-to-mac-address) 12 | - [What is an IP address](link-to-ip-address) 13 | - [Private and public address](link-to-private-public-address) 14 | - [IPv4 and IPv6](link-to-ipv4-ipv6) 15 | - [Localhost](link-to-localhost) 16 | - [TCP and UDP](link-to-tcp-udp) 17 | - [TCP/UDP ports List](link-to-tcp-udp-ports-list) 18 | - [What is ping /ICMP](link-to-ping-icmp) 19 | - [Positional parameters](link-to-positional-parameters) 20 | - `man` or `help`: 21 | - [netstat](link-to-netstat) 22 | - [ping](link-to-ping) 23 | 24 | ## Learning Objectives 25 | 26 | At the end of this project, you are expected to be able to explain the following topics without the help of Google: 27 | 28 | - **OSI Model** 29 | - What it is 30 | - How many layers it has 31 | - How it is organized 32 | 33 | - **LAN (Local Area Network)** 34 | - Typical usage 35 | - Typical geographical size 36 | 37 | - **WAN (Wide Area Network)** 38 | - Typical usage 39 | - Typical geographical size 40 | 41 | - **Internet** 42 | - Definition and purpose 43 | 44 | - **IP Address** 45 | - What is an IP address 46 | - Two types of IP addresses 47 | 48 | - **Localhost** 49 | - Definition and usage 50 | 51 | - **Subnet** 52 | - What is a subnet 53 | 54 | - **IPv6** 55 | - Why IPv6 was created 56 | 57 | - **TCP/UDP** 58 | - Two mainly used data transfer protocols for IP (transfer level on the OSI schema) 59 | - Main difference between TCP and UDP 60 | 61 | - **Port** 62 | - Definition 63 | - Memorize SSH, HTTP, and HTTPS port numbers 64 | 65 | - **Checking Network Connection** 66 | - Tool/protocol often used to check if a device is connected to a network 67 | 68 | ## Copyright - Plagiarism 69 | 70 | You are responsible for creating your solutions to the tasks to meet the learning objectives. Avoid plagiarism, and refrain from publishing any content related to this project. 71 | 72 | ## Requirements 73 | 74 | - Allowed editors: vi, vim, emacs 75 | - All Bash script files interpreted on Ubuntu 20.04 LTS 76 | - All files should end with a new line 77 | - `README.md` file at the root is mandatory 78 | - All Bash script files must be executable 79 | - Bash scripts must pass shellcheck without any error 80 | - The first line of all Bash scripts should be `#!/usr/bin/env bash` 81 | - The second line of all Bash scripts should be a comment explaining what the script is doing 82 | 83 | ### Example for Multiple Choice Question 84 | 85 | For multiple-choice question type tasks, just type the number of the correct answer in your answer file, add a new line for every new answer. 86 | 87 | ```bash 88 | # Example answer file 89 | 3 90 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/.0-change_your_home_IP.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x08-networking_basics_2/.0-change_your_home_IP.swp -------------------------------------------------------------------------------- /0x08-networking_basics_2/0-change_your_home_IP: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Updates hostfile and change localhost to 127.0.0.2 and facebook.com to 8.8.8.8 3 | 4 | cp /etc/hosts ~/hosts.new 5 | sed -i 's/127.0.0.1/127.0.0.2/' ~/hosts.new 6 | sed -i '2i8.8.8.8 facebook.com' ~/hosts.new 7 | cp -f ~/hosts.new /etc/hosts 8 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/1-show_attached_IPs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash script that displays all active IPv4 on the machine executed on. 3 | 4 | ifconfig | grep -Eo "inet (addr:)?([0-9]*\.){3}[0-9]*" | cut -b 11- 5 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/100-port_listening_on_localhost: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Write a Bash script that listens on port 98 on localhost. 3 | # Connecting to localhost on port 98 using telnet and typing some text. 4 | 5 | nc -l 98 6 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/README.md: -------------------------------------------------------------------------------- 1 | # 0x08. Networking basics #1 2 | 3 | ## Resources 4 | 5 | Read or watch: 6 | - [What is localhost](link-to-localhost) 7 | - [What is 0.0.0.0](link-to-0.0.0.0) 8 | - [What is the hosts file](link-to-hosts-file) 9 | - [Netcat examples](link-to-netcat-examples) 10 | - `man` or `help`: 11 | - [ifconfig](link-to-ifconfig) 12 | - [telnet](link-to-telnet) 13 | - [nc](link-to-nc) 14 | - [cut](link-to-cut) 15 | 16 | ## Learning Objectives 17 | 18 | At the end of this project, you are expected to be able to explain the following topics without the help of Google: 19 | 20 | ### General 21 | 22 | - What is localhost/127.0.0.1 23 | - What is 0.0.0.0 24 | - What is /etc/hosts 25 | - How to display your machine’s active network interfaces 26 | 27 | ## Copyright - Plagiarism 28 | 29 | You are responsible for creating your solutions to the tasks to meet the learning objectives. Avoid plagiarism, and refrain from publishing any content related to this project. 30 | 31 | ## Requirements 32 | 33 | - Allowed editors: vi, vim, emacs 34 | - All files will be interpreted on Ubuntu 20.04 LTS 35 | - All files should end with a new line 36 | - `README.md` file at the root is mandatory 37 | - All Bash script files must be executable 38 | - Bash scripts must pass Shellcheck (version 0.7.0 via apt-get) without any errors 39 | - The first line of all Bash scripts should be `#!/usr/bin/env bash` 40 | - The second line of all Bash scripts should be a comment explaining what is the script doing 41 | 42 | ## Tasks 43 | 44 | ### 0. Change your home IP 45 | 46 | Write a Bash script that configures an Ubuntu server with the below requirements: 47 | 48 | Requirements: 49 | - localhost resolves to 127.0.0.2 50 | - facebook.com resolves to 8.8.8.8. 51 | 52 | Example: 53 | 54 | ```bash 55 | sylvain@ubuntu$ ping localhost 56 | PING localhost (127.0.0.1) 56(84) bytes of data. 57 | # Output truncated for brevity 58 | sylvain@ubuntu$ 59 | sylvain@ubuntu$ ping facebook.com 60 | PING facebook.com (157.240.11.35) 56(84) bytes of data. 61 | # Output truncated for brevity 62 | sylvain@ubuntu$ 63 | sylvain@ubuntu$ sudo ./0-change_your_home_IP 64 | sylvain@ubuntu$ 65 | sylvain@ubuntu$ ping localhost 66 | PING localhost (127.0.0.2) 56(84) bytes of data. 67 | # Output truncated for brevity 68 | sylvain@ubuntu$ 69 | sylvain@ubuntu$ ping facebook.com 70 | PING facebook.com (8.8.8.8) 56(84) bytes of data. 71 | # Output truncated for brevity 72 | -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/0-simple_web_stack: -------------------------------------------------------------------------------- 1 | https://imgur.com/i2lrkUi 2 | -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/1-distributed_web_infrastructure: -------------------------------------------------------------------------------- 1 | https://imgur.com/GmUdUK0 2 | -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/2-secured_and_monitored_web_infrastructure: -------------------------------------------------------------------------------- 1 | https://imgur.com/3ffVKcJ 2 | -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/3-scale_up: -------------------------------------------------------------------------------- 1 | https://imgur.com/QbG7WKU 2 | -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/README.md: -------------------------------------------------------------------------------- 1 | # Web Infrastructure Design 2 | 3 | ## Description 4 | 5 | This project focuses on understanding and designing the web infrastructure. The tasks involve whiteboarding diagrams that cover the web stack built with sysadmin/devops track projects. Each component's functionality and the concept of system redundancy are explained. Acronyms such as LAMP, SPOF, and QPS are familiarized. 6 | 7 | ## Learning Objectives 8 | 9 | By the end of this project, you should be able to: 10 | 11 | - Draw a diagram covering the web stack built with sysadmin/devops track projects. 12 | - Explain the functionality of each component in the web stack. 13 | - Understand and explain the concept of system redundancy. 14 | - Familiarize yourself with acronyms such as LAMP, SPOF, and QPS. 15 | 16 | ## Project Structure 17 | - ├── 0-simple_web_stack 18 | - │ ├── 0-simple_web_stack.png 19 | - │ └── README.md 20 | - ├── 1-distributed_web_infrastructure 21 | - │ ├── 1-distributed_web_infrastructure.png 22 | - │ └── README.md 23 | - ├── 2-secured_and_monitored_web_infrastructure 24 | - │ ├── 2-secured_and_monitored_web_infrastructure.png 25 | - │ └── README.md 26 | - ├── 3-scale_up 27 | - │ ├── 3-scale_up.png 28 | - │ └── README.md 29 | - └── README.md 30 | 31 | 32 | ## Tasks 33 | 34 | ### Task 0: Simple Web Stack 35 | 36 | - Whiteboard a diagram covering the simple web stack. 37 | - Include components like the web server, application server, database server, and DNS server. 38 | 39 | ### Task 1: Distributed Web Infrastructure 40 | 41 | - Whiteboard a diagram covering a distributed web infrastructure. 42 | - Include load balancers, web servers, application servers, and database servers. 43 | 44 | ### Task 2: Secured and Monitored Web Infrastructure 45 | 46 | - Whiteboard a diagram covering a secured and monitored web infrastructure. 47 | - Include firewalls, monitoring tools, HTTPS, and a database replica. 48 | 49 | ### Task 3: Scale Up 50 | 51 | - Whiteboard a diagram covering a web infrastructure designed for scalability. 52 | - Include multiple servers, load balancers, and a database cluster. 53 | 54 | ## How to Submit 55 | 56 | - Take a screenshot of each whiteboarded diagram. 57 | - Upload the screenshots to an image hosting service. 58 | - Insert the links of the screenshots into the corresponding README files. 59 | - Push your answers to GitHub and insert the GitHub file link into the URL box. 60 | 61 | ## Author 62 | 63 | [Aman Brhane] 64 | 65 | ## License 66 | 67 | This project is licensed under the [MIT License](LICENSE). 68 | -------------------------------------------------------------------------------- /0x0A-configuration_management/0-create_a_file.pp: -------------------------------------------------------------------------------- 1 | # create a file in /tmp 2 | 3 | file { '/tmp/school': 4 | ensure => 'present', 5 | path => '/tmp/school', 6 | mode => '0744', 7 | owner => 'www-data', 8 | group => 'www-data', 9 | content => 'I love Puppet' 10 | } 11 | -------------------------------------------------------------------------------- /0x0A-configuration_management/1-install_a_package.pp: -------------------------------------------------------------------------------- 1 | # install flask from pip3 2 | 3 | package { 'flask': 4 | ensure => '2.1.0', 5 | provider => 'pip3' 6 | } 7 | -------------------------------------------------------------------------------- /0x0A-configuration_management/2-execute_a_command.pp: -------------------------------------------------------------------------------- 1 | # Using Puppet, kills a process named killmenow 2 | 3 | exec { 'pkill': 4 | path => '/usr/bin/', 5 | command => 'pkill killmenow' 6 | } 7 | -------------------------------------------------------------------------------- /0x0A-configuration_management/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0A-configuration_management -------------------------------------------------------------------------------- /0x0A-configuration_management/killmenow: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while [[ true ]] 3 | do 4 | sleep 2 5 | done 6 | -------------------------------------------------------------------------------- /0x0B-ssh/.2-ssh_config.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x0B-ssh/.2-ssh_config.swp -------------------------------------------------------------------------------- /0x0B-ssh/.web-01.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x0B-ssh/.web-01.swo -------------------------------------------------------------------------------- /0x0B-ssh/.web-01.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x0B-ssh/.web-01.swp -------------------------------------------------------------------------------- /0x0B-ssh/0-use_a_private_key: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash script that uses ssh to connect to my server using the 3 | # private key ~/.ssh/school with the user ubuntu 4 | ssh ubuntu@ -i ~/.ssh/school 5 | -------------------------------------------------------------------------------- /0x0B-ssh/1-create_ssh_key_pair: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash script that creates a RSA key pair 3 | # Name of the created private key must be school 4 | # Number of bits in the created key to be created 4096 5 | # The created key must be protected by the passphrase betty 6 | 7 | ssh-keygen -t rsa -b 4096 -f school -P betty 8 | 9 | -------------------------------------------------------------------------------- /0x0B-ssh/100-puppet_ssh_config.pp: -------------------------------------------------------------------------------- 1 | # set up your client SSH configuration file so that you can 2 | # connect to a server without typing a password 3 | 4 | exec { 'echo': 5 | path => 'usr/bin:/bin', 6 | command => 'echo " IdentityFile ~/.ssh/school\n PasswordAuthentication no" >> /etc/ssh/ssh_config', 7 | returns => [0,1], 8 | } 9 | -------------------------------------------------------------------------------- /0x0B-ssh/2-ssh_config: -------------------------------------------------------------------------------- 1 | Include /etc/ssh/ssh_config.d/*.conf 2 | 3 | Host * 4 | # ForwardAgent no 5 | # ForwardX11 no 6 | # ForwardX11Trusted yes 7 | PasswordAuthentication no 8 | # HostbasedAuthentication no 9 | # GSSAPIAuthentication no 10 | # GSSAPIDelegateCredentials no 11 | # GSSAPIKeyExchange no 12 | # GSSAPITrustDNS no 13 | # BatchMode no 14 | # CheckHostIP yes 15 | # AddressFamily any 16 | # ConnectTimeout 0 17 | # StrictHostKeyChecking ask 18 | IdentityFile ~/.ssh/school 19 | # IdentityFile ~/.ssh/id_rsa 20 | # IdentityFile ~/.ssh/id_dsa 21 | # IdentityFile ~/.ssh/id_ecdsa 22 | # IdentityFile ~/.ssh/id_ed25519 23 | # Port 22 24 | # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc 25 | # MACs hmac-md5,hmac-sha1,umac-64@openssh.com 26 | # EscapeChar ~ 27 | # Tunnel no 28 | # TunnelDevice any:any 29 | # PermitLocalCommand no 30 | # VisualHostKey no 31 | # ProxyCommand ssh -q -W %h:%p gateway.example.com 32 | # RekeyLimit 1G 1h 33 | SendEnv LANG LC_* 34 | HashKnownHosts yes 35 | GSSAPIAuthentication yes 36 | 37 | -------------------------------------------------------------------------------- /0x0B-ssh/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0B-ssh -------------------------------------------------------------------------------- /0x0B-ssh/web-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@34.207.211.122 10 | -------------------------------------------------------------------------------- /0x0C-web_server/.2-setup_a_domain_name.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x0C-web_server/.2-setup_a_domain_name.swp -------------------------------------------------------------------------------- /0x0C-web_server/0-transfer_file: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Transfers a file from our client to a server; accepts 4 parameters 3 | # Before running this script, we will run this to list server's existing content 4 | # ssh ubuntu@35.229.54.225 -i ~/.ssh/school 'ls ~/' 5 | # touch newfile.html 6 | # After running script, we will run this to check new content is transferred to server 7 | # ssh ubuntu@35.229.54.225 -i ~/.ssh/school 'ls ~/' 8 | 9 | if [ $# -lt 3 ]; then 10 | echo "Usage: 0-transfer_file PATH_TO_FILE IP USERNAME PATH_TO_SSH_KEY" 11 | else 12 | scp -o "StrictHostKeyChecking=no" -i "$4" "$1" "$3@$2":~/ 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /0x0C-web_server/1-install_nginx_web_server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Installs nginx web server on a new ubuntu server 3 | 4 | sudo apt update 5 | sudo apt install -y nginx 6 | sudo ufw allow 'Nginx HTTP' 7 | # echo "Hello World!" | sudo tee /var/www/html/index.html 8 | # OR 9 | echo "Hello World!" | tee /var/www/html/index.nginx-debian.html 10 | sudo service nginx restart 11 | -------------------------------------------------------------------------------- /0x0C-web_server/2-setup_a_domain_name: -------------------------------------------------------------------------------- 1 | ambes.tech 2 | -------------------------------------------------------------------------------- /0x0C-web_server/3-redirection: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Script Configure your Nginx server so that /redirect_me is redirecting to another page. 3 | 4 | sudo apt-get -y update 5 | sudo apt-get -y upgrade 6 | sudo apt-get -y install nginx 7 | sudo service nginx start 8 | sudo sh -c 'echo "Hello World!" > /var/www/html/index.html' 9 | sudo rm /var/www/html/index.nginx-debian.html 10 | sudo sed -i '/listen \[::\]:80 default_server;/a rewrite ^/redirect_me/(.*)$ https://www.youtube.com/watch?v=QH2-TGUlwu4 permanent;' /etc/nginx/sites-available/default 11 | sudo service nginx restart 12 | 13 | -------------------------------------------------------------------------------- /0x0C-web_server/4-not_found_page_404: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Configure Nginx server so that /redirect_me is redirecting to another page 3 | # redirection must be a “301 Moved Permanently” 4 | # Include a custom 404 page that contains a string 5 | # By: Imanol Asolo 6 | 7 | ADD301_REDIRECT="\\\trewrite ^/redirect_me https://www.youtube.com/watch?v=QH2-TGUlwu4 permanent;" 8 | ADD404_NOTFOUND="\n\\terror_page 404 /404.html;\n\tlocation = /var/www/html/404.html {\n\t\tinternal;\n\t}" 9 | PATTERN="#error_page 404 /404.html;" 10 | 11 | 12 | sudo apt-get update 13 | sudo apt-get install -y nginx 14 | sudo chown -R ubuntu /var/www 15 | echo "Hello World!" > /var/www/html/index.nginx-debian.html 16 | sudo sed -i "30i $ADD301_REDIRECT" /etc/nginx/sites-available/default 17 | echo "Ceci n'est pas une page" > /var/www/html/404.html 18 | sudo sed -i "47i\ $PATTERN$ADD404_NOTFOUND" /etc/nginx/sites-available/default 19 | sudo service nginx restart 20 | sudo service nginx reload 21 | -------------------------------------------------------------------------------- /0x0C-web_server/7-puppet_install_nginx_web_server.pp: -------------------------------------------------------------------------------- 1 | # To install & configure nginx on a server using Puppet 2 | 3 | $config = "server { 4 | listen 80 default_server; 5 | listen [::]:80 default_server; 6 | root /var/www/html; 7 | index index.html; 8 | location /redirect_me { 9 | return 301 https://www.youtube.com/watch?v=QH2-TGUlwu4; 10 | } 11 | }" 12 | 13 | package { 'nginx': # Installs an Nginx server 14 | ensure => 'installed', 15 | } 16 | 17 | file { 'index.html': 18 | ensure => 'present', 19 | path => '/var/www/html/index.html', 20 | content => 'Hello World!', 21 | mode => '0644' 22 | } 23 | 24 | file { 'server_config': 25 | ensure => 'present', 26 | path => '/etc/nginx/sites-available/default', 27 | content => $config 28 | } 29 | 30 | exec { 'service nginx restart': 31 | path => ['/usr/sbin', '/usr/bin'] 32 | } 33 | 34 | # OR 35 | # exec {'install': 36 | # provider => shell, 37 | # command => 'sudo apt-get -y update ; sudo apt-get -y install nginx ; echo "Hello World!" | sudo tee /var/www/html/index.nginx-debian.html ; sudo sed -i "s/server_name _;/server_name _;\n\trewrite ^\/redirect_me https:\/\/github.com\/Dikachis permanent;/" /etc/nginx/sites-available/default ; sudo service nginx start', 38 | # } 39 | -------------------------------------------------------------------------------- /0x0C-web_server/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0C-web_server -------------------------------------------------------------------------------- /0x0C-web_server/web-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agent") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@52.3.240.118 10 | -------------------------------------------------------------------------------- /0x0D-web_stack_debugging_0/0-give_me_a_page: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # fixes an apache server in a container 3 | 4 | service apache2 start 5 | -------------------------------------------------------------------------------- /0x0D-web_stack_debugging_0/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0D-web_stack_debugging_0 -------------------------------------------------------------------------------- /0x0E-web_stack_debugging_1/0-nginx_likes_port_80: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Script that sets the port 80 3 | # Requirement: Nginx must be running, and listening on port 80 of all the server’s active IPv4 IPs 4 | # Bug: sudo nginx status returns 'not running'; netstat -lpn does not show port 80 5 | # Solution: https://stackoverflow.com/questions/16021481/nginx-not-listening-to-port-80 6 | sudo sed -i "s/sites-enabled/sites-available/" /etc/nginx/nginx.conf 7 | sudo service nginx restart 8 | -------------------------------------------------------------------------------- /0x0E-web_stack_debugging_1/1-debugging_made_short: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Script that sets the port 80 3 | sed -i "s/8080/80/g" /etc/nginx/sites-enabled/default 4 | service nginx restart 5 | kill -9 "$(cat /run/nginx.pid)" 6 | -------------------------------------------------------------------------------- /0x0E-web_stack_debugging_1/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0E-web_stack_debugging_1 -------------------------------------------------------------------------------- /0x0F-load_balancer/.1-install_load_balancer.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x0F-load_balancer/.1-install_load_balancer.swp -------------------------------------------------------------------------------- /0x0F-load_balancer/0-custom_http_response_header: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Configure Nginx server to give error 404 page 3 | apt-get update 4 | apt-get -y install nginx 5 | ufw allow 'Nginx HTTP' 6 | chmod -R 755 /var/www 7 | echo 'Hello World' > /var/www/html/index.html 8 | 9 | new_config=\ 10 | "server { 11 | listen 80 default_server; 12 | listen [::]:80 default_server; 13 | add_header X-Served-By $HOSTNAME; 14 | root /var/www/html; 15 | index index.html index.htm index.nginx-debian.html; 16 | server_name _; 17 | location / { 18 | try_files \$uri \$uri/ =404; 19 | } 20 | error_page 404 /404.html; 21 | location /404.html { 22 | internal; 23 | } 24 | if (\$request_filename ~ redirect_me){ 25 | rewrite ^ https://www.youtube.com/watch?v=QH2-TGUlwu4 permanent; 26 | } 27 | } 28 | " 29 | echo "Ceci n'est pas une page" > /var/www/html/404.html 30 | 31 | echo "$new_config" > /etc/nginx/sites-available/default 32 | 33 | if [ "$(pgrep nginx)" -le 0 ]; 34 | then 35 | service nginx start 36 | else 37 | service nginx restart 38 | fi; 39 | -------------------------------------------------------------------------------- /0x0F-load_balancer/1-install_load_balancer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash script that configures a new Ubuntu machine 3 | # Configure HAproxy to send traffic to web-01 & web-02 4 | # Use roundrobin algorithm for distribution 5 | 6 | apt-get -y update 7 | apt-get -y install haproxy 8 | 9 | printf %s " 10 | backend web-servers 11 | balance roundrobin 12 | option forwardfor 13 | server 190329-web-01 34.207.211.122:80 check 14 | server 190329-web-02 100.25.143.0:80 check 15 | frontend haproxy_balancer 16 | bind *:80 17 | mode http 18 | default_backend web-servers 19 | " >> /etc/haproxy/haproxy.cfg 20 | service haproxy restart 21 | -------------------------------------------------------------------------------- /0x0F-load_balancer/2-puppet_custom_http_response_header.pp: -------------------------------------------------------------------------------- 1 | # Installs a Nginx server with custome HTTP header 2 | 3 | exec {'update': 4 | provider => shell, 5 | command => 'sudo apt-get -y update', 6 | before => Exec['install Nginx'], 7 | } 8 | 9 | exec {'install Nginx': 10 | provider => shell, 11 | command => 'sudo apt-get -y install nginx', 12 | before => Exec['add_header'], 13 | } 14 | 15 | exec { 'add_header': 16 | provider => shell, 17 | environment => ["HOST=${hostname}"], 18 | command => 'sudo sed -i "s/include \/etc\/nginx\/sites-enabled\/\*;/include \/etc\/nginx\/sites-enabled\/\*;\n\tadd_header X-Served-By \"$HOST\";/" /etc/nginx/nginx.conf', 19 | before => Exec['restart Nginx'], 20 | } 21 | 22 | exec { 'restart Nginx': 23 | provider => shell, 24 | command => 'sudo service nginx restart', 25 | } 26 | 27 | -------------------------------------------------------------------------------- /0x0F-load_balancer/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x0F-load_balancer -------------------------------------------------------------------------------- /0x0F-load_balancer/lb-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@100.24.72.101 10 | -------------------------------------------------------------------------------- /0x0F-load_balancer/web-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@34.207.211.122 10 | -------------------------------------------------------------------------------- /0x0F-load_balancer/web-02: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@100.25.143.0 10 | -------------------------------------------------------------------------------- /0x10-https_ssl/.0-world_wide_web.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x10-https_ssl/.0-world_wide_web.swp -------------------------------------------------------------------------------- /0x10-https_ssl/0-world_wide_web: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Usage: ./0-world_wide_web 3 | # Display information about subdomains. 4 | 5 | domain_information () { 6 | line=$(dig "$2"."$1" | grep -A1 'ANSWER SECTION:' | tr '\t' '\n' | tail -2 | tr '\n' ' ') 7 | echo "$2 $line" | awk '{print "The subdomain " $1 " is a " $2 " record and points to " $3}' 8 | } 9 | 10 | if [ "$#" == 1 ] 11 | then 12 | domain_information "$1" "www" 13 | domain_information "$1" "lb-01" 14 | domain_information "$1" "web-01" 15 | domain_information "$1" "web-02" 16 | elif [ "$#" == 2 ] 17 | then 18 | domain_information "$1" "$2" 19 | fi 20 | -------------------------------------------------------------------------------- /0x10-https_ssl/1-haproxy_ssl_termination: -------------------------------------------------------------------------------- 1 | global 2 | log /dev/log local0 3 | log /dev/log local1 notice 4 | chroot /var/lib/haproxy 5 | stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners 6 | stats timeout 30s 7 | user haproxy 8 | group haproxy 9 | daemon 10 | 11 | # Default SSL material locations 12 | ca-base /etc/ssl/certs 13 | crt-base /etc/ssl/private 14 | 15 | # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate 16 | ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 17 | ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 18 | ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets 19 | 20 | defaults 21 | log global 22 | mode http 23 | option httplog 24 | option dontlognull 25 | timeout connect 5000 26 | timeout client 50000 27 | timeout server 50000 28 | errorfile 400 /etc/haproxy/errors/400.http 29 | errorfile 403 /etc/haproxy/errors/403.http 30 | errorfile 408 /etc/haproxy/errors/408.http 31 | errorfile 500 /etc/haproxy/errors/500.http 32 | errorfile 502 /etc/haproxy/errors/502.http 33 | errorfile 503 /etc/haproxy/errors/503.http 34 | errorfile 504 /etc/haproxy/errors/504.http 35 | 36 | frontend haproxy_balancer 37 | bind *:80 38 | mode http 39 | default_backend web-servers 40 | 41 | frontend https 42 | bind *:443 ssl crt /etc/letsencrypt/live/www.ambes.tech/fullchain.pem 43 | http-request add-header X-Forwarded-Proto https 44 | default_backend web-backend 45 | 46 | backend web-servers 47 | balance roundrobin 48 | option forwardfor 49 | server 190329-web-01 34.207.211.122:80 check 50 | server 190329-web-02 100.25.143.0:80 check 51 | 52 | backend web-backend 53 | balance roundrobin 54 | server 190329-web-01 34.207.211.122:80 check 55 | server 190329-web-02 100.25.143.0:80 check 56 | -------------------------------------------------------------------------------- /0x10-https_ssl/100-redirect_http_to_https: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Configure HAproxy to accept encrypted traffic for subdomain www.chiaracaprasi.tech 3 | 4 | global 5 | log /dev/log local0 6 | log /dev/log local1 notice 7 | chroot /var/lib/haproxy 8 | stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners 9 | stats timeout 30s 10 | user haproxy 11 | group haproxy 12 | daemon 13 | 14 | # Default SSL material locations 15 | ca-base /etc/ssl/certs 16 | crt-base /etc/ssl/private 17 | 18 | # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate 19 | ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 20 | ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 21 | ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets 22 | 23 | defaults 24 | log global 25 | mode http 26 | option httplog 27 | option dontlognull 28 | timeout connect 5000 29 | timeout client 50000 30 | timeout server 50000 31 | errorfile 400 /etc/haproxy/errors/400.http 32 | errorfile 403 /etc/haproxy/errors/403.http 33 | errorfile 408 /etc/haproxy/errors/408.http 34 | errorfile 500 /etc/haproxy/errors/500.http 35 | errorfile 502 /etc/haproxy/errors/502.http 36 | errorfile 503 /etc/haproxy/errors/503.http 37 | errorfile 504 /etc/haproxy/errors/504.http 38 | 39 | frontend haproxy_balancer 40 | bind *:80 41 | mode http 42 | default_backend web-servers 43 | 44 | frontend https 45 | bind *:443 ssl crt /etc/letsencrypt/live/www.ambes.tech/fullchain.pem 46 | http-request add-header X-Forwarded-Proto https 47 | default_backend web-backend 48 | 49 | backend web-servers 50 | balance roundrobin 51 | option forwardfor 52 | server 190329-web-01 34.207.211.122:80 check 53 | server 190329-web-02 100.25.143.0:80 check 54 | 55 | backend web-backend 56 | balance roundrobin 57 | server 190329-web-01 34.207.211.122:80 check 58 | server 190329-web-02 100.25.143.0:80 check 59 | -------------------------------------------------------------------------------- /0x10-https_ssl/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x10-https_ssl -------------------------------------------------------------------------------- /0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter/0-blog_post: -------------------------------------------------------------------------------- 1 | https://medium.com/@ambesawi77/answering-the-classic-web-infrastructure-question-alx-software-engineering-a2fcc90c748f 2 | -------------------------------------------------------------------------------- /0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter/1-what_happen_when_diagram: -------------------------------------------------------------------------------- 1 | https://drive.google.com/file/d/18SCI5NHxu1Xqbophijzv5vsrBoR3hhNA/view?usp=sharing 2 | -------------------------------------------------------------------------------- /0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter/2-contribution-to_what-happens-when_github_answer: -------------------------------------------------------------------------------- 1 | https://github.com/Ambesawi/alx-system_engineering-devops/tree/master/0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter 2 | -------------------------------------------------------------------------------- /0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x11-what_happens_when_your_type_google_com_in_your_browser_and_press_enter/README.md -------------------------------------------------------------------------------- /0x12-web_stack_debugging_2/0-iamsomeoneelse: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Runs the whoami command under the user passed as argument. 3 | sudo -u "$1" whoami 4 | -------------------------------------------------------------------------------- /0x12-web_stack_debugging_2/1-run_nginx_as_nginx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Fixes a web server to run Nginx as the nginx user listening on port 8080. 3 | sed -i "s/#user www-data/user nginx/" /etc/nginx/nginx.conf 4 | sed -i "s/80/8080/g" /etc/nginx/sites-available/default 5 | chmod 644 /etc/nginx/nginx.conf 6 | pkill apache2 7 | sudo -u nginx service nginx start 8 | -------------------------------------------------------------------------------- /0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Fixes a web server to run Nginx as the nginx user listening on port 8080. 3 | sed -i "s/#user www-data/user nginx/" /etc/nginx/nginx.conf 4 | sed -i "s/80/8080/g" /etc/nginx/sites-available/default 5 | chmod 644 /etc/nginx/nginx.conf 6 | pkill apache2 7 | sudo -u nginx service nginx start 8 | -------------------------------------------------------------------------------- /0x12-web_stack_debugging_2/README.md: -------------------------------------------------------------------------------- 1 | this ia alx project for 0x12-web_stack_debugging_2 -------------------------------------------------------------------------------- /0x14-mysql/4-mysql_configuration_primary: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, 2023, Oracle and/or its affiliates. 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License, version 2.0, 5 | # as published by the Free Software Foundation. 6 | # 7 | # This program is also distributed with certain software (including 8 | # but not limited to OpenSSL) that is licensed under separate terms, 9 | # as designated in a particular file or component or in included license 10 | # documentation. The authors of MySQL hereby grant you an additional 11 | # permission to link the program and your derivative works with the 12 | # separately licensed software that they have included with MySQL. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License, version 2.0, for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | 23 | # 24 | # The MySQL Server configuration file. 25 | # 26 | # For explanations see 27 | # http://dev.mysql.com/doc/mysql/en/server-system-variables.html 28 | 29 | [mysqld] 30 | pid-file = /var/run/mysqld/mysqld.pid 31 | socket = /var/run/mysqld/mysqld.sock 32 | datadir = /var/lib/mysql 33 | log-error = /var/log/mysql/error.log 34 | # By default we only accept connections from localhost 35 | # bind-address = 127.0.0.1 36 | # Disabling symbolic-links is recommended to prevent assorted security risks 37 | symbolic-links=0 38 | # Replication Configuration 39 | log-bin = /var/log/mysql/mysql-bin.log 40 | server-id = 1 41 | log_bin = /var/log/mysql/mysql-bin.log 42 | binlog_do_db = tyrell_corp 43 | -------------------------------------------------------------------------------- /0x14-mysql/4-mysql_configuration_replica: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, 2023, Oracle and/or its affiliates. 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License, version 2.0, 5 | # as published by the Free Software Foundation. 6 | # 7 | # This program is also distributed with certain software (including 8 | # but not limited to OpenSSL) that is licensed under separate terms, 9 | # as designated in a particular file or component or in included license 10 | # documentation. The authors of MySQL hereby grant you an additional 11 | # permission to link the program and your derivative works with the 12 | # separately licensed software that they have included with MySQL. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License, version 2.0, for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | 23 | # 24 | # The MySQL Server configuration file. 25 | # 26 | # For explanations see 27 | # http://dev.mysql.com/doc/mysql/en/server-system-variables.html 28 | 29 | [mysqld] 30 | pid-file = /var/run/mysqld/mysqld.pid 31 | socket = /var/run/mysqld/mysqld.sock 32 | datadir = /var/lib/mysql 33 | log-error = /var/log/mysql/error.log 34 | # By default we only accept connections from localhost 35 | bind-address = 127.0.0.1 36 | # Disabling symbolic-links is recommended to prevent assorted security risks 37 | symbolic-links=0 38 | # Replication Configuration 39 | log-bin = /var/log/mysql/mysql-bin.log 40 | server-id = 2 41 | log_bin = /var/log/mysql/mysql-bin.log 42 | binlog_do_db = tyrell_corp 43 | relay-log = /var/log/mysql/mysql-relay-bin.log 44 | -------------------------------------------------------------------------------- /0x14-mysql/5-mysql_backup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # generates a MySQL dump and creates a compressed archive out of it. 3 | date=$(date +'%d-%m-%y.') 4 | mysqldump --all-databases -uroot -p"$1" > backup.sql 5 | tar -cvzf "$date.tar.gz" backup.sql 6 | -------------------------------------------------------------------------------- /0x14-mysql/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x14-mysql -------------------------------------------------------------------------------- /0x14-mysql/lb-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server- lb-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@100.24.72.101 10 | -------------------------------------------------------------------------------- /0x14-mysql/web-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@34.207.211.122 10 | -------------------------------------------------------------------------------- /0x14-mysql/web-02: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server- web-02 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@3.94.213.225 10 | -------------------------------------------------------------------------------- /0x15-api/0-gather_data_from_an_API.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """Accessing a REST API for todo lists of employees""" 3 | 4 | import requests 5 | import sys 6 | 7 | 8 | if __name__ == '__main__': 9 | employeeId = sys.argv[1] 10 | baseUrl = "https://jsonplaceholder.typicode.com/users" 11 | url = baseUrl + "/" + employeeId 12 | 13 | response = requests.get(url) 14 | employeeName = response.json().get('name') 15 | 16 | todoUrl = url + "/todos" 17 | response = requests.get(todoUrl) 18 | tasks = response.json() 19 | done = 0 20 | done_tasks = [] 21 | 22 | for task in tasks: 23 | if task.get('completed'): 24 | done_tasks.append(task) 25 | done += 1 26 | 27 | print("Employee {} is done with tasks({}/{}):" 28 | .format(employeeName, done, len(tasks))) 29 | 30 | for task in done_tasks: 31 | print("\t {}".format(task.get('title'))) 32 | -------------------------------------------------------------------------------- /0x15-api/1-export_to_CSV.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """Accessing a REST API for todo lists of employees""" 3 | 4 | import requests 5 | import sys 6 | 7 | 8 | if __name__ == '__main__': 9 | employeeId = sys.argv[1] 10 | baseUrl = "https://jsonplaceholder.typicode.com/users" 11 | url = baseUrl + "/" + employeeId 12 | 13 | response = requests.get(url) 14 | username = response.json().get('username') 15 | 16 | todoUrl = url + "/todos" 17 | response = requests.get(todoUrl) 18 | tasks = response.json() 19 | 20 | with open('{}.csv'.format(employeeId), 'w') as file: 21 | for task in tasks: 22 | file.write('"{}","{}","{}","{}"\n' 23 | .format(employeeId, username, task.get('completed'), 24 | task.get('title'))) 25 | -------------------------------------------------------------------------------- /0x15-api/2-export_to_JSON.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """Accessing a REST API for todo lists of employees""" 3 | 4 | import json 5 | import requests 6 | import sys 7 | 8 | 9 | if __name__ == '__main__': 10 | employeeId = sys.argv[1] 11 | baseUrl = "https://jsonplaceholder.typicode.com/users" 12 | url = baseUrl + "/" + employeeId 13 | 14 | response = requests.get(url) 15 | username = response.json().get('username') 16 | 17 | todoUrl = url + "/todos" 18 | response = requests.get(todoUrl) 19 | tasks = response.json() 20 | 21 | dictionary = {employeeId: []} 22 | for task in tasks: 23 | dictionary[employeeId].append({ 24 | "task": task.get('title'), 25 | "completed": task.get('completed'), 26 | "username": username 27 | }) 28 | with open('{}.json'.format(employeeId), 'w') as filename: 29 | json.dump(dictionary, filename) 30 | -------------------------------------------------------------------------------- /0x15-api/3-dictionary_of_list_of_dictionaries.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """Accessing a REST API for todo lists of employees""" 3 | 4 | import json 5 | import requests 6 | import sys 7 | 8 | 9 | if __name__ == '__main__': 10 | url = "https://jsonplaceholder.typicode.com/users" 11 | 12 | response = requests.get(url) 13 | users = response.json() 14 | 15 | dictionary = {} 16 | for user in users: 17 | user_id = user.get('id') 18 | username = user.get('username') 19 | url = 'https://jsonplaceholder.typicode.com/users/{}'.format(user_id) 20 | url = url + '/todos/' 21 | response = requests.get(url) 22 | tasks = response.json() 23 | dictionary[user_id] = [] 24 | for task in tasks: 25 | dictionary[user_id].append({ 26 | "task": task.get('title'), 27 | "completed": task.get('completed'), 28 | "username": username 29 | }) 30 | with open('todo_all_employees.json', 'w') as file: 31 | json.dump(dictionary, file) 32 | -------------------------------------------------------------------------------- /0x15-api/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x15-api -------------------------------------------------------------------------------- /0x15-api/todo_all_employees.json: -------------------------------------------------------------------------------- 1 | {"1": [{"task": "delectus aut autem", "completed": false, "username": "Bret"}, {"task": "quis ut nam facilis et officia qui", "completed": false, "username": "Bret"}, {"task": "fugiat veniam minus", "completed": false, "username": "Bret"}, {"task": "et porro tempora", "completed": true, "username": "Bret"}, {"task": "laboriosam mollitia et enim quasi adipisci quia provident illum", "completed": false, "username": "Bret"}, {"task": "qui ullam ratione quibusdam voluptatem quia omnis", "completed": false, "username": "Bret"}, {"task": "illo expedita consequatur quia in", "completed": false, "username": "Bret"}, {"task": "quo adipisci enim quam ut ab", "completed": true, "username": "Bret"}, {"task": "molestiae perspiciatis ipsa", "completed": false, "username": "Bret"}, {"task": "illo est ratione doloremque quia maiores aut", "completed": true, "username": "Bret"}, {"task": "vero rerum temporibus dolor", "completed": true, "username": "Bret"}, {"task": "ipsa repellendus fugit nisi", "completed": true, "username": "Bret"}, {"task": "et doloremque nulla", "completed": false, "username": "Bret"}, {"task": "repellendus sunt dolores architecto voluptatum", "completed": true, "username": "Bret"}, {"task": "ab voluptatum amet voluptas", "completed": true, "username": "Bret"}, {"task": "accusamus eos facilis sint et aut voluptatem", "completed": true, "username": "Bret"}, {"task": "quo laboriosam deleniti aut qui", "completed": true, "username": "Bret"}, {"task": "dolorum est consequatur ea mollitia in culpa", "completed": false, "username": "Bret"}, {"task": "molestiae ipsa aut voluptatibus pariatur dolor nihil", "completed": true, "username": "Bret"}, {"task": "ullam nobis libero sapiente ad optio sint", "completed": true, "username": "Bret"}], "2": [{"task": "suscipit repellat esse quibusdam voluptatem incidunt", "completed": false, "username": "Antonette"}, {"task": "distinctio vitae autem nihil ut molestias quo", "completed": true, "username": "Antonette"}, {"task": "et itaque necessitatibus maxime molestiae qui quas velit", "completed": false, "username": "Antonette"}, {"task": "adipisci non ad dicta qui amet quaerat doloribus ea", "completed": false, "username": "Antonette"}, {"task": "voluptas quo tenetur perspiciatis explicabo natus", "completed": true, "username": "Antonette"}, {"task": "aliquam aut quasi", "completed": true, "username": "Antonette"}, {"task": "veritatis pariatur delectus", "completed": true, "username": "Antonette"}, {"task": "nesciunt totam sit blanditiis sit", "completed": false, "username": "Antonette"}, {"task": "laborum aut in quam", "completed": false, "username": "Antonette"}, {"task": "nemo perspiciatis repellat ut dolor libero commodi blanditiis omnis", "completed": true, "username": "Antonette"}, {"task": "repudiandae totam in est sint facere fuga", "completed": false, "username": "Antonette"}, {"task": "earum doloribus ea doloremque quis", "completed": false, "username": "Antonette"}, {"task": "sint sit aut vero", "completed": false, "username": "Antonette"}, {"task": "porro aut necessitatibus eaque distinctio", "completed": false, "username": "Antonette"}, {"task": "repellendus veritatis molestias dicta incidunt", "completed": true, "username": "Antonette"}, {"task": "excepturi deleniti adipisci voluptatem et neque optio illum ad", "completed": true, "username": "Antonette"}, {"task": "sunt cum tempora", "completed": false, "username": "Antonette"}, {"task": "totam quia non", "completed": false, "username": "Antonette"}, {"task": "doloremque quibusdam asperiores libero corrupti illum qui omnis", "completed": false, "username": "Antonette"}, {"task": "totam atque quo nesciunt", "completed": true, "username": "Antonette"}], "3": [{"task": "aliquid amet impedit consequatur aspernatur placeat eaque fugiat suscipit", "completed": false, "username": "Samantha"}, {"task": "rerum perferendis error quia ut eveniet", "completed": false, "username": "Samantha"}, {"task": "tempore ut sint quis recusandae", "completed": true, "username": "Samantha"}, {"task": "cum debitis quis accusamus doloremque ipsa natus sapiente omnis", "completed": true, "username": "Samantha"}, {"task": "velit soluta adipisci molestias reiciendis harum", "completed": false, "username": "Samantha"}, {"task": "vel voluptatem repellat nihil placeat corporis", "completed": false, "username": "Samantha"}, {"task": "nam qui rerum fugiat accusamus", "completed": false, "username": "Samantha"}, {"task": "sit reprehenderit omnis quia", "completed": false, "username": "Samantha"}, {"task": "ut necessitatibus aut maiores debitis officia blanditiis velit et", "completed": false, "username": "Samantha"}, {"task": "cupiditate necessitatibus ullam aut quis dolor voluptate", "completed": true, "username": "Samantha"}, {"task": "distinctio exercitationem ab doloribus", "completed": false, "username": "Samantha"}, {"task": "nesciunt dolorum quis recusandae ad pariatur ratione", "completed": false, "username": "Samantha"}, {"task": "qui labore est occaecati recusandae aliquid quam", "completed": false, "username": "Samantha"}, {"task": "quis et est ut voluptate quam dolor", "completed": true, "username": "Samantha"}, {"task": "voluptatum omnis minima qui occaecati provident nulla voluptatem ratione", "completed": true, "username": "Samantha"}, {"task": "deleniti ea temporibus enim", "completed": true, "username": "Samantha"}, {"task": "pariatur et magnam ea doloribus similique voluptatem rerum quia", "completed": false, "username": "Samantha"}, {"task": "est dicta totam qui explicabo doloribus qui dignissimos", "completed": false, "username": "Samantha"}, {"task": "perspiciatis velit id laborum placeat iusto et aliquam odio", "completed": false, "username": "Samantha"}, {"task": "et sequi qui architecto ut adipisci", "completed": true, "username": "Samantha"}], "4": [{"task": "odit optio omnis qui sunt", "completed": true, "username": "Karianne"}, {"task": "et placeat et tempore aspernatur sint numquam", "completed": false, "username": "Karianne"}, {"task": "doloremque aut dolores quidem fuga qui nulla", "completed": true, "username": "Karianne"}, {"task": "voluptas consequatur qui ut quia magnam nemo esse", "completed": false, "username": "Karianne"}, {"task": "fugiat pariatur ratione ut asperiores necessitatibus magni", "completed": false, "username": "Karianne"}, {"task": "rerum eum molestias autem voluptatum sit optio", "completed": false, "username": "Karianne"}, {"task": "quia voluptatibus voluptatem quos similique maiores repellat", "completed": false, "username": "Karianne"}, {"task": "aut id perspiciatis voluptatem iusto", "completed": false, "username": "Karianne"}, {"task": "doloribus sint dolorum ab adipisci itaque dignissimos aliquam suscipit", "completed": false, "username": "Karianne"}, {"task": "ut sequi accusantium et mollitia delectus sunt", "completed": false, "username": "Karianne"}, {"task": "aut velit saepe ullam", "completed": false, "username": "Karianne"}, {"task": "praesentium facilis facere quis harum voluptatibus voluptatem eum", "completed": false, "username": "Karianne"}, {"task": "sint amet quia totam corporis qui exercitationem commodi", "completed": true, "username": "Karianne"}, {"task": "expedita tempore nobis eveniet laborum maiores", "completed": false, "username": "Karianne"}, {"task": "occaecati adipisci est possimus totam", "completed": false, "username": "Karianne"}, {"task": "sequi dolorem sed", "completed": true, "username": "Karianne"}, {"task": "maiores aut nesciunt delectus exercitationem vel assumenda eligendi at", "completed": false, "username": "Karianne"}, {"task": "reiciendis est magnam amet nemo iste recusandae impedit quaerat", "completed": false, "username": "Karianne"}, {"task": "eum ipsa maxime ut", "completed": true, "username": "Karianne"}, {"task": "tempore molestias dolores rerum sequi voluptates ipsum consequatur", "completed": true, "username": "Karianne"}], "5": [{"task": "suscipit qui totam", "completed": true, "username": "Kamren"}, {"task": "voluptates eum voluptas et dicta", "completed": false, "username": "Kamren"}, {"task": "quidem at rerum quis ex aut sit quam", "completed": true, "username": "Kamren"}, {"task": "sunt veritatis ut voluptate", "completed": false, "username": "Kamren"}, {"task": "et quia ad iste a", "completed": true, "username": "Kamren"}, {"task": "incidunt ut saepe autem", "completed": true, "username": "Kamren"}, {"task": "laudantium quae eligendi consequatur quia et vero autem", "completed": true, "username": "Kamren"}, {"task": "vitae aut excepturi laboriosam sint aliquam et et accusantium", "completed": false, "username": "Kamren"}, {"task": "sequi ut omnis et", "completed": true, "username": "Kamren"}, {"task": "molestiae nisi accusantium tenetur dolorem et", "completed": true, "username": "Kamren"}, {"task": "nulla quis consequatur saepe qui id expedita", "completed": true, "username": "Kamren"}, {"task": "in omnis laboriosam", "completed": true, "username": "Kamren"}, {"task": "odio iure consequatur molestiae quibusdam necessitatibus quia sint", "completed": true, "username": "Kamren"}, {"task": "facilis modi saepe mollitia", "completed": false, "username": "Kamren"}, {"task": "vel nihil et molestiae iusto assumenda nemo quo ut", "completed": true, "username": "Kamren"}, {"task": "nobis suscipit ducimus enim asperiores voluptas", "completed": false, "username": "Kamren"}, {"task": "dolorum laboriosam eos qui iure aliquam", "completed": false, "username": "Kamren"}, {"task": "debitis accusantium ut quo facilis nihil quis sapiente necessitatibus", "completed": true, "username": "Kamren"}, {"task": "neque voluptates ratione", "completed": false, "username": "Kamren"}, {"task": "excepturi a et neque qui expedita vel voluptate", "completed": false, "username": "Kamren"}], "6": [{"task": "explicabo enim cumque porro aperiam occaecati minima", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "sed ab consequatur", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "non sunt delectus illo nulla tenetur enim omnis", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "excepturi non laudantium quo", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "totam quia dolorem et illum repellat voluptas optio", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "ad illo quis voluptatem temporibus", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "praesentium facilis omnis laudantium fugit ad iusto nihil nesciunt", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "a eos eaque nihil et exercitationem incidunt delectus", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "autem temporibus harum quisquam in culpa", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "aut aut ea corporis", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "magni accusantium labore et id quis provident", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "consectetur impedit quisquam qui deserunt non rerum consequuntur eius", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "quia atque aliquam sunt impedit voluptatum rerum assumenda nisi", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "cupiditate quos possimus corporis quisquam exercitationem beatae", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "sed et ea eum", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "ipsa dolores vel facilis ut", "completed": true, "username": "Leopoldo_Corkery"}, {"task": "sequi quae est et qui qui eveniet asperiores", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "quia modi consequatur vero fugiat", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "corporis ducimus ea perspiciatis iste", "completed": false, "username": "Leopoldo_Corkery"}, {"task": "dolorem laboriosam vel voluptas et aliquam quasi", "completed": false, "username": "Leopoldo_Corkery"}], "7": [{"task": "inventore aut nihil minima laudantium hic qui omnis", "completed": true, "username": "Elwyn.Skiles"}, {"task": "provident aut nobis culpa", "completed": true, "username": "Elwyn.Skiles"}, {"task": "esse et quis iste est earum aut impedit", "completed": false, "username": "Elwyn.Skiles"}, {"task": "qui consectetur id", "completed": false, "username": "Elwyn.Skiles"}, {"task": "aut quasi autem iste tempore illum possimus", "completed": false, "username": "Elwyn.Skiles"}, {"task": "ut asperiores perspiciatis veniam ipsum rerum saepe", "completed": true, "username": "Elwyn.Skiles"}, {"task": "voluptatem libero consectetur rerum ut", "completed": true, "username": "Elwyn.Skiles"}, {"task": "eius omnis est qui voluptatem autem", "completed": false, "username": "Elwyn.Skiles"}, {"task": "rerum culpa quis harum", "completed": false, "username": "Elwyn.Skiles"}, {"task": "nulla aliquid eveniet harum laborum libero alias ut unde", "completed": true, "username": "Elwyn.Skiles"}, {"task": "qui ea incidunt quis", "completed": false, "username": "Elwyn.Skiles"}, {"task": "qui molestiae voluptatibus velit iure harum quisquam", "completed": true, "username": "Elwyn.Skiles"}, {"task": "et labore eos enim rerum consequatur sunt", "completed": true, "username": "Elwyn.Skiles"}, {"task": "molestiae doloribus et laborum quod ea", "completed": false, "username": "Elwyn.Skiles"}, {"task": "facere ipsa nam eum voluptates reiciendis vero qui", "completed": false, "username": "Elwyn.Skiles"}, {"task": "asperiores illo tempora fuga sed ut quasi adipisci", "completed": false, "username": "Elwyn.Skiles"}, {"task": "qui sit non", "completed": false, "username": "Elwyn.Skiles"}, {"task": "placeat minima consequatur rem qui ut", "completed": true, "username": "Elwyn.Skiles"}, {"task": "consequatur doloribus id possimus voluptas a voluptatem", "completed": false, "username": "Elwyn.Skiles"}, {"task": "aut consectetur in blanditiis deserunt quia sed laboriosam", "completed": true, "username": "Elwyn.Skiles"}], "8": [{"task": "explicabo consectetur debitis voluptates quas quae culpa rerum non", "completed": true, "username": "Maxime_Nienow"}, {"task": "maiores accusantium architecto necessitatibus reiciendis ea aut", "completed": true, "username": "Maxime_Nienow"}, {"task": "eum non recusandae cupiditate animi", "completed": false, "username": "Maxime_Nienow"}, {"task": "ut eum exercitationem sint", "completed": false, "username": "Maxime_Nienow"}, {"task": "beatae qui ullam incidunt voluptatem non nisi aliquam", "completed": false, "username": "Maxime_Nienow"}, {"task": "molestiae suscipit ratione nihil odio libero impedit vero totam", "completed": true, "username": "Maxime_Nienow"}, {"task": "eum itaque quod reprehenderit et facilis dolor autem ut", "completed": true, "username": "Maxime_Nienow"}, {"task": "esse quas et quo quasi exercitationem", "completed": false, "username": "Maxime_Nienow"}, {"task": "animi voluptas quod perferendis est", "completed": false, "username": "Maxime_Nienow"}, {"task": "eos amet tempore laudantium fugit a", "completed": false, "username": "Maxime_Nienow"}, {"task": "accusamus adipisci dicta qui quo ea explicabo sed vero", "completed": true, "username": "Maxime_Nienow"}, {"task": "odit eligendi recusandae doloremque cumque non", "completed": false, "username": "Maxime_Nienow"}, {"task": "ea aperiam consequatur qui repellat eos", "completed": false, "username": "Maxime_Nienow"}, {"task": "rerum non ex sapiente", "completed": true, "username": "Maxime_Nienow"}, {"task": "voluptatem nobis consequatur et assumenda magnam", "completed": true, "username": "Maxime_Nienow"}, {"task": "nam quia quia nulla repellat assumenda quibusdam sit nobis", "completed": true, "username": "Maxime_Nienow"}, {"task": "dolorem veniam quisquam deserunt repellendus", "completed": true, "username": "Maxime_Nienow"}, {"task": "debitis vitae delectus et harum accusamus aut deleniti a", "completed": true, "username": "Maxime_Nienow"}, {"task": "debitis adipisci quibusdam aliquam sed dolore ea praesentium nobis", "completed": true, "username": "Maxime_Nienow"}, {"task": "et praesentium aliquam est", "completed": false, "username": "Maxime_Nienow"}], "9": [{"task": "ex hic consequuntur earum omnis alias ut occaecati culpa", "completed": true, "username": "Delphine"}, {"task": "omnis laboriosam molestias animi sunt dolore", "completed": true, "username": "Delphine"}, {"task": "natus corrupti maxime laudantium et voluptatem laboriosam odit", "completed": false, "username": "Delphine"}, {"task": "reprehenderit quos aut aut consequatur est sed", "completed": false, "username": "Delphine"}, {"task": "fugiat perferendis sed aut quidem", "completed": false, "username": "Delphine"}, {"task": "quos quo possimus suscipit minima ut", "completed": false, "username": "Delphine"}, {"task": "et quis minus quo a asperiores molestiae", "completed": false, "username": "Delphine"}, {"task": "recusandae quia qui sunt libero", "completed": false, "username": "Delphine"}, {"task": "ea odio perferendis officiis", "completed": true, "username": "Delphine"}, {"task": "quisquam aliquam quia doloribus aut", "completed": false, "username": "Delphine"}, {"task": "fugiat aut voluptatibus corrupti deleniti velit iste odio", "completed": true, "username": "Delphine"}, {"task": "et provident amet rerum consectetur et voluptatum", "completed": false, "username": "Delphine"}, {"task": "harum ad aperiam quis", "completed": false, "username": "Delphine"}, {"task": "similique aut quo", "completed": false, "username": "Delphine"}, {"task": "laudantium eius officia perferendis provident perspiciatis asperiores", "completed": true, "username": "Delphine"}, {"task": "magni soluta corrupti ut maiores rem quidem", "completed": false, "username": "Delphine"}, {"task": "et placeat temporibus voluptas est tempora quos quibusdam", "completed": false, "username": "Delphine"}, {"task": "nesciunt itaque commodi tempore", "completed": true, "username": "Delphine"}, {"task": "omnis consequuntur cupiditate impedit itaque ipsam quo", "completed": true, "username": "Delphine"}, {"task": "debitis nisi et dolorem repellat et", "completed": true, "username": "Delphine"}], "10": [{"task": "ut cupiditate sequi aliquam fuga maiores", "completed": false, "username": "Moriah.Stanton"}, {"task": "inventore saepe cumque et aut illum enim", "completed": true, "username": "Moriah.Stanton"}, {"task": "omnis nulla eum aliquam distinctio", "completed": true, "username": "Moriah.Stanton"}, {"task": "molestias modi perferendis perspiciatis", "completed": false, "username": "Moriah.Stanton"}, {"task": "voluptates dignissimos sed doloribus animi quaerat aut", "completed": false, "username": "Moriah.Stanton"}, {"task": "explicabo odio est et", "completed": false, "username": "Moriah.Stanton"}, {"task": "consequuntur animi possimus", "completed": false, "username": "Moriah.Stanton"}, {"task": "vel non beatae est", "completed": true, "username": "Moriah.Stanton"}, {"task": "culpa eius et voluptatem et", "completed": true, "username": "Moriah.Stanton"}, {"task": "accusamus sint iusto et voluptatem exercitationem", "completed": true, "username": "Moriah.Stanton"}, {"task": "temporibus atque distinctio omnis eius impedit tempore molestias pariatur", "completed": true, "username": "Moriah.Stanton"}, {"task": "ut quas possimus exercitationem sint voluptates", "completed": false, "username": "Moriah.Stanton"}, {"task": "rerum debitis voluptatem qui eveniet tempora distinctio a", "completed": true, "username": "Moriah.Stanton"}, {"task": "sed ut vero sit molestiae", "completed": false, "username": "Moriah.Stanton"}, {"task": "rerum ex veniam mollitia voluptatibus pariatur", "completed": true, "username": "Moriah.Stanton"}, {"task": "consequuntur aut ut fugit similique", "completed": true, "username": "Moriah.Stanton"}, {"task": "dignissimos quo nobis earum saepe", "completed": true, "username": "Moriah.Stanton"}, {"task": "quis eius est sint explicabo", "completed": true, "username": "Moriah.Stanton"}, {"task": "numquam repellendus a magnam", "completed": true, "username": "Moriah.Stanton"}, {"task": "ipsam aperiam voluptates qui", "completed": false, "username": "Moriah.Stanton"}]} -------------------------------------------------------------------------------- /0x16-api_advanced/0-main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | 0-main 4 | """ 5 | import sys 6 | 7 | if __name__ == '__main__': 8 | number_of_subscribers = __import__('0-subs').number_of_subscribers 9 | if len(sys.argv) < 2: 10 | print("Please pass an argument for the subreddit to search.") 11 | else: 12 | print("{:d}".format(number_of_subscribers(sys.argv[1]))) 13 | -------------------------------------------------------------------------------- /0x16-api_advanced/0-subs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | number of subscribers for a given subreddit 4 | """ 5 | 6 | from requests import get 7 | 8 | 9 | def number_of_subscribers(subreddit): 10 | """ 11 | function that queries the Reddit API and returns the number of subscribers 12 | (not active users, total subscribers) for a given subreddit. 13 | """ 14 | 15 | if subreddit is None or not isinstance(subreddit, str): 16 | return 0 17 | 18 | user_agent = {'User-agent': 'Google Chrome Version 81.0.4044.129'} 19 | url = 'https://www.reddit.com/r/{}/about.json'.format(subreddit) 20 | response = get(url, headers=user_agent) 21 | results = response.json() 22 | 23 | try: 24 | return results.get('data').get('subscribers') 25 | 26 | except Exception: 27 | return 0 28 | -------------------------------------------------------------------------------- /0x16-api_advanced/1-main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | 1-main 4 | """ 5 | import sys 6 | 7 | if __name__ == '__main__': 8 | top_ten = __import__('1-top_ten').top_ten 9 | if len(sys.argv) < 2: 10 | print("Please pass an argument for the subreddit to search.") 11 | else: 12 | top_ten(sys.argv[1]) 13 | -------------------------------------------------------------------------------- /0x16-api_advanced/1-top_ten.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | """ 4 | prints the titles of the first 10 hot posts listed for a given subreddit 5 | """ 6 | 7 | from requests import get 8 | 9 | 10 | def top_ten(subreddit): 11 | """ 12 | function that queries the Reddit API and prints the titles of the first 13 | 10 hot posts listed for a given subreddit 14 | """ 15 | 16 | if subreddit is None or not isinstance(subreddit, str): 17 | print("None") 18 | 19 | user_agent = {'User-agent': 'Google Chrome Version 81.0.4044.129'} 20 | params = {'limit': 10} 21 | url = 'https://www.reddit.com/r/{}/hot/.json'.format(subreddit) 22 | 23 | response = get(url, headers=user_agent, params=params) 24 | results = response.json() 25 | 26 | try: 27 | my_data = results.get('data').get('children') 28 | 29 | for i in my_data: 30 | print(i.get('data').get('title')) 31 | 32 | except Exception: 33 | print("None") 34 | -------------------------------------------------------------------------------- /0x16-api_advanced/100-count.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | a recursive function that queries the Reddit API, parses the title of all 4 | hot articles, and prints a sorted count of given keywords. 5 | """ 6 | import requests 7 | 8 | 9 | def count_words(subreddit, word_list, instances={}, after="", count=0): 10 | """ 11 | Returns a list containing the titles of all hot articles for a 12 | given subreddit. If no results are found for the given subreddit, 13 | the function should return None. 14 | """ 15 | url = "https://www.reddit.com/r/{}/hot/.json".format(subreddit) 16 | headers = { 17 | "User-Agent": "linux:0x16.api.advanced:v1.0.0 (by /u/bdov_)" 18 | } 19 | params = { 20 | "after": after, 21 | "count": count, 22 | "limit": 100 23 | } 24 | response = requests.get(url, headers=headers, params=params, 25 | allow_redirects=False) 26 | try: 27 | results = response.json() 28 | if response.status_code == 404: 29 | raise Exception 30 | except Exception: 31 | print("") 32 | return 33 | 34 | results = results.get("data") 35 | after = results.get("after") 36 | count += results.get("dist") 37 | for ct in results.get("children"): 38 | title = ct.get("data").get("title").lower().split() 39 | for word in word_list: 40 | if word.lower() in title: 41 | times = len([tm for tm in title if tm == word.lower()]) 42 | if instances.get(word) is None: 43 | instances[word] = times 44 | else: 45 | instances[word] += times 46 | 47 | if after is None: 48 | if len(instances) == 0: 49 | print("") 50 | return 51 | instances = sorted(instances.items(), key=lambda kv: (-kv[1], kv[0])) 52 | [print("{}: {}".format(k, v)) for k, v in instances] 53 | else: 54 | count_words(subreddit, word_list, instances, after, count) 55 | -------------------------------------------------------------------------------- /0x16-api_advanced/100-main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | 100-main 4 | """ 5 | import sys 6 | 7 | if __name__ == '__main__': 8 | count_words = __import__('100-count').count_words 9 | if len(sys.argv) < 3: 10 | print("Usage: {} ".format(sys.argv[0])) 11 | print("Ex: {} programming 'python java javascript'".format(sys.argv[0])) 12 | else: 13 | result = count_words(sys.argv[1], [x for x in sys.argv[2].split()]) 14 | -------------------------------------------------------------------------------- /0x16-api_advanced/2-main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | 2-main 4 | """ 5 | import sys 6 | 7 | if __name__ == '__main__': 8 | recurse = __import__('2-recurse').recurse 9 | if len(sys.argv) < 2: 10 | print("Please pass an argument for the subreddit to search.") 11 | else: 12 | result = recurse(sys.argv[1]) 13 | if result is not None: 14 | print(len(result)) 15 | else: 16 | print("None") 17 | -------------------------------------------------------------------------------- /0x16-api_advanced/2-recurse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """a recursive function that queries the Reddit API and returns a list 3 | containing the titles of all hot articles for a given subreddit. 4 | """ 5 | import requests 6 | 7 | 8 | def recurse(subreddit, hot_list=[], after="", count=0): 9 | """Returns a list of titles of all hot posts on a given subreddit.""" 10 | sub_info = requests.get("https://www.reddit.com/r/{}/hot.json" 11 | .format(subreddit), 12 | params={"count": count, "after": after}, 13 | headers={"User-Agent": "My-User-Agent"}, 14 | allow_redirects=False) 15 | if sub_info.status_code >= 400: 16 | return None 17 | 18 | hot_l = hot_list + [child.get("data").get("title") 19 | for child in sub_info.json() 20 | .get("data") 21 | .get("children")] 22 | 23 | info = sub_info.json() 24 | if not info.get("data").get("after"): 25 | return hot_l 26 | 27 | return recurse(subreddit, hot_l, info.get("data").get("count"), 28 | info.get("data").get("after")) 29 | -------------------------------------------------------------------------------- /0x16-api_advanced/README.md: -------------------------------------------------------------------------------- 1 | this ia alx project for 0x16-api_advanced -------------------------------------------------------------------------------- /0x16-api_advanced/__pycache__/0-subs.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x16-api_advanced/__pycache__/0-subs.cpython-35.pyc -------------------------------------------------------------------------------- /0x16-api_advanced/__pycache__/1-top_ten.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x16-api_advanced/__pycache__/1-top_ten.cpython-35.pyc -------------------------------------------------------------------------------- /0x16-api_advanced/__pycache__/100-count.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x16-api_advanced/__pycache__/100-count.cpython-35.pyc -------------------------------------------------------------------------------- /0x16-api_advanced/__pycache__/2-recurse.cpython-35.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/0x16-api_advanced/__pycache__/2-recurse.cpython-35.pyc -------------------------------------------------------------------------------- /0x17-web_stack_debugging_3/0-strace_is_your_friend.pp: -------------------------------------------------------------------------------- 1 | # A puppet manuscript to replace a line in a file on a server 2 | 3 | $file_to_edit = '/var/www/html/wp-settings.php' 4 | 5 | #replace line containing "phpp" with "php" 6 | 7 | exec { 'replace_line': 8 | command => "sed -i 's/phpp/php/g' ${file_to_edit}", 9 | path => ['/bin','/usr/bin'] 10 | } 11 | -------------------------------------------------------------------------------- /0x17-web_stack_debugging_3/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x17-web_stack_debugging_3 -------------------------------------------------------------------------------- /0x18-webstack_monitoring/0-strace_is_your_friend.pp: -------------------------------------------------------------------------------- 1 | # A puppet manuscript to replace a line in a file on a server 2 | 3 | $file_to_edit = '/var/www/html/wp-settings.php' 4 | 5 | #replace line containing "phpp" with "php" 6 | 7 | exec { 'replace_line': 8 | command => "sed -i 's/phpp/php/g' ${file_to_edit}", 9 | path => ['/bin','/usr/bin'] 10 | } 11 | -------------------------------------------------------------------------------- /0x18-webstack_monitoring/2-setup_datadog: -------------------------------------------------------------------------------- 1 | cc5-376-aef 2 | -------------------------------------------------------------------------------- /0x18-webstack_monitoring/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x18-webstack_monitoring 2 | -------------------------------------------------------------------------------- /0x19-postmortem/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x19-postmortem -------------------------------------------------------------------------------- /0x1A-application_server/2-app_server-nginx_config: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | add_header X-Served-By "190329-web-01"; 5 | root /var/www/html; 6 | index index.html index.htm; 7 | 8 | location /airbnb-onepage/ { 9 | alias /home/ubuntu/Airbnb_clone_v2/; 10 | index index.html index.htm; 11 | try_files $uri @proxy; 12 | } 13 | 14 | location @proxy { 15 | proxy_pass http://127.0.0.1:5000; 16 | proxy_set_header Host $host; 17 | proxy_set_header X-Real-IP $remote_addr; 18 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 19 | } 20 | 21 | rewrite ^/redirect_me https://github.com/EstephaniaCalvoC/ permanent; 22 | 23 | error_page 404 /my_404.html; 24 | location = /my_404.html { 25 | root /usr/share/nginx/html; 26 | internal; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /0x1A-application_server/3-app_server-nginx_config: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | add_header X-Served-By "190329-web-01"; 5 | root /var/www/html; 6 | index index.html index.htm; 7 | 8 | location /airbnb-onepage/ { 9 | alias /home/ubuntu/Airbnb_clone_v2/; 10 | index index.html index.htm; 11 | try_files $uri @proxy; 12 | } 13 | 14 | location /airbnb-dynamic/number_odd_or_even/ { 15 | proxy_pass http://127.0.0.1:5001; 16 | proxy_set_header Host $host; 17 | proxy_set_header X-Real-IP $remote_addr; 18 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 19 | } 20 | 21 | location @proxy { 22 | proxy_pass http://127.0.0.1:5000; 23 | proxy_set_header Host $host; 24 | proxy_set_header X-Real-IP $remote_addr; 25 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 26 | } 27 | 28 | rewrite ^/redirect_me https://github.com/EstephaniaCalvoC/ permanent; 29 | 30 | error_page 404 /my_404.html; 31 | location = /my_404.html { 32 | root /usr/share/nginx/html; 33 | internal; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /0x1A-application_server/4-app_server-nginx_config: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | add_header X-Served-By "190329-web-01"; 5 | root /var/www/html; 6 | index index.html index.htm; 7 | 8 | location /airbnb-onepage/ { 9 | alias ~/Holberton_Projects/Airbnb_clone_v2/; 10 | index index.html index.htm; 11 | proxy_pass http://0.0.0.0:5000; 12 | } 13 | 14 | location ~ /airbnb-dynamic/number_odd_or_even/(\d+)$ { 15 | proxy_pass http://127.0.0.1:5001/number_odd_or_even/$1; 16 | } 17 | 18 | location /api { 19 | proxy_pass http://127.0.0.1:5002/api; 20 | } 21 | 22 | rewrite ^/redirect_me https://github.com/EstephaniaCalvoC/ permanent; 23 | error_page 404 /my_404.html; 24 | location = /my_404.html {root /usr/share/nginx/html; internal;} 25 | } 26 | -------------------------------------------------------------------------------- /0x1A-application_server/4-reload_gunicorn_no_downtime: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /0x1A-application_server/5-app_server-nginx_config: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | add_header X-Served-By "190329-web-01"; 5 | root /var/www/html; 6 | index index.html index.htm; 7 | 8 | location /airbnb-onepage/ { 9 | alias ~/Holberton_Projects/Airbnb_clone_v2/; 10 | index index.html index.htm; 11 | proxy_pass http://0.0.0.0:5000; 12 | } 13 | 14 | location ~ /airbnb-dynamic/number_odd_or_even/(\d+)$ { 15 | proxy_pass http://127.0.0.1:5001/number_odd_or_even/$1; 16 | } 17 | 18 | location /api { 19 | proxy_pass http://127.0.0.1:5002/api; 20 | } 21 | 22 | location / { 23 | proxy_pass http://127.0.0.1:5003/2-hbnb; 24 | } 25 | 26 | location /static { 27 | proxy_pass http://127.0.0.1:5003; 28 | } 29 | 30 | rewrite ^/redirect_me https://github.com/EstephaniaCalvoC/ permanent; 31 | error_page 404 /my_404.html; 32 | location = /my_404.html {root /usr/share/nginx/html; internal;} 33 | } 34 | -------------------------------------------------------------------------------- /0x1A-application_server/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x1A-application_server -------------------------------------------------------------------------------- /0x1A-application_server/gunicorn.service: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /0x1B-web_stack_debugging_4/0-the_sky_is_the_limit_not.pp: -------------------------------------------------------------------------------- 1 | #Puppet file that fixes multiple server errors in Nginx server 2 | 3 | exec { 'fix_limit': 4 | path => ['/usr/bin', '/sbin', '/bin', '/usr/sbin'], 5 | command => "sed -i 's/ULIMIT=\"-n 15\"/ULIMIT=\"-n 3072\"/g' /etc/default/nginx; sudo service nginx restart", 6 | provider => 'shell'} 7 | -------------------------------------------------------------------------------- /0x1B-web_stack_debugging_4/1-user_limit.pp: -------------------------------------------------------------------------------- 1 | # Change the OS configuration so that it is possible to login with the 2 | # holberton user and open a file without any error message. 3 | 4 | exec {'OS security config': 5 | command => 'sed -i "s/holberton/foo/" /etc/security/limits.conf', 6 | path => '/usr/bin/env/:/bin/:/usr/bin/:/usr/sbin/' 7 | } 8 | -------------------------------------------------------------------------------- /0x1B-web_stack_debugging_4/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for 0x1B-web_stack_debugging_4 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 0x00. Shell, Basics 2 | 3 | ## Learning Objectives 4 | 5 | At the end of this project, you should be able to explain the following concepts without the help of Google: 6 | 7 | ### General 8 | 9 | - **RTFM:** 10 | - Understanding the meaning of RTFM. 11 | 12 | - **Shebang:** 13 | - Knowing what a shebang is. 14 | 15 | - **Shell:** 16 | - Understanding the concept of the shell. 17 | 18 | - **Terminal vs. Shell:** 19 | - Distinguishing between a terminal and a shell. 20 | 21 | - **Shell Prompt:** 22 | - Understanding the shell prompt and how to use the history (the basics). 23 | 24 | ### Navigation 25 | 26 | - **Commands & Built-ins:** 27 | - Knowing what the commands or built-ins `cd`, `pwd`, `ls` do. 28 | 29 | - **Filesystem Navigation:** 30 | - Understanding how to navigate the filesystem. 31 | 32 | - **Special Directories:** 33 | - Knowing the purpose of the `.` and `..` directories. 34 | 35 | - **Working Directory:** 36 | - Understanding the working directory, how to print it, and how to change it. 37 | 38 | - **Root Directory:** 39 | - Knowing what the root directory is. 40 | 41 | - **Home Directory:** 42 | - Understanding the home directory and how to navigate there. 43 | 44 | - **Hidden Files:** 45 | - Knowing the characteristics of hidden files and how to list them. 46 | 47 | - **`cd -` Command:** 48 | - Understanding what the `cd -` command does. 49 | 50 | ### Looking Around 51 | 52 | - **Commands:** 53 | - Understanding what the commands `ls`, `less`, `file` do. 54 | 55 | - **Options and Arguments:** 56 | - Knowing how to use options and arguments with commands. 57 | 58 | - **ls Long Format:** 59 | - Understanding the `ls` long format and how to display it. 60 | 61 | ### A Guided Tour 62 | 63 | - **ln Command:** 64 | - Knowing what the `ln` command does. 65 | 66 | - **Important Directories:** 67 | - Understanding the contents of the most common/important directories. 68 | 69 | - **Symbolic Link vs. Hard Link:** 70 | - Knowing what a symbolic link and a hard link are. 71 | 72 | - **Difference between Hard Link and Symbolic Link:** 73 | - Understanding the difference between a hard link and a symbolic link. 74 | 75 | ### Manipulating Files 76 | 77 | - **Commands:** 78 | - Knowing what the commands `cp`, `mv`, `rm`, `mkdir` do. 79 | 80 | - **Wildcards:** 81 | - Understanding what wildcards are and how they work. 82 | 83 | - **Using Wildcards:** 84 | - Knowing how to use wildcards. 85 | 86 | ### Working with Commands 87 | 88 | - **Commands:** 89 | - Understanding what the commands `type`, `which`, `help`, `man` do. 90 | 91 | - **Types of Commands:** 92 | - Knowing the different kinds of commands. 93 | 94 | - **Alias:** 95 | - Understanding what an alias is. 96 | 97 | - **help vs. man:** 98 | - Knowing when to use the command `help` instead of `man`. 99 | 100 | ### Reading Man Pages 101 | 102 | - **Reading a Man Page:** 103 | - Knowing how to read a man page. 104 | 105 | - **Man Page Sections:** 106 | - Understanding man page sections. 107 | 108 | - **Section Numbers:** 109 | - Knowing the section numbers for User commands, System calls, and Library functions. 110 | 111 | ### Keyboard Shortcuts for Bash 112 | 113 | - **Common Shortcuts:** 114 | - Knowing common shortcuts for Bash. 115 | 116 | ### LTS 117 | 118 | - **LTS:** 119 | - Understanding the meaning of LTS. 120 | 121 | ### Copyright - Plagiarism 122 | 123 | You are tasked to come up with solutions for the tasks below yourself to meet the above learning objectives. You will not be able to meet the objectives of this or any following project by copying and pasting someone else’s work. You are not allowed to publish any content of this project. Any form of plagiarism is strictly forbidden and will result in removal from the program. 124 | 125 | ## Requirements 126 | 127 | ### General 128 | 129 | - **Allowed Editors:** 130 | - vi, vim, emacs. 131 | 132 | - **Testing Environment:** 133 | - All your scripts will be tested on Ubuntu 20.04 LTS. 134 | 135 | - **Script Length:** 136 | - All your scripts should be exactly two lines long (`$ wc -l file` should print 2). 137 | 138 | - **File Ending:** 139 | - All your files should end with a new line. 140 | 141 | - **First Line:** 142 | - The first line of all your files should be exactly `#!/bin/bash`. 143 | 144 | - **README.md:** 145 | - A `README.md` file at the root of the repo, containing a description of the repository. 146 | 147 | - **README.md in Project Folder:** 148 | - A `README.md` file, at the root of the folder of this project, describing what each script is doing. 149 | 150 | - **Restrictions:** 151 | - You are not allowed to use backticks, `&&`, `||` or `;`. 152 | 153 | - **Executable Scripts:** 154 | - All your scripts must be executable. To make your file executable, use the `chmod` command: `chmod u+x file`. 155 | 156 | ## More Info 157 | 158 | ### Example of Line Count and First Line 159 | 160 | ```bash 161 | julien@ubuntu:/tmp$ wc -l 12-file_type 162 | 2 12-file_type 163 | julien@ubuntu:/tmp$ head -n 1 12-file_type 164 | #!/bin/bash 165 | julien@ubuntu:/tmp$ 166 | -------------------------------------------------------------------------------- /attack_is_the_best_defense/0-sniffing: -------------------------------------------------------------------------------- 1 | mypassword9898! 2 | -------------------------------------------------------------------------------- /attack_is_the_best_defense/1-dictionary_attack: -------------------------------------------------------------------------------- 1 | password123 2 | -------------------------------------------------------------------------------- /attack_is_the_best_defense/README.md: -------------------------------------------------------------------------------- 1 | this is alx project for attack_is_the_best_defense -------------------------------------------------------------------------------- /attack_is_the_best_defense/user_authenticating_into_server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/attack_is_the_best_defense/user_authenticating_into_server -------------------------------------------------------------------------------- /command_line_for_the_win/0-first_9_tasks.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/0-first_9_tasks.PNG -------------------------------------------------------------------------------- /command_line_for_the_win/0-first_9_tasks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/0-first_9_tasks.jpg -------------------------------------------------------------------------------- /command_line_for_the_win/1-next_9_tasks.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/1-next_9_tasks.JPG -------------------------------------------------------------------------------- /command_line_for_the_win/1-next_9_tasks.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/1-next_9_tasks.PNG -------------------------------------------------------------------------------- /command_line_for_the_win/2-next_9_tasks.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/2-next_9_tasks.JPG -------------------------------------------------------------------------------- /command_line_for_the_win/2-next_9_tasks.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ambesawi/alx-system_engineering-devops/d44d508d883ea4e13faeeb00d3a5c2f7084d18ec/command_line_for_the_win/2-next_9_tasks.PNG -------------------------------------------------------------------------------- /command_line_for_the_win/README.md: -------------------------------------------------------------------------------- 1 | # Command Line for the Win 2 | 3 | ## Overview 4 | 5 | CMD CHALLENGE is a command-line game designed to enhance Bash skills. The game consists of tasks that need to be completed using the command line, and the complexity of questions increases progressively. This project is optional and aimed at improving command-line proficiency. 6 | 7 | ## Requirements 8 | 9 | ### General 10 | 11 | - A `README.md` file at the root of the project folder is mandatory. 12 | - This project will undergo manual review. 13 | - Each completed task will be indicated by the turning green of the task's name. 14 | - Create and push a screenshot, demonstrating the completion of required levels, to GitHub in either PNG or JPEG format. 15 | 16 | ### Specific 17 | 18 | In addition to completing the project tasks and submitting the required screenshots to GitHub, you are required to demonstrate the use of the SFTP (Secure File Transfer Protocol) command-line tool to move your local screenshots to the sandbox environment. 19 | 20 | #### References: 21 | 22 | - [SFTP Guide](SFTP_GUIDE_LINK) 23 | - [SFTP File Transfer Tutorial](SFTP_TUTORIAL_LINK) 24 | 25 | #### Steps: 26 | 27 | 1. Take screenshots of the completed levels as mentioned in the general requirements. 28 | 2. Open a terminal or command prompt on your local machine. 29 | 3. Use the SFTP command-line tool to establish a connection to the sandbox environment (hostname, username, and password provided). 30 | 4. Navigate to the directory where you want to upload the screenshots. 31 | 5. Use the SFTP `put` command to upload the screenshots from your local machine to the sandbox environment. 32 | 6. Confirm the successful transfer by checking the sandbox directory. 33 | 7. Once transferred, proceed to push the screenshots to GitHub as mentioned in the initial requirements. 34 | 35 | Ensure that you include the steps you followed to use the SFTP command-line tool in your project’s `README.md` file. This will help reviewers understand how you performed the file transfer using SFTP. 36 | 37 | **Note:** Screenshots of completed levels should be inside the directory `/root/alx-system_engineering-devops/command_line_for_the_win/`. 38 | 39 | ## Manual QA Review 40 | 41 | It is your responsibility to request a review for this project from a peer. If no peers have reviewed, you should request a review from a TA or staff member. 42 | -------------------------------------------------------------------------------- /lb-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server- lb-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@100.24.72.101 10 | -------------------------------------------------------------------------------- /web-01: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server-01 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@34.207.211.122 10 | -------------------------------------------------------------------------------- /web-02: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # server- web-02 login 3 | 4 | 5 | eval $("ssh-agenot") 6 | 7 | ssh-add ~/.ssh/school 8 | 9 | ssh ubuntu@3.94.213.225 10 | --------------------------------------------------------------------------------