├── Obsoleto ├── tdd_betty │ ├── negocio │ │ ├── __init__.py │ │ └── troca_betty.py │ ├── testes │ │ ├── __init__.py │ │ └── testes_troca_betty.py │ ├── README.md │ └── .gitignore ├── tdd_palavra │ ├── negocio │ │ ├── __init__.py │ │ └── palavra.py │ ├── testes │ │ ├── __init__.py │ │ └── testes_palavra.py │ └── .gitignore ├── tcr_quarenta_e_duolingo │ ├── negocio │ │ ├── __init__.py │ │ └── quarenta_e_duolingo.py │ ├── testes │ │ ├── __init__.py │ │ └── testes_quarenta_e_duolingo.py │ └── .gitignore └── tdd_jokenpo_diferentao │ ├── tests │ ├── __init__.py │ └── teste.py │ ├── jokenpo_diferentao │ ├── __init__.py │ └── jogo.py │ └── .gitignore ├── docker-compose2 ├── docker │ ├── dev │ │ ├── dockerfile │ │ └── config │ │ │ └── startup.sh │ ├── service1 │ │ └── dockerfile │ └── service2 │ │ ├── dockerfile │ │ └── config │ │ └── data.cfg ├── app │ ├── something.cfg │ ├── backend │ │ └── something.py │ └── frontend │ │ └── something.html ├── docker-compose.yml └── .devcontainer │ ├── devcontainer.json │ └── docker-compose.yml ├── minishell ├── tester │ ├── test_files │ │ └── dojo_tests │ └── dojo_tester.sh ├── minishell ├── main.c └── README.md ├── MLX ├── MLX42.zip ├── minilibx-linux.zip ├── README.md ├── utilities │ ├── clear_js_files.sh │ ├── xpm2png.js │ ├── png2xpm.go │ └── README.md ├── JRPG │ └── set_lib.sh ├── Tron │ └── set_lib.sh └── Paint │ ├── set_lib.sh │ └── README.md ├── Nginx - Webserv └── resources │ ├── ft_helloworld.html │ └── 42.conf ├── Rust ├── src │ ├── ft_split.rs │ ├── ft_putstr.rs │ ├── ft_strcpy.rs │ ├── ft_strjoin.rs │ ├── ft_strlen.rs │ ├── main.rs │ └── special │ │ └── README.md ├── install_rust.sh ├── Cargo.lock ├── Cargo.toml └── README.md ├── TDD usando a libft ├── src │ ├── ft_atoi.c │ └── ft_isalpha.c ├── .gitignore ├── docker-compose.yml ├── dockerfile ├── tests │ ├── test_ft_atoi.c │ └── test_ft_isalpha.c ├── .devcontainer │ ├── docker-compose.yml │ └── devcontainer.json └── README.md ├── GDB e Valgrind ├── desafio1.zip ├── desafio2.zip ├── desafio3.zip ├── desafio4.zip ├── desafio5.zip ├── backup │ ├── stage1.zip │ ├── stage2.zip │ ├── stage3.zip │ ├── stage4.zip │ └── stage5.zip ├── src │ ├── rand.h │ ├── rand.c │ ├── rand2.c │ └── rand3.c ├── lab_dojo4.c ├── lab_dojo5.c ├── libft │ ├── README.md │ ├── ft_printfsources │ │ ├── ft_putchar.c │ │ ├── ft_putstr.c │ │ ├── ft_printf_utils.c │ │ ├── ft_putnbr.c │ │ ├── ft_putnbr_hex.c │ │ ├── ft_printf.c │ │ └── ft_print.c │ ├── llsources │ │ ├── ft_lstadd_front.c │ │ ├── ft_lstlast.c │ │ ├── ft_lstdelone.c │ │ ├── ft_lstsize.c │ │ ├── ft_lstiter.c │ │ ├── ft_lstnew.c │ │ ├── ft_lstadd_back.c │ │ ├── ft_lstclear.c │ │ └── ft_lstmap.c │ ├── libsources │ │ ├── rand_string.c │ │ ├── ft_putchar_fd.c │ │ ├── ft_strlen.c │ │ ├── ft_putstr_fd.c │ │ ├── ft_toupper.c │ │ ├── ft_isascii.c │ │ ├── ft_isdigit.c │ │ ├── ft_isprint.c │ │ ├── ft_isalpha.c │ │ ├── ft_tolower.c │ │ ├── ft_putendl_fd.c │ │ ├── ft_isalnum.c │ │ ├── ft_striteri.c │ │ ├── ft_bzero.c │ │ ├── ft_memset.c │ │ ├── ft_strchr.c │ │ ├── ft_memcpy.c │ │ ├── ft_strdup.c │ │ ├── ft_memchr.c │ │ ├── ft_strrchr.c │ │ ├── ft_calloc.c │ │ ├── ft_strmapi.c │ │ ├── ft_memmove.c │ │ ├── ft_strlcpy.c │ │ ├── ft_strtrim.c │ │ ├── ft_memcmp.c │ │ ├── ft_strjoin.c │ │ ├── ft_strncmp.c │ │ ├── ft_atoi.c │ │ ├── ft_putnbr_fd.c │ │ ├── ft_substr.c │ │ ├── ft_strnstr.c │ │ ├── ft_strlcat.c │ │ ├── ft_atoi_hex.c │ │ ├── ft_itoa.c │ │ └── ft_split.c │ ├── includes │ │ ├── ft_printf.h │ │ ├── libput.h │ │ ├── get_next_line.h │ │ ├── linked_list.h │ │ └── libft.h │ ├── gnlsources │ │ ├── get_next_line_utils.c │ │ └── get_next_line.c │ └── Makefile ├── lab_dojo2.c ├── lab_dojo.c └── lab_dojo3.c ├── CSSDesafios ├── 01_Tucano │ ├── Assets │ │ ├── images │ │ │ ├── tucano - montado.png │ │ │ ├── tucano - desmontado.png │ │ │ └── guia de estilo - tucano.png │ │ └── css │ │ │ └── variables.css │ ├── index.html │ └── README.md └── 00_Gatinho │ ├── Assets │ ├── images │ │ ├── Gatinho - Montado.png │ │ ├── Gatinho - Desmontado.png │ │ └── Guia de Estilo - Gatinho.png │ └── css │ │ └── variables.css │ ├── index.html │ └── README.md ├── Banco de Dados AWS DynamoDB e Docker └── config │ └── docker-compose.yml ├── CI com Github Actions ├── ✅ Dojo de CI com Github Actions.canvas └── ✅ Dojo de CI com Github Actions.md ├── Banco de Dados com Postgres e Docker └── README.md ├── docker-compose └── Dojo de docker-compose.md ├── Algoritmos ├── Romanos │ └── README.md ├── Números Romanos │ └── README.md ├── String sem letras repetidas │ └── README.md ├── Carteado │ └── README.md └── Problema do doce │ └── README.md ├── The baby steps game └── The Baby Steps Game 🍼.md ├── Docker └── 🐋 Dojo de Docker.md └── README.md /Obsoleto/tdd_betty/negocio/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Obsoleto/tdd_betty/testes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-compose2/docker/dev/dockerfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Obsoleto/tdd_palavra/negocio/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Obsoleto/tdd_palavra/testes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-compose2/docker/service1/dockerfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-compose2/docker/dev/config/startup.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /minishell/tester/test_files/dojo_tests: -------------------------------------------------------------------------------- 1 | pwd 2 | -------------------------------------------------------------------------------- /Obsoleto/tcr_quarenta_e_duolingo/negocio/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Obsoleto/tcr_quarenta_e_duolingo/testes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Obsoleto/tdd_betty/README.md: -------------------------------------------------------------------------------- 1 | # Dojo da Betty 2 | 3 | -------------------------------------------------------------------------------- /Obsoleto/tdd_jokenpo_diferentao/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-compose2/app/something.cfg: -------------------------------------------------------------------------------- 1 | mapear esse diretorio -------------------------------------------------------------------------------- /Obsoleto/tdd_jokenpo_diferentao/jokenpo_diferentao/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /MLX/MLX42.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/MLX/MLX42.zip -------------------------------------------------------------------------------- /Nginx - Webserv/resources/ft_helloworld.html: -------------------------------------------------------------------------------- 1 |

Bonjour, quarante-deux

-------------------------------------------------------------------------------- /Obsoleto/tdd_palavra/negocio/palavra.py: -------------------------------------------------------------------------------- 1 | def somar(a, b): 2 | return a + b -------------------------------------------------------------------------------- /Rust/src/ft_split.rs: -------------------------------------------------------------------------------- 1 | pub fn ft_split() { 2 | println!("Hello"); 3 | } 4 | -------------------------------------------------------------------------------- /Rust/src/ft_putstr.rs: -------------------------------------------------------------------------------- 1 | pub fn ft_putstr() { 2 | println!("Hello"); 3 | } 4 | -------------------------------------------------------------------------------- /Rust/src/ft_strcpy.rs: -------------------------------------------------------------------------------- 1 | pub fn ft_strcpy() { 2 | println!("Hello"); 3 | } 4 | -------------------------------------------------------------------------------- /Rust/src/ft_strjoin.rs: -------------------------------------------------------------------------------- 1 | pub fn ft_strjoin() { 2 | println!("Hello"); 3 | } 4 | -------------------------------------------------------------------------------- /Rust/src/ft_strlen.rs: -------------------------------------------------------------------------------- 1 | pub fn ft_strlen() { 2 | println!("Hello"); 3 | } 4 | -------------------------------------------------------------------------------- /TDD usando a libft/src/ft_atoi.c: -------------------------------------------------------------------------------- 1 | int ft_atoi(const char *c) 2 | { 3 | return '\0'; 4 | } -------------------------------------------------------------------------------- /minishell/minishell: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/minishell/minishell -------------------------------------------------------------------------------- /MLX/minilibx-linux.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/MLX/minilibx-linux.zip -------------------------------------------------------------------------------- /TDD usando a libft/.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | a.out 3 | *.o 4 | *.tests 5 | *.a 6 | test_program -------------------------------------------------------------------------------- /TDD usando a libft/src/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | int ft_isalpha(int c) 2 | { 3 | return 1024; 4 | } -------------------------------------------------------------------------------- /docker-compose2/docker/service2/dockerfile: -------------------------------------------------------------------------------- 1 | # COPY host_path /etc/nginx/conf.d/default.conf -------------------------------------------------------------------------------- /Obsoleto/tdd_jokenpo_diferentao/jokenpo_diferentao/jogo.py: -------------------------------------------------------------------------------- 1 | def somar(a, b): 2 | return a + b -------------------------------------------------------------------------------- /GDB e Valgrind/desafio1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/desafio1.zip -------------------------------------------------------------------------------- /GDB e Valgrind/desafio2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/desafio2.zip -------------------------------------------------------------------------------- /GDB e Valgrind/desafio3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/desafio3.zip -------------------------------------------------------------------------------- /GDB e Valgrind/desafio4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/desafio4.zip -------------------------------------------------------------------------------- /GDB e Valgrind/desafio5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/desafio5.zip -------------------------------------------------------------------------------- /Obsoleto/tcr_quarenta_e_duolingo/negocio/quarenta_e_duolingo.py: -------------------------------------------------------------------------------- 1 | def somar(a, b): 2 | return a + b -------------------------------------------------------------------------------- /GDB e Valgrind/backup/stage1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/backup/stage1.zip -------------------------------------------------------------------------------- /GDB e Valgrind/backup/stage2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/backup/stage2.zip -------------------------------------------------------------------------------- /GDB e Valgrind/backup/stage3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/backup/stage3.zip -------------------------------------------------------------------------------- /GDB e Valgrind/backup/stage4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/backup/stage4.zip -------------------------------------------------------------------------------- /GDB e Valgrind/backup/stage5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/GDB e Valgrind/backup/stage5.zip -------------------------------------------------------------------------------- /GDB e Valgrind/src/rand.h: -------------------------------------------------------------------------------- 1 | #ifndef RAND_H 2 | # define RAND_H 3 | 4 | char *rand_string(int i); 5 | 6 | #endif -------------------------------------------------------------------------------- /Rust/install_rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | curl https://sh.rustup.rs -sSf | sh 4 | echo "export PATH=$PATH:$HOME/.cargo/bin" >> $HOME/.zshrc 5 | -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/Assets/images/tucano - montado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/01_Tucano/Assets/images/tucano - montado.png -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/Assets/images/Gatinho - Montado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/00_Gatinho/Assets/images/Gatinho - Montado.png -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/Assets/images/Gatinho - Desmontado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/00_Gatinho/Assets/images/Gatinho - Desmontado.png -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/Assets/images/tucano - desmontado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/01_Tucano/Assets/images/tucano - desmontado.png -------------------------------------------------------------------------------- /Obsoleto/tdd_betty/negocio/troca_betty.py: -------------------------------------------------------------------------------- 1 | def trocar(frase): 2 | if (frase == 'Felipe' or frase == 'Noé'): 3 | return 'Betty' 4 | return 'Betty e Betty' -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/Assets/images/guia de estilo - tucano.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/01_Tucano/Assets/images/guia de estilo - tucano.png -------------------------------------------------------------------------------- /MLX/README.md: -------------------------------------------------------------------------------- 1 | #AVISO 2 | 3 | Leia o README.md dentro de "utilities" antes de começar, depois sinta-se livre para escolher qual projeto fazer! 4 | -------------------------------------------------------------------------------- /MLX/utilities/clear_js_files.sh: -------------------------------------------------------------------------------- 1 | #!/usb/bin/bash 2 | 3 | # This script clears all files created by `npm i xpm2png` 4 | /usr/bin/rm -fr node_modules package-lock.json 5 | -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/Assets/images/Guia de Estilo - Gatinho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/42sp/dojos/HEAD/CSSDesafios/00_Gatinho/Assets/images/Guia de Estilo - Gatinho.png -------------------------------------------------------------------------------- /Nginx - Webserv/resources/42.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | root /usr/share/nginx/html 5 | 6 | location / { 7 | index 42.html; 8 | } 9 | } -------------------------------------------------------------------------------- /Rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "coding_dojo" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /TDD usando a libft/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | app: 4 | build: 5 | context: . 6 | dockerfile: dockerfile 7 | volumes: 8 | - ./src:/libft -------------------------------------------------------------------------------- /Rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "coding_dojo" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /docker-compose2/app/backend/something.py: -------------------------------------------------------------------------------- 1 | print("Esse é so um exemplo, vc pode usar a linguagem que quiser") 2 | print("Esse é so um exemplo, vc pode usar a linguagem que quiser") 3 | print("Esse é so um exemplo, vc pode usar a linguagem que quiser") -------------------------------------------------------------------------------- /docker-compose2/docker/service2/config/data.cfg: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | charset utf-8; 6 | access_log /var/log/nginx/app.access.log main; 7 | 8 | underscores_in_headers on; 9 | 10 | location / { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /GDB e Valgrind/src/rand.c: -------------------------------------------------------------------------------- 1 | #include "../libft/includes/get_next_line.h" 2 | #include "../libft/includes/libft.h" 3 | #include "../libft/includes/ft_printf.h" 4 | #include "rand.h" 5 | 6 | char *rand_string(int i) 7 | { 8 | char *string; 9 | 10 | string = ft_strdup("GNU Debugger"); 11 | return string; 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /GDB e Valgrind/src/rand2.c: -------------------------------------------------------------------------------- 1 | #include "../libft/includes/get_next_line.h" 2 | #include "../libft/includes/libft.h" 3 | #include "../libft/includes/ft_printf.h" 4 | #include "rand.h" 5 | 6 | char *rand_string(int i) 7 | { 8 | char *string; 9 | 10 | string = ft_strdup("Richard Stallman"); 11 | return string; 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /GDB e Valgrind/src/rand3.c: -------------------------------------------------------------------------------- 1 | #include "../libft/includes/get_next_line.h" 2 | #include "../libft/includes/libft.h" 3 | #include "../libft/includes/ft_printf.h" 4 | #include "rand.h" 5 | 6 | char *rand_string(int i) 7 | { 8 | char *string; 9 | 10 | string = ft_strdup("Criado em 1986"); 11 | return string; 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /docker-compose2/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | dev: 3 | build: 4 | context: docker/dev 5 | dockerfile: dockerfile 6 | # ports: add the services port 7 | # networks: add the services network 8 | # depends_on: what services this service depends on 9 | volumes: # add the volume from the host to the container -------------------------------------------------------------------------------- /Rust/src/main.rs: -------------------------------------------------------------------------------- 1 | mod ft_putstr; 2 | mod ft_strlen; 3 | mod ft_strcpy; 4 | mod ft_strjoin; 5 | mod ft_split; 6 | 7 | use ft_putstr::ft_putstr; 8 | use ft_strlen::ft_strlen; 9 | use ft_strcpy::ft_strcpy; 10 | use ft_strjoin::ft_strjoin; 11 | use ft_split::ft_split; 12 | 13 | fn main() { 14 | println!("Hello, Cadetes!"); 15 | } 16 | -------------------------------------------------------------------------------- /Obsoleto/tdd_jokenpo_diferentao/tests/teste.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import jokenpo_diferentao.jogo as jogo 3 | 4 | class TesteDoJoKenPo(TestCase): 5 | 6 | def teste_de_exemplo(self): 7 | a = 1 8 | b = 2 9 | esperado = 3 10 | 11 | resultado = jogo.somar(a, b) 12 | 13 | self.assertEqual(resultado, esperado) 14 | -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 00_Gatinho : 42SPDojo 8 | 9 | 10 |

Olá Mundo!

11 | 12 | -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 01_Tucano : 42SPDojo 8 | 9 | 10 |

Olá Mundo!

11 | 12 | -------------------------------------------------------------------------------- /Obsoleto/tcr_quarenta_e_duolingo/testes/testes_quarenta_e_duolingo.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import negocio.quarenta_e_duolingo as negocio 3 | 4 | class TesteDeExemplo(TestCase): 5 | 6 | def teste_de_exemplo(self): 7 | a = 20 8 | b = 25 9 | esperado = 45 10 | 11 | calculado = negocio.somar(a, b) 12 | 13 | self.assertEqual(esperado, calculado) -------------------------------------------------------------------------------- /Obsoleto/tdd_palavra/testes/testes_palavra.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import negocio.palavra as negocio 3 | 4 | # Se a letra está no lugar certo C 5 | # Se a letra está no lugar errado E 6 | # Se a letra não existe na palavra X 7 | 8 | class TesteDeExemplo(TestCase): 9 | 10 | def teste_de_exemplo(self): 11 | a = 20 12 | b = 25 13 | esperado = 45 14 | 15 | calculado = negocio.somar(a, b) 16 | 17 | self.assertEqual(esperado, calculado) -------------------------------------------------------------------------------- /TDD usando a libft/dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:10.12 2 | 3 | RUN apt-get update -y 4 | RUN apt-get install -y --no-install-recommends apt-utils 5 | RUN apt-get install -y gcc 6 | RUN apt-get install gdb -y 7 | RUN apt-get install make -y 8 | RUN apt-get install valgrind -y 9 | RUN apt-get install python3 -y 10 | RUN apt-get install python3-venv python3-pip -y 11 | RUN python3 -m pip install --upgrade pip setuptools 12 | RUN python3 -m pip install norminette 13 | 14 | WORKDIR /product 15 | 16 | CMD ["tail", "-f", "/dev/null"] -------------------------------------------------------------------------------- /GDB e Valgrind/lab_dojo4.c: -------------------------------------------------------------------------------- 1 | #include "libft/includes/get_next_line.h" 2 | #include "libft/includes/libft.h" 3 | #include "libft/includes/ft_printf.h" 4 | 5 | int main( void ) 6 | { 7 | char *input; 8 | void *result; 9 | 10 | result = ft_calloc(1, sizeof(char)); 11 | result = rand_string(pegadinha(42)); 12 | ft_printf("$> "); 13 | input = get_next_line(0); 14 | while (ft_strncmp(input, result, 24)) 15 | { 16 | ft_print("Fail"); 17 | ft_printf("$> "); 18 | input = get_next_line(0); 19 | } 20 | ft_print("Boua!"); 21 | } 22 | -------------------------------------------------------------------------------- /GDB e Valgrind/lab_dojo5.c: -------------------------------------------------------------------------------- 1 | #include "libft/includes/get_next_line.h" 2 | #include "libft/includes/libft.h" 3 | #include "libft/includes/ft_printf.h" 4 | 5 | int main( void ) 6 | { 7 | char *input; 8 | t_list *result; 9 | t_mini *test; 10 | 11 | result = ft_calloc(1, sizeof(t_mini)); 12 | result = rand_string(pegadinha(42)); 13 | ft_printf("$> "); 14 | input = get_next_line(0); 15 | while (ft_strncmplist(input, result, 28)) 16 | { 17 | ft_print("Fail"); 18 | ft_printf("$> "); 19 | input = get_next_line(0); 20 | } 21 | ft_print("Boua!"); 22 | } 23 | -------------------------------------------------------------------------------- /docker-compose2/app/frontend/something.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EXEMPLO 7 | 8 | 9 | 10 | 11 | 12 |

ISSO PODE SER UM FRONTEND?

13 |

Adicione uma msg nessa tela que sera gerada no backend!

14 | 15 | -------------------------------------------------------------------------------- /Banco de Dados AWS DynamoDB e Docker/config/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | localstack: 5 | container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}" 6 | image: localstack/localstack 7 | ports: 8 | - "127.0.0.1:4566:4566" # LocalStack Gateway 9 | - "127.0.0.1:4510-4559:4510-4559" # external services port range 10 | environment: 11 | - DEBUG=${DEBUG-} 12 | - DOCKER_HOST=unix:///var/run/docker.sock 13 | volumes: 14 | - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" 15 | - "/var/run/docker.sock:/var/run/docker.sock" -------------------------------------------------------------------------------- /TDD usando a libft/tests/test_ft_atoi.c: -------------------------------------------------------------------------------- 1 | #include "minunit.h" 2 | 3 | int ft_atoi(const char *c); 4 | 5 | MU_TEST(test_atoi_convert_1_char_to_1_integer) 6 | { 7 | // ARRANGE 8 | char *c = "1"; 9 | int expected_result = 1; 10 | char actual_result; 11 | 12 | // ACT 13 | actual_result = ft_atoi(c); 14 | 15 | // ASSERT 16 | mu_assert_int_eq(expected_result, actual_result); 17 | } 18 | 19 | MU_TEST_SUITE(ft_atoi_test_suite) 20 | { 21 | MU_RUN_TEST(test_atoi_convert_1_char_to_1_integer); 22 | } 23 | 24 | int main(int argc, char *argv[]) { 25 | MU_RUN_SUITE(ft_atoi_test_suite); 26 | MU_REPORT(); 27 | return MU_EXIT_CODE; 28 | } -------------------------------------------------------------------------------- /GDB e Valgrind/libft/README.md: -------------------------------------------------------------------------------- 1 |

2 | Libft 3 |

4 | 5 |

6 | Your very first own library.
7 |

8 | 9 | ## Summary 10 | > This project is about coding a C library that will be used in future projects. 11 | > It will contain a lot of useful general purpose functions. 12 | > This version of Libft also includes ft_printf and get_next_line projects. 13 | 14 | ## Getting started 15 | First, clone this repository and `cd` into it: 16 | 17 | ```zsh 18 | $ git clone https://github.com/0xEDU/libft; cd libft 19 | ``` 20 | 21 | Compile the library with: 22 | 23 | ```zsh 24 | $ make 25 | ``` 26 | -------------------------------------------------------------------------------- /GDB e Valgrind/lab_dojo2.c: -------------------------------------------------------------------------------- 1 | // TO SOLVE: 2 | // 3 | // Ctrl-D -> Has a Segfault 4 | 5 | #include "libft/includes/get_next_line.h" 6 | #include "libft/includes/libft.h" 7 | #include "libft/includes/ft_printf.h" 8 | #include "src/rand.h" 9 | 10 | int pegadinha(int i) 11 | { 12 | ft_print("pegadinha"); 13 | return (0); 14 | } 15 | 16 | int main( void ) 17 | { 18 | char *input; 19 | 20 | ft_printf("$> "); 21 | input = get_next_line(0); 22 | while (ft_strncmp(input, rand_string(pegadinha(42)), ft_strlen(rand_string(0)))) 23 | { 24 | ft_print("Fail"); 25 | ft_printf("$> "); 26 | input = get_next_line(0); 27 | } 28 | ft_print("Boua!"); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/lab_dojo.c: -------------------------------------------------------------------------------- 1 | #include "libft/includes/get_next_line.h" 2 | #include "libft/includes/libft.h" 3 | #include "libft/includes/ft_printf.h" 4 | #include "src/rand.h" 5 | 6 | int main(int ac, char **av) 7 | { 8 | char *input; 9 | size_t len; 10 | 11 | if (ac - 1 == 3) 12 | { 13 | char *result = rand_string(42); 14 | ft_print("$> "); 15 | input = get_next_line(0); 16 | len = ft_strlen(input); 17 | while (ft_strncmp(input, result, len - 1)) 18 | { 19 | ft_printf("Fail\n"); 20 | ft_print("$> "); 21 | input = get_next_line(0); 22 | } 23 | ft_printf("Boua!\n"); 24 | free(result); 25 | } 26 | else 27 | return (0); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /TDD usando a libft/tests/test_ft_isalpha.c: -------------------------------------------------------------------------------- 1 | #include "minunit.h" 2 | 3 | int ft_isalpha(int c); 4 | 5 | MU_TEST(test_isalpha_receiving_A_returns_true) 6 | { 7 | //ARRANGE 8 | char input = 'A'; 9 | int expected_result = 1024;// it could be any number different from 0 10 | int actual_result; 11 | 12 | //ACT 13 | actual_result = ft_isalpha(input); 14 | 15 | //ASSERT 16 | mu_assert_int_eq(expected_result, actual_result); 17 | } 18 | 19 | MU_TEST_SUITE(ft_isalpha_test_suite) 20 | { 21 | MU_RUN_TEST(test_isalpha_receiving_A_returns_true); 22 | } 23 | 24 | int main(int argc, char *argv[]) { 25 | MU_RUN_SUITE(ft_isalpha_test_suite); 26 | MU_REPORT(); 27 | return MU_EXIT_CODE; 28 | } -------------------------------------------------------------------------------- /minishell/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include // TODO: Change for libft !!! 3 | #include // strncmp 4 | #include // getcwd 5 | #include // exit 6 | 7 | int handle_input(char *input) 8 | { 9 | // your code here 10 | char output[10000]; 11 | if (strncmp(input, "pwd", 3) == 0) // TODO: Use a libft! 12 | { 13 | getcwd(output, 100); 14 | write(1, output, strlen(output)); 15 | return (0); 16 | } 17 | return(0); 18 | } 19 | 20 | int main() 21 | { 22 | char *input; 23 | 24 | while (1) 25 | { 26 | input = readline(">"); 27 | if (!input) 28 | exit(0); 29 | handle_input(input); 30 | } 31 | return (0); 32 | } -------------------------------------------------------------------------------- /MLX/utilities/xpm2png.js: -------------------------------------------------------------------------------- 1 | // Created by PHIND AI 2 | const xpm2png = require('xpm2png'); 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | 6 | async function convertXpmToPng(inputPath) { 7 | const parsedPath = path.parse(inputPath); 8 | const outputPath = path.format({ 9 | dir: parsedPath.dir, 10 | name: parsedPath.name, 11 | ext: '.png' 12 | }); 13 | 14 | const exists = await fs.existsSync(outputPath); 15 | if (exists) { 16 | return console.log('Output file already exists'); 17 | } 18 | 19 | const img = await xpm2png(inputPath, false); 20 | await img.writeAsync(outputPath); 21 | console.log('Conversion completed'); 22 | } 23 | 24 | if (process.argv.length < 3) { 25 | console.log('Please provide the path to the XPM file'); 26 | process.exit(1); 27 | } 28 | 29 | convertXpmToPng(process.argv[2]); 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/lab_dojo3.c: -------------------------------------------------------------------------------- 1 | // TO SOLVE: 2 | // 3 | // Ctrl-D -> Has a Segfault 4 | 5 | #include 6 | 7 | #include "libft/includes/get_next_line.h" 8 | #include "libft/includes/libft.h" 9 | #include "libft/includes/ft_printf.h" 10 | #include "src/rand.h" 11 | 12 | int outra_pegadinha(int i) 13 | { 14 | ft_print("entre aqui"); 15 | return(i); 16 | } 17 | 18 | int pegadinha(int i) 19 | { 20 | ft_print("pegadinha"); 21 | return (0); 22 | } 23 | 24 | int main( void ) 25 | { 26 | char *input; 27 | int i; 28 | ft_printf("$> "); 29 | input = get_next_line(0); 30 | i = 0; 31 | while(i < INT_MAX) 32 | i++; 33 | while (ft_strncmp(input, rand_string(pegadinha(42)), ft_strlen(rand_string(0)))) 34 | { 35 | ft_print("Fail"); 36 | ft_printf("$> "); 37 | input = get_next_line(0); 38 | } 39 | ft_print("Boua!"); 40 | } 41 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_putchar.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 21:46:43 by coder #+# #+# */ 9 | /* Updated: 2022/10/01 03:55:17 by coder ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libput.h" 14 | 15 | int ft_putchar(char c) 16 | { 17 | write(1, &c, 1); 18 | return (1); 19 | } 20 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstadd_front.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_front.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott next = *lst; 18 | *lst = new; 19 | } 20 | -------------------------------------------------------------------------------- /CI com Github Actions/✅ Dojo de CI com Github Actions.canvas: -------------------------------------------------------------------------------- 1 | { 2 | "nodes":[ 3 | {"type":"text","text":"Tests","id":"3e2bf36d5f302fcd","x":40,"y":640,"width":250,"height":60,"color":"4"}, 4 | {"type":"text","text":"Build","id":"8d7ff9266a1f6474","x":-280,"y":640,"width":250,"height":60,"color":"4"}, 5 | {"type":"text","text":"Valgrind","id":"ec6f8fbb1ee946db","x":360,"y":640,"width":250,"height":60,"color":"4"}, 6 | {"type":"text","text":"Norminette","id":"a125385758d3cb7c","x":-600,"y":640,"width":250,"height":60,"color":"4"}, 7 | {"type":"file","file":"Eventos internos/Dojozão de quinta/CI com Github Actions/✅ Dojo de CI com Github Actions.md","id":"45c0a2998e938d0e","x":-720,"y":-220,"width":1440,"height":820} 8 | ], 9 | "edges":[ 10 | {"id":"81cde77dee0c5d76","fromNode":"3e2bf36d5f302fcd","fromSide":"right","toNode":"ec6f8fbb1ee946db","toSide":"left"}, 11 | {"id":"c2eb83f0fa5a1989","fromNode":"8d7ff9266a1f6474","fromSide":"right","toNode":"3e2bf36d5f302fcd","toSide":"left"}, 12 | {"id":"a0bffe0b3f95cf4f","fromNode":"a125385758d3cb7c","fromSide":"right","toNode":"8d7ff9266a1f6474","toSide":"left"} 13 | ] 14 | } -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstlast.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstlast.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott next) 20 | lst = lst->next; 21 | return (lst); 22 | } 23 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/rand_string.c: -------------------------------------------------------------------------------- 1 | #include "libft.h" 2 | #include "ft_printf.h" 3 | 4 | int ft_strncmplist(const char *s1, const t_list *list, size_t n) 5 | { 6 | unsigned int index; 7 | t_mini *mini; 8 | 9 | mini = (t_mini *)list->content; 10 | index = 0; 11 | if (n == 0) 12 | return (0); 13 | while ((s1[index] == mini->string[index]) && index < (n - 1)) 14 | { 15 | if (s1[index] == '\0') 16 | break ; 17 | index++; 18 | } 19 | return (((unsigned char) s1[index]) - ((unsigned char) mini->string[index])); 20 | } 21 | 22 | /* 23 | 24 | int pegadinha() 25 | { 26 | ft_print("pegadinha"); 27 | return (0); 28 | } 29 | 30 | void *rand_string(int i) 31 | { 32 | char *string; 33 | 34 | (void)i; 35 | string = ft_strdup("Free Software Foundation"); 36 | return string; 37 | } 38 | 39 | t_list *rand_string(int i) 40 | { 41 | t_mini *string; 42 | t_shell *shell; 43 | 44 | (void)i; 45 | string = ft_calloc(1, sizeof(t_mini)); 46 | shell = ft_calloc(1, sizeof(t_shell)); 47 | string->string = ft_strdup("https://youtu.be/9sJUDx7iEJw"); 48 | ft_lstadd_front(&shell->list, ft_lstnew(string)); 49 | return (shell->list); 50 | 51 | }*/ 52 | 53 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstdelone.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott content); 20 | free(lst); 21 | lst = 0; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstsize.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstsize.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott next; 23 | size++; 24 | } 25 | return (size); 26 | } 27 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/includes/ft_printf.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 12:28:37 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 22:27:39 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FT_PRINTF_H 14 | # define FT_PRINTF_H 15 | # include 16 | 17 | int ft_printf(const char *format, ...); 18 | int ft_print(const char *fmt, ...); 19 | int print_pointer(unsigned long int p); 20 | #endif 21 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstiter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott content); 22 | lst = lst->next; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/includes/libput.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libput.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 15:51:37 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 15:51:33 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBPUT_H 14 | # define LIBPUT_H 15 | 16 | # include 17 | 18 | int ft_putchar(char c); 19 | int ft_putstr(char *s); 20 | int ft_putnbr(long long n); 21 | int ft_putnbr_hex(unsigned long long n, char option); 22 | #endif 23 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott content = content; 23 | node->next = NULL; 24 | return (node); 25 | } 26 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 18:54:18 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:42:12 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Write a char c in the fd filedescriptor. 17 | * 18 | * @param char c: Character to write; 19 | * @param int fd: Filedescriptor to write to. 20 | */ 21 | void ft_putchar_fd(char c, int fd) 22 | { 23 | write(fd, &c, 1); 24 | } 25 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/includes/get_next_line.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/14 19:44:50 by coder #+# #+# */ 9 | /* Updated: 2022/11/13 08:16:43 by etachott ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef GET_NEXT_LINE_H 14 | # define GET_NEXT_LINE_H 15 | # include 16 | # include 17 | # include "libft.h" 18 | 19 | // prototypes 20 | char *gnl_strjoin(char *s1, char *s2); 21 | int gnl_strchr(const char *s, char c); 22 | char *get_next_line(int fd); 23 | #endif 24 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstadd_back.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_back.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott next = new; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_putstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 22:16:00 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 15:54:08 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libput.h" 14 | #include "libft.h" 15 | 16 | int ft_putstr(char *s) 17 | { 18 | int i; 19 | 20 | i = 0; 21 | if (s == NULL) 22 | { 23 | write(1, "(null)", 6); 24 | return (6); 25 | } 26 | while (s[i]) 27 | { 28 | write(1, &s[i], 1); 29 | i++; 30 | } 31 | return (ft_strlen(s)); 32 | } 33 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 17:54:58 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:32:06 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return the length of string s. 17 | * 18 | * @param const char *s: Pointer to the string to be measured. 19 | * 20 | * @return Length of the string s. 21 | */ 22 | size_t ft_strlen(const char *s) 23 | { 24 | int i; 25 | 26 | i = 0; 27 | while (s[i]) 28 | i++; 29 | return (i); 30 | } 31 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 18:41:43 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:52:36 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Write a string s to the fd filedescriptor. 17 | * 18 | * @param char *s: String to be written; 19 | * @param int fd: Filedescriptor to write to. 20 | */ 21 | void ft_putstr_fd(char *s, int fd) 22 | { 23 | int i; 24 | 25 | i = 0; 26 | while (s[i]) 27 | { 28 | write(fd, &s[i], 1); 29 | i++; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_toupper.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_toupper.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 16:01:04 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 18:02:39 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Converts a given lowercase letter to its uppercase equivalent. 17 | * 18 | * @param int c: The ASCII value to be converted. 19 | * 20 | * @return The uppercase equivalent of the input value. 21 | */ 22 | int ft_toupper(int c) 23 | { 24 | if (97 <= c && c <= 122) 25 | return (c - 32); 26 | else 27 | return (c); 28 | } 29 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_isascii.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isascii.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 17:14:55 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 14:04:17 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return a non-zero value if c is an ASCII character. 17 | * 18 | * @param int c: The integer value to check. 19 | * 20 | * @return If the character is ASCII return a non-zero value 21 | * else, return 0. 22 | */ 23 | int ft_isascii(int c) 24 | { 25 | if (0 <= c && c <= 127) 26 | return (1); 27 | else 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isdigit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 16:31:29 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 14:07:08 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return a non-zero value if c is a digit. 17 | * 18 | * @param int c: The integer value to check. 19 | * 20 | * @return If the character is a digit return a non-zero value 21 | * else, return 0. 22 | */ 23 | int ft_isdigit(int c) 24 | { 25 | if ('0' <= c && c <= '9') 26 | return (2048); 27 | else 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_isprint.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isprint.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 17:37:13 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 14:21:51 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return a non-zero value if c is printable 17 | * 18 | * @param int c: The integer value to check. 19 | * 20 | * @return If the character is printable return a non-zero value 21 | * else, return 0. 22 | */ 23 | int ft_isprint(int c) 24 | { 25 | if (' ' <= c && c <= '~') 26 | return (1); 27 | else 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstclear.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstclear.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott next; 26 | del(prev_node->content); 27 | free(prev_node); 28 | } 29 | lst = NULL; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_printf_utils.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf_utils.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 23:30:35 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 15:53:11 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | #include "libput.h" 15 | 16 | int print_pointer(unsigned long int p) 17 | { 18 | int print_len; 19 | 20 | print_len = 0; 21 | if (p == 0) 22 | { 23 | print_len += ft_putstr("(nil)"); 24 | return (print_len); 25 | } 26 | print_len += ft_putstr("0x"); 27 | print_len += ft_putnbr_hex(p, 'l'); 28 | return (print_len); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalpha.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 15:51:34 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 14:05:17 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return a non-zero value if c is a letter. 17 | * 18 | * @param int c: The integer value to check. 19 | * 20 | * @return If the character is a letter return a non-zero value 21 | * else, return 0. 22 | */ 23 | int ft_isalpha(int c) 24 | { 25 | if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) 26 | return (1024); 27 | else 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_tolower.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_tolower.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 16:11:17 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 18:03:20 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Converts an uppercase letter to lowercase. 17 | * 18 | * @param int c: The character to convert. 19 | * 20 | * @return The lowercase version of the input character if it is an uppercase 21 | * letter, or the input character otherwise. 22 | */ 23 | int ft_tolower(int c) 24 | { 25 | if (65 <= c && c <= 90) 26 | return (c + 32); 27 | else 28 | return (c); 29 | } 30 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 19:10:02 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:44:20 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Write a string s in the fd filedescript and write a line break after s. 17 | * 18 | * @param char *s: String to be written; 19 | * @param int fd: Filedescriptor to write to. 20 | */ 21 | void ft_putendl_fd(char *s, int fd) 22 | { 23 | int i; 24 | 25 | i = 0; 26 | while (s[i]) 27 | { 28 | write(fd, &s[i], 1); 29 | i++; 30 | } 31 | write(fd, "\n", 1); 32 | } 33 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/llsources/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott content)); 24 | if (!node) 25 | { 26 | ft_lstclear(&head, del); 27 | return (NULL); 28 | } 29 | ft_lstadd_back(&head, node); 30 | lst = lst->next; 31 | } 32 | return (head); 33 | } 34 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalnum.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 16:42:24 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 14:44:43 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Return a non-zero value if c is an alphanumeric character. 17 | * 18 | * @param int c: The integer value to check. 19 | * 20 | * @return If the character is alphanumeric return a non-zero value 21 | * else, return 0. 22 | */ 23 | int ft_isalnum(int c) 24 | { 25 | if (('A' <= c && c <= 'Z') 26 | || ('a' <= c && c <= 'z') 27 | || ('0' <= c && c <= '9')) 28 | return (8); 29 | return (0); 30 | } 31 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_striteri.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_striteri.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/12 11:32:28 by etachott #+# #+# */ 9 | /* Updated: 2023/03/16 16:14:41 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Apply the function f to every character in the string s. 17 | * 18 | * @param char *s: The string to be iterated over. 19 | * @param void (*f)(unsigned int, char *): The funcion to be applied to every 20 | * character. 21 | */ 22 | void ft_striteri(char *s, void (*f)(unsigned int, char*)) 23 | { 24 | unsigned int i; 25 | 26 | i = 0; 27 | while (s[i]) 28 | { 29 | f(i, &s[i]); 30 | i++; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 19:01:16 by coder #+# #+# */ 9 | /* Updated: 2022/10/04 18:34:08 by coder ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libput.h" 14 | 15 | int ft_putnbr(long long n) 16 | { 17 | char num; 18 | int len; 19 | 20 | num = 0; 21 | len = 0; 22 | if (n >= 10) 23 | { 24 | num = n % 10 + '0'; 25 | n /= 10; 26 | len += ft_putnbr(n); 27 | len += write(1, &num, 1); 28 | } 29 | else if (0 <= n && n <= 9) 30 | { 31 | n += '0'; 32 | len += write(1, &n, 1); 33 | } 34 | else if (n < 0) 35 | { 36 | n *= (-1); 37 | len += write(1, "-", 1); 38 | len += ft_putnbr(n); 39 | } 40 | return (len); 41 | } 42 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_bzero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bzero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 23:19:52 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 12:26:41 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Bzero sets the first n bytes of the block of memory pointed to 17 | * by s to zero. Useful for initializing structs. 18 | * 19 | * @param void *s: Pointer to memory block. 20 | * @param size_t n: Number of bytes to be zeroed 21 | */ 22 | void ft_bzero(void *s, size_t n) 23 | { 24 | unsigned int index; 25 | unsigned char *block_pointer; 26 | 27 | block_pointer = s; 28 | index = 0; 29 | while (index < n) 30 | { 31 | block_pointer[index] = '\0'; 32 | index++; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_memset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 19:03:49 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:40:03 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Fills n bytes of a block of memory s with a value c. 17 | * 18 | * @param void *s: Pointer to the memory block to fill; 19 | * @param int c: The value to be set; 20 | * @param int n: The number of bytes to fill. 21 | * 22 | * @return Pointer to the memory block. 23 | */ 24 | void *ft_memset(void *s, int c, size_t n) 25 | { 26 | unsigned int index; 27 | unsigned char *ptr; 28 | 29 | ptr = s; 30 | index = 0; 31 | while (index < n) 32 | { 33 | ptr[index] = c; 34 | index++; 35 | } 36 | return (s); 37 | } 38 | -------------------------------------------------------------------------------- /MLX/utilities/png2xpm.go: -------------------------------------------------------------------------------- 1 | // made by PHIND 2 | package main 3 | 4 | import ( 5 | "fmt" 6 | "image" 7 | _ "image/png" 8 | "os" 9 | "path/filepath" 10 | "strings" 11 | 12 | "github.com/xyproto/xpm" 13 | ) 14 | 15 | func main() { 16 | // Check if a file name was provided as a command-line argument 17 | if len(os.Args) < 2 { 18 | fmt.Fprintf(os.Stderr, "Please provide a file name as an argument.\n") 19 | os.Exit(1) 20 | } 21 | 22 | // Get the file name from the command-line arguments 23 | inputFileName := os.Args[1] 24 | 25 | // Open the PNG file 26 | f, err := os.Open(inputFileName) 27 | if err != nil { 28 | fmt.Fprintf(os.Stderr, "error: %s\n", err) 29 | os.Exit(1) 30 | } 31 | m, _, err := image.Decode(f) 32 | if err != nil { 33 | fmt.Fprintf(os.Stderr, "error: %s\n", err) 34 | os.Exit(1) 35 | } 36 | f.Close() 37 | 38 | // Create a new XPM encoder 39 | enc := xpm.NewEncoder(inputFileName) 40 | 41 | // Get the base name of the input file (without the extension) 42 | baseName := strings.TrimSuffix(filepath.Base(inputFileName), filepath.Ext(inputFileName)) 43 | outputFileName := baseName + ".xpm" 44 | 45 | // Prepare to output the XPM data to a file 46 | f, err = os.Create(outputFileName) 47 | if err != nil { 48 | fmt.Fprintf(os.Stderr, "error: %s\n", err) 49 | os.Exit(1) 50 | } 51 | defer f.Close() 52 | 53 | // Generate and output the XPM data 54 | err = enc.Encode(f, m) 55 | if err != nil { 56 | fmt.Fprintf(os.Stderr, "error: %s\n", err) 57 | os.Exit(1) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 16:14:57 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 16:08:12 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Check if the character c is insed the string s. 17 | * 18 | * @param const char *s: The string to be searchead; 19 | * @param int c: The character to look for. 20 | * 21 | * @return If the chracter is found, return a pointer to its position. Else, 22 | * return 0. 23 | */ 24 | char *ft_strchr(const char *s, int c) 25 | { 26 | int index; 27 | 28 | index = 0; 29 | while (s[index] != '\0') 30 | { 31 | if (s[index] == (char) c) 32 | return ((char *)s + index); 33 | index++; 34 | } 35 | return ((char *)s + index); 36 | } 37 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 12:33:09 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:24:07 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Copies src block of memory to dest. Doesn't treat overlap. 17 | * 18 | * @param void *dest: Pointer to the block of memory to copy to; 19 | * @param const void *src: Pointer to the block of memory to copy from; 20 | * @param size_t n: The number of bytes to copy. 21 | * 22 | * @return Pointer to the destination block. 23 | */ 24 | void *ft_memcpy(void *dest, const void *src, size_t n) 25 | { 26 | void *dest_copy; 27 | 28 | dest_copy = dest; 29 | while (n--) 30 | *(char *)dest++ = *(char *)src++; 31 | return (dest_copy); 32 | } 33 | -------------------------------------------------------------------------------- /MLX/utilities/README.md: -------------------------------------------------------------------------------- 1 | # ATENCAO ⚠️ 2 | ## Por que conversores? ❓ 3 | 4 | A MiniLibX da França utiliza um formato incomum de imagens chamado XPM, pelo fato dele ser incomum não é fácil achá-ló na internet, porém seus conversores são, só que, a proposito de tornar esse dojo mais dinâmico decidi eu mesmo fazer os conversores. 5 | São apenas 2, um de XPM3 para PNG e outro de PNG para XPM3. 6 | ATENÇÃO!!! Dentro do repositório da CODAM (MLX42.zip), na pasta "tools" tem um conversor em python de XPM3 para XPM42 (formato próprio da CODAM), fora isso a CODAM tem suporte nativo a PNG. 7 | 8 | ## Usar o conversor de GO 🐿️ 9 | ### png2xpm.go 🐿️ 10 | 11 | O conversor de go depende de um código do github\*, para puxar ele para sua máquina você deve utilizar o comando: 12 | `bash$ go get github.com/xyproto/xpm` 13 | * Se o seu Go for mais recente que a versão nas máquinas da 42 vai precisar fazer gambiarra com o go mod, pergunte ao seu GePeTo favorito como fazer isso. 14 | 15 | Então rode com: 16 | `bash$ go run png2xpm.go /your/png/file.png` 17 | 18 | ## Usar o conversor de JS ☕ 19 | ### xpm2png.js ☕ 20 | 21 | O conversor de JS depende de um pacote chamado xpm2png, para instalar ele você deve utilizar o comando: 22 | `bash$ npm i xpm2png` 23 | 24 | Então rode com: 25 | `bash$ node xpm2png.js /your/xpm/file.xpm` 26 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strdup.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdup.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/23 18:04:44 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 18:04:32 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | static char *ft_strcpy(char *dst, const char *src) 16 | { 17 | while (*src) 18 | { 19 | *dst = *src; 20 | src++; 21 | dst++; 22 | } 23 | *dst = '\0'; 24 | return (dst); 25 | } 26 | 27 | /* 28 | * Return an allocated copy of the string s1. 29 | * 30 | * @param const char *s1: The string to be copied. 31 | * 32 | * @return Pointer to the allocated string. 33 | */ 34 | char *ft_strdup(const char *s1) 35 | { 36 | char *k; 37 | 38 | k = (char *) malloc(ft_strlen(s1) + 1); 39 | if (k != NULL) 40 | ft_strcpy(k, s1); 41 | return (k); 42 | } 43 | -------------------------------------------------------------------------------- /Obsoleto/tdd_betty/testes/testes_troca_betty.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | import negocio.troca_betty 3 | 4 | # Qualquer nome próprio deve ser trocado por Betty 5 | 6 | # Lula 7 | # Meu nome tbm é betty -> Felipe 8 | # Meu nome tbmé betty -> Noé 9 | # Meu nome tmb é betty -> Victor 10 | # Meu nome tmb é betty -> Laura 11 | class TestsDaBetty(TestCase): 12 | 13 | # Arrange 14 | # Act 15 | # Assert 16 | 17 | # ARRANGE 18 | def test_Felipe_retorna_Betty(self): 19 | nome = 'Felipe' 20 | resultado_esperado = 'Betty' 21 | # ACT 22 | resultado = negocio.troca_betty.trocar(nome) 23 | # ASSERT 24 | self.assertEqual(resultado, resultado_esperado) 25 | 26 | # ARRANGE 27 | def test_Noé_retorna_Betty(self): 28 | nome = 'Noé' 29 | esperado = 'Betty' 30 | # ACT 31 | resultado = negocio.troca_betty.trocar(nome) 32 | # ASSERT 33 | self.assertEqual(resultado, esperado) 34 | 35 | def test_Victor_e_Noe_retorna_Betty_e_Betty(self): 36 | frase = 'Victor e Noe' 37 | esperado = 'Betty e Betty' 38 | #ACT 39 | resultado = negocio.troca_betty.trocar(frase) 40 | # ASSERT 41 | self.assertEqual(resultado, esperado) 42 | 43 | def test_alameda_Yaya_retorna_alameda_Betty(self): 44 | frase = 'alameda Yaya' 45 | esperado = 'alameda Betty' 46 | #ACT 47 | resultado = negocio.troca_betty.trocar(frase) 48 | # ASSERT 49 | self.assertEqual(resultado, esperado) 50 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_memchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 00:22:39 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 16:02:06 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Searches for a character in a block of memory. 17 | * 18 | * @param void *s: Pointer to the block of memory; 19 | * @param int c: The character to search for; 20 | * @param size_t n: The number of bytes to search in the block. 21 | * 22 | * @return If c is found in the memory block, return a pointer to it. Else, 23 | * return NULL. 24 | */ 25 | void *ft_memchr(const void *s, int c, size_t n) 26 | { 27 | const unsigned char *ptr = s; 28 | 29 | c = (unsigned char) c; 30 | while (n--) 31 | { 32 | if (*ptr == c) 33 | return ((void *)ptr); 34 | ptr++; 35 | } 36 | return (NULL); 37 | } 38 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strrchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 01:18:56 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:51:17 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Locate the last occurence of a character in a string. 17 | * 18 | * @param char *s: The string to search; 19 | * @param int c: The character to search for. 20 | * 21 | * @return If the character is found, a pointer to the character in the 22 | * string. If the character is not found, returns NULL. 23 | */ 24 | char *ft_strrchr(const char *s, int c) 25 | { 26 | int len; 27 | 28 | len = ft_strlen(s); 29 | while (len) 30 | { 31 | if (s[len] == (char) c) 32 | return ((char *)s + len); 33 | len--; 34 | } 35 | if (s[len] == (char) c) 36 | return ((char *)s + len); 37 | return (0); 38 | } 39 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/includes/linked_list.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* linked_list.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/11/13 03:26:30 by etachott #+# #+# */ 9 | /* Updated: 2023/06/20 03:32:46 by coder ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LINKED_LIST_H 14 | # define LINKED_LIST_H 15 | # include 16 | 17 | typedef struct s_list 18 | { 19 | void *content; 20 | struct s_list *next; 21 | } t_list; 22 | 23 | t_list *ft_lstnew(void *content); 24 | void ft_lstadd_front(t_list **lst, t_list *new); 25 | int ft_lstsize(t_list *lst); 26 | t_list *ft_lstlast(t_list *lst); 27 | void ft_lstadd_back(t_list **lst, t_list *new); 28 | void ft_lstdelone(t_list *lst, void (*del)(void *)); 29 | void ft_lstclear(t_list **lst, void (*del)(void *)); 30 | void ft_lstiter(t_list *lst, void (*f)(void *)); 31 | t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); 32 | #endif 33 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_calloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_calloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 16:47:16 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 12:50:06 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Calloc allocates count * size bytes in memory and set it to 0. 17 | * 18 | * @param size_t count: Quantity of elements. 19 | * @param size_t size: Size of each element. 20 | * 21 | * @return Pointer to allocated memory block. 22 | */ 23 | void *ft_calloc(size_t count, size_t size) 24 | { 25 | size_t index; 26 | unsigned char *ptr; 27 | 28 | index = 0; 29 | if (!size || !count) 30 | return (malloc(0)); 31 | if (size > 2147483647 / count) 32 | return (NULL); 33 | ptr = malloc(count * size); 34 | if (ptr == NULL) 35 | return (ptr); 36 | while (index < size * count) 37 | ptr[index++] = '\0'; 38 | return (ptr); 39 | } 40 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmapi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/12 11:43:54 by etachott #+# #+# */ 9 | /* Updated: 2023/03/16 17:35:22 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Allocate a new string str which is the result of applying the function f to 17 | * every character of string s. 18 | * 19 | * @param char const *s: The source string; 20 | * @param char (*f)(unsigned int, char): The function to be applied. 21 | * 22 | * @param Pointer to the new allocated string resulted from applying f in s. 23 | */ 24 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) 25 | { 26 | unsigned int i; 27 | char *str; 28 | 29 | i = 0; 30 | str = malloc(ft_strlen(s) + 1); 31 | if (!s) 32 | return (NULL); 33 | while (s[i]) 34 | { 35 | str[i] = f(i, s[i]); 36 | i++; 37 | } 38 | str[i] = '\0'; 39 | return (str); 40 | } 41 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_memmove.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memmove.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 14:56:08 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:32:22 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Copies a block of memory to dst from src. Treats overlap. 17 | * 18 | * @param void *dst: Pointer to the block of memory to copy to; 19 | * @param const void *src: Pointer to the block of memory to copy from; 20 | * @param size_t len: The number of bytes to copy. 21 | * 22 | * @return Pointer to the destination block of memory used. 23 | */ 24 | void *ft_memmove(void *dst, const void *src, size_t len) 25 | { 26 | char *dst_copy; 27 | const char *src_copy; 28 | 29 | dst_copy = (char *)dst; 30 | src_copy = (const char *)src; 31 | if (dst > src) 32 | while (len--) 33 | *(dst_copy + len) = *(src_copy + len); 34 | else 35 | ft_memcpy(dst, src, len); 36 | return (dst); 37 | } 38 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strlcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/31 20:09:35 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:27:59 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Copies up to size - 1 characters from the NULL-terminated string src to 17 | * dst, NULL-terminating the result. 18 | * 19 | * @param char *dst: Pointer to the destination string; 20 | * @param char *src: Pointer to the source string; 21 | * @param size_t size: Quantity of bytes to be copied. 22 | * 23 | * @return Length of the string they tried to create. 24 | */ 25 | size_t ft_strlcpy(char *dst, const char *src, size_t size) 26 | { 27 | size_t nonull; 28 | size_t ret; 29 | 30 | nonull = size - 1; 31 | ret = ft_strlen(src); 32 | if (size) 33 | { 34 | while (nonull-- && *src) 35 | { 36 | *dst = (char) *src; 37 | dst++; 38 | src++; 39 | } 40 | *dst = '\0'; 41 | } 42 | return (ret); 43 | } 44 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strtrim.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/12 17:12:12 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:54:35 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Trim leading and trailing characters from a string. 17 | * 18 | * @param char const *s1: The string to trim; 19 | * @param char const *set: The set of characters to trim. 20 | * 21 | * @return A new string that has been trimmed. 22 | */ 23 | char *ft_strtrim(char const *s1, char const *set) 24 | { 25 | char *str; 26 | size_t i; 27 | size_t j; 28 | 29 | str = 0; 30 | i = 0; 31 | if (s1 && set) 32 | { 33 | j = ft_strlen(s1); 34 | while (s1[i] && ft_strchr(set, s1[i])) 35 | i++; 36 | while (s1[j - 1] && ft_strchr(set, s1[j - 1]) && j > i) 37 | j--; 38 | str = (char *) malloc(sizeof(char) * (j - i + 1)); 39 | if (str) 40 | ft_strlcpy(str, &s1[i], (j - i + 1)); 41 | } 42 | return (str); 43 | } 44 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 00:58:08 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:16:06 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Compare two blocks of memory. 17 | * 18 | * @param void *s1: A pointer to the first block of memory 19 | * @param void *s2: A pointer to the second block of memory 20 | * @param size_t n: the number of bytes to compare 21 | * 22 | * @return If the two memory blocks are equal, return 0. Else, return the 23 | * difference between the two blocks. 24 | */ 25 | int ft_memcmp(const void *s1, const void *s2, size_t n) 26 | { 27 | size_t index; 28 | const unsigned char *ptr1; 29 | const unsigned char *ptr2; 30 | 31 | index = 0; 32 | ptr1 = s1; 33 | ptr2 = s2; 34 | while (index < n) 35 | { 36 | if (ptr1[index] != ptr2[index]) 37 | return (ptr1[index] - ptr2[index]); 38 | else 39 | index++; 40 | } 41 | return (0); 42 | } 43 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strjoin.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/10 13:43:14 by etachott #+# #+# */ 9 | /* Updated: 2023/03/16 16:18:31 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Allocate a string new joining strings s1 and s2. 17 | * 18 | * @param char const *s1: First string to be joined; 19 | * @param char const *s2: Second string to be joined. 20 | * 21 | * @return A pointer to the allocated area containing the joined string. 22 | */ 23 | char *ft_strjoin(char const *s1, char const *s2) 24 | { 25 | char *new; 26 | size_t l1; 27 | size_t l2; 28 | size_t i; 29 | size_t j; 30 | 31 | i = 0; 32 | j = i; 33 | l1 = ft_strlen(s1); 34 | l2 = ft_strlen(s2); 35 | new = malloc(((l1 + l2) * sizeof(char)) + 1); 36 | while (l1--) 37 | { 38 | *(new + i) = *(s1 + i); 39 | i++; 40 | } 41 | while (l2--) 42 | { 43 | *(new + i) = *(s2 + j++); 44 | i++; 45 | } 46 | *(new + i) = '\0'; 47 | return (new); 48 | } 49 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 19:32:46 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:42:14 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Compare at most n bytes of string s1 and string s2. 17 | * 18 | * @param const char *s1: The first string to be compared; 19 | * @param const char *s2: The second string to be compared; 20 | * @param size_t n: The maximum number of bytes to be compared. 21 | * 22 | * @return An integer less than, equal to, or greater than zero if s1 is 23 | * found, respectively, to be less than, to match, or be greater than s2. 24 | */ 25 | int ft_strncmp(const char *s1, const char *s2, size_t n) 26 | { 27 | unsigned int index; 28 | 29 | index = 0; 30 | if (n == 0) 31 | return (0); 32 | while ((s1[index] == s2[index]) && index < (n - 1)) 33 | { 34 | if (s1[index] == '\0') 35 | break ; 36 | index++; 37 | } 38 | return (((unsigned char) s1[index]) - ((unsigned char) s2[index])); 39 | } 40 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_atoi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_atoi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 19:54:52 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 12:18:19 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Convert a string representation of a number to an integer. 17 | * NOTE: If the input string is greater than MAX_INT,it WILL overflow. 18 | * 19 | * @param char *str: Pointer to a string. 20 | * 21 | * @return int result: A integer that corresponds to the converted string. 22 | */ 23 | int ft_atoi(const char *str) 24 | { 25 | int is_negative; 26 | int result; 27 | 28 | is_negative = 1; 29 | result = 0; 30 | while (*str == ' ' || *str == '\t' || *str == '\r' 31 | || *str == '\n' || *str == '\f' || *str == '\v') 32 | str++; 33 | if (*str == '+' || *str == '-') 34 | { 35 | if (*str == '-') 36 | is_negative = -1; 37 | str++; 38 | } 39 | while ('0' <= *str && *str <= '9') 40 | { 41 | result = (*str - '0') + (result * 10); 42 | str++; 43 | } 44 | return (result * is_negative); 45 | } 46 | -------------------------------------------------------------------------------- /Banco de Dados com Postgres e Docker/README.md: -------------------------------------------------------------------------------- 1 | # Dojo de Banco de dados com Postgres e Docker 2 | 3 | Este é um repositório praticamente vazio. Só tem esse `README.md`. Mas pra um Dojozinho de 1 hora e meia, ele basta. Se liga: 4 | 5 | ## O desafio 6 | 7 | Em resumo, o desafio passa por três etapas: 8 | 9 | 1. [Subir um servidor de Banco de Dados e alguma ferramenta de gestão de Banco de Dados usando Docker](https://renatogroffe.medium.com/postgresql-docker-executando-uma-inst%C3%A2ncia-e-o-pgadmin-4-a-partir-de-containers-ad783e85b1a4) 10 | 2. Criar neste banco de dados as tabelas: Projeto e Cadete (a definição de quais campos cada tabela deve ter faz parte do Dojo 😜) 11 | 3. Popular estas tabelas com informações de Projetos (pelo menos 5) e Cadetes (pelo menos 20), e construir: 12 | 1. Uma query que selecione todos os cadetes que estejam no libft (de acordo com os dados que vocês inseriram) 13 | 2. Uma query que selecione todos os cadetes que estejam em algum projeto da fase 1 14 | 3. Uma query que selecione os cadetes que entregaram o so_long 15 | 16 | ## Dicas: 17 | 18 | - Se não ficou claro, para a primeira etapa contamos com [esse belíssimo tutorial](https://renatogroffe.medium.com/postgresql-docker-executando-uma-inst%C3%A2ncia-e-o-pgadmin-4-a-partir-de-containers-ad783e85b1a4) do Renato Groffe ensinando passo a passo como usar o PostgreSQL com Docker. Usa ele, usa... 19 | 20 | - Uma estratégia interessante para popular tabelas com muitos dados é fazer a query em uma planilha do Google Spreadsheets, concatenando campos da planilha para gerar o `INSERT`. Se não entendeu essa dica, faz na mão mesmo que tá tranquilo! 😛 21 | - Talvez para construir a última query do desafio (a mais difícil), você tenha que mexer na modelagem das tabelas, adicionando novas tabelas relacionadas com `Cadete` e `Projeto` 22 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/gnlsources/get_next_line_utils.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line_utils.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/14 19:45:27 by coder #+# #+# */ 9 | /* Updated: 2023/06/15 19:12:22 by etachott ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "get_next_line.h" 14 | #include "libft.h" 15 | 16 | int gnl_strchr(const char *s, char c) 17 | { 18 | int i; 19 | 20 | i = 0; 21 | if (!s) 22 | return (0); 23 | while (s[i]) 24 | { 25 | if (s[i] == c) 26 | return (1); 27 | else 28 | i++; 29 | } 30 | return (0); 31 | } 32 | 33 | char *gnl_strjoin(char *s1, char *s2) 34 | { 35 | char *new; 36 | size_t size; 37 | 38 | if (s1 == NULL && s2 == NULL) 39 | return (NULL); 40 | if (s1 == NULL) 41 | return (ft_strdup(s2)); 42 | if (s2 == NULL) 43 | return (ft_strdup(s1)); 44 | size = ft_strlen(s1) + ft_strlen(s2) + 1; 45 | new = malloc(size * sizeof(char)); 46 | if (new == NULL) 47 | { 48 | free(s1); 49 | return (NULL); 50 | } 51 | ft_strlcpy(new, s1, ft_strlen(s1) + 1); 52 | ft_strlcat(new, s2, size); 53 | free(s1); 54 | return (new); 55 | } 56 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 19:01:10 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 15:49:43 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | static int check_min(int n, int fd) 16 | { 17 | if (n == -2147483648) 18 | { 19 | write(fd, "-2147483648", 11); 20 | return (0); 21 | } 22 | else 23 | return (1); 24 | } 25 | 26 | /* 27 | * Write a number n in the fd filedescriptor. 28 | * 29 | * @param int n: Number to be written; 30 | * @param int fd: Filedescriptor to write to. 31 | */ 32 | void ft_putnbr_fd(int n, int fd) 33 | { 34 | char num; 35 | 36 | num = 0; 37 | if (check_min(n, fd) == 0) 38 | return ; 39 | if (n >= 10) 40 | { 41 | num = n % 10 + '0'; 42 | n = n / 10 ; 43 | ft_putnbr_fd(n, fd); 44 | write(fd, &num, 1); 45 | } 46 | else if (0 <= n && n <= 9) 47 | { 48 | n = n + '0'; 49 | write(fd, &n, 1); 50 | } 51 | else if (n < 0) 52 | { 53 | n = n * (-1); 54 | write(fd, "-", 1); 55 | ft_putnbr_fd(n, fd); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_substr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_substr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/12 19:22:03 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:58:46 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Allocates and returns a substring from the given string. 17 | * 18 | * @param s The string to extract the substring from. 19 | * @param start The starting index of the substring in the string. 20 | * @param len The maximum length of the substring. 21 | * 22 | * @return The newly allocated substring, or NULL if the allocation fails. 23 | */ 24 | char *ft_substr(char const *s, unsigned int start, size_t len) 25 | { 26 | char *sub; 27 | unsigned int i; 28 | unsigned int j; 29 | unsigned int k; 30 | 31 | i = 0; 32 | j = 0; 33 | if (start > ft_strlen(s)) 34 | start = ft_strlen(s); 35 | k = start; 36 | while (len && s[k++]) 37 | { 38 | i++; 39 | len--; 40 | } 41 | sub = malloc(sizeof(char) * i + 1); 42 | while (j < i) 43 | *(sub + j++) = *(s + start++); 44 | *(sub + i) = '\0'; 45 | return (sub); 46 | } 47 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 21:30:25 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:46:50 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Locate a substring in a string, where no more than len characters are 17 | * searched. 18 | * 19 | * @param const char *haystack: The string to be searched; 20 | * @param const char *needle: The substring to be searched for; 21 | * @param size_t len: The maximum number of characters to search. 22 | * 23 | * @return A pointer to the first occurrence of the substring needle in the 24 | * string haystack, or NULL if the substring is not found. 25 | */ 26 | char *ft_strnstr(const char *haystack, const char *needle, size_t len) 27 | { 28 | size_t i; 29 | char *h; 30 | 31 | i = 0; 32 | h = (char *) haystack; 33 | if (!ft_strlen(needle)) 34 | return (h); 35 | if (!len) 36 | return (0); 37 | while (i + ft_strlen(needle) <= len && h[i]) 38 | { 39 | if (!ft_strncmp(&h[i], needle, ft_strlen(needle))) 40 | return (&h[i]); 41 | i++; 42 | } 43 | return (0); 44 | } 45 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/29 20:25:05 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 17:13:18 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Append the null-terminated string src at the end of null-terminated 17 | * string dst. It will append at most dstsize - strlen(dst) - 1('\0') bytes. 18 | * 19 | * @param char *dst: Pointer to the destination string; 20 | * @param const char *src: Pointer to the source string; 21 | * @param size_t dstsize: Size of the destination buffer in bytes. 22 | * 23 | * @return Length of the string they tried to create. 24 | */ 25 | size_t ft_strlcat(char *dst, const char *src, size_t dstsize) 26 | { 27 | size_t index; 28 | size_t len_dst; 29 | size_t len_src; 30 | 31 | index = 0; 32 | len_dst = ft_strlen(dst); 33 | len_src = ft_strlen(src); 34 | if (dstsize < len_dst) 35 | return (len_src + dstsize); 36 | while (*(src + index) && index + 1 < (dstsize - len_dst)) 37 | { 38 | *(dst + len_dst + index) = *(src + index); 39 | index++; 40 | } 41 | *(dst + len_dst + index) = '\0'; 42 | return (len_dst + len_src); 43 | } 44 | -------------------------------------------------------------------------------- /TDD usando a libft/.devcontainer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | # Update this to the name of the service you want to work with in your docker-compose.yml file 4 | app: 5 | # If you want add a non-root user to your Dockerfile, you can use the "remoteUser" 6 | # property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks, 7 | # debugging) to execute as the user. Uncomment the next line if you want the entire 8 | # container to run as this user instead. Note that, on Linux, you may need to 9 | # ensure the UID and GID of the container user you create matches your local user. 10 | # See https://aka.ms/vscode-remote/containers/non-root for details. 11 | # 12 | # user: vscode 13 | 14 | # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer 15 | # folder. Note that the path of the Dockerfile and context is relative to the *primary* 16 | # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" 17 | # array). The sample below assumes your primary file is in the root of your project. 18 | # 19 | # build: 20 | # context: . 21 | # dockerfile: .devcontainer/Dockerfile 22 | 23 | volumes: 24 | # Update this to wherever you want VS Code to mount the folder of your project 25 | - .:/workspace:cached 26 | 27 | # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. 28 | # - /var/run/docker.sock:/var/run/docker.sock 29 | 30 | # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. 31 | # cap_add: 32 | # - SYS_PTRACE 33 | # security_opt: 34 | # - seccomp:unconfined 35 | 36 | # Overrides default command so things don't shut down after the process ends. 37 | command: /bin/sh -c "while sleep 1000; do :; done" 38 | 39 | -------------------------------------------------------------------------------- /docker-compose2/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose 3 | // If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. 4 | { 5 | "name": "DOJO", 6 | 7 | // Update the 'dockerComposeFile' list if you have more compose files or use different names. 8 | // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. 9 | "dockerComposeFile": [ 10 | "../docker-compose.yml", 11 | "docker-compose.yml" 12 | ], 13 | 14 | // The 'service' property is the name of the service for the container that VS Code should 15 | // use. Update this value and .devcontainer/docker-compose.yml to the real service name. 16 | "service": "dev", 17 | 18 | // The optional 'workspaceFolder' property is the path VS Code should open by default when 19 | // connected. This is typically a file mount in .devcontainer/docker-compose.yml 20 | "workspaceFolder": "/product", 21 | "customizations": { 22 | "vscode": { 23 | "extensions": [ 24 | 25 | ] 26 | } 27 | } 28 | 29 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 30 | // "forwardPorts": [], 31 | 32 | // Uncomment the next line if you want start specific services in your Docker Compose config. 33 | // "runServices": [], 34 | 35 | // Uncomment the next line if you want to keep your containers running after VS Code shuts down. 36 | // "shutdownAction": "none", 37 | 38 | // Uncomment the next line to run commands after the container is created - for example installing curl. 39 | // "postCreateCommand": "apt-get update && apt-get install -y curl", 40 | 41 | // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. 42 | // "remoteUser": "vscode" 43 | } 44 | -------------------------------------------------------------------------------- /docker-compose2/.devcontainer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | # Update this to the name of the service you want to work with in your docker-compose.yml file 4 | dev: 5 | # If you want add a non-root user to your Dockerfile, you can use the "remoteUser" 6 | # property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks, 7 | # debugging) to execute as the user. Uncomment the next line if you want the entire 8 | # container to run as this user instead. Note that, on Linux, you may need to 9 | # ensure the UID and GID of the container user you create matches your local user. 10 | # See https://aka.ms/vscode-remote/containers/windownon-root for details. 11 | # 12 | # user: vscode 13 | 14 | # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer 15 | # folder. Note that the path of the Dockerfile and context is relative to the *primary* 16 | # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" 17 | # array). The sample below assumes your primary file is in the root of your project. 18 | # 19 | # build: 20 | # context: . 21 | # dockerfile: .devcontainer/Dockerfile 22 | 23 | volumes: 24 | # Update this to wherever you want VS Code to mount the folder of your project 25 | - ./product:/workspace:cached 26 | 27 | # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. 28 | # - /var/run/docker.sock:/var/run/docker.sock 29 | 30 | # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. 31 | # cap_add: 32 | # - SYS_PTRACE 33 | # security_opt: 34 | # - seccomp:unconfined 35 | 36 | # Overrides default command so things don't shut down after the process ends. 37 | # command: /bin/sh -c "while sleep 1000; do :; done" 38 | 39 | -------------------------------------------------------------------------------- /Obsoleto/tdd_betty/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.so 6 | .Python 7 | build/ 8 | develop-eggs/ 9 | dist/ 10 | downloads/ 11 | eggs/ 12 | .eggs/ 13 | lib/ 14 | lib64/ 15 | parts/ 16 | sdist/ 17 | var/ 18 | wheels/ 19 | pip-wheel-metadata/ 20 | share/python-wheels/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | MANIFEST 25 | *.manifest 26 | *.spec 27 | pip-log.txt 28 | pip-delete-this-directory.txt 29 | htmlcov/ 30 | .tox/ 31 | .nox/ 32 | .coverage 33 | .coverage.* 34 | .cache 35 | nosetests.xml 36 | coverage.xml 37 | *.cover 38 | .hypothesis/ 39 | .pytest_cache/ 40 | *.mo 41 | *.pot 42 | *.log 43 | local_settings.py 44 | db.sqlite3 45 | instance/ 46 | .webassets-cache 47 | .scrapy 48 | docs/_build/ 49 | target/ 50 | .ipynb_checkpoints 51 | profile_default/ 52 | ipython_config.py 53 | .python-version 54 | celerybeat-schedule 55 | *.sage.py 56 | .env 57 | .venv 58 | env/ 59 | venv/ 60 | ENV/ 61 | env.bak/ 62 | venv.bak/ 63 | .spyderproject 64 | .spyproject 65 | .ropeproject 66 | /site 67 | .mypy_cache/ 68 | .dmypy.json 69 | dmypy.json 70 | .pyre/ 71 | .idea 72 | .idea/**/tasks.xml 73 | .idea/**/usage.statistics.xml 74 | .idea/**/dictionaries 75 | .idea/**/shelf 76 | .idea/**/contentModel.xml 77 | .idea/**/dataSources/ 78 | .idea/**/dataSources.ids 79 | .idea/**/dataSources.local.xml 80 | .idea/**/sqlDataSources.xml 81 | .idea/**/dynamic.xml 82 | .idea/**/uiDesigner.xml 83 | .idea/**/dbnavigator.xml 84 | .idea/**/gradle.xml 85 | .idea/**/libraries 86 | cmake-build-*/ 87 | .idea/**/mongoSettings.xml 88 | *.iws 89 | out/ 90 | .idea_modules/ 91 | atlassian-ide-plugin.xml 92 | .idea/replstate.xml 93 | com_crashlytics_export_strings.xml 94 | crashlytics.properties 95 | crashlytics-build.properties 96 | fabric.properties 97 | .idea/httpRequests 98 | .idea/caches/build_file_checksums.ser 99 | */_trial_temp 100 | -------------------------------------------------------------------------------- /Obsoleto/tdd_palavra/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.so 6 | .Python 7 | build/ 8 | develop-eggs/ 9 | dist/ 10 | downloads/ 11 | eggs/ 12 | .eggs/ 13 | lib/ 14 | lib64/ 15 | parts/ 16 | sdist/ 17 | var/ 18 | wheels/ 19 | pip-wheel-metadata/ 20 | share/python-wheels/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | MANIFEST 25 | *.manifest 26 | *.spec 27 | pip-log.txt 28 | pip-delete-this-directory.txt 29 | htmlcov/ 30 | .tox/ 31 | .nox/ 32 | .coverage 33 | .coverage.* 34 | .cache 35 | nosetests.xml 36 | coverage.xml 37 | *.cover 38 | .hypothesis/ 39 | .pytest_cache/ 40 | *.mo 41 | *.pot 42 | *.log 43 | local_settings.py 44 | db.sqlite3 45 | instance/ 46 | .webassets-cache 47 | .scrapy 48 | docs/_build/ 49 | target/ 50 | .ipynb_checkpoints 51 | profile_default/ 52 | ipython_config.py 53 | .python-version 54 | celerybeat-schedule 55 | *.sage.py 56 | .env 57 | .venv 58 | env/ 59 | venv/ 60 | ENV/ 61 | env.bak/ 62 | venv.bak/ 63 | .spyderproject 64 | .spyproject 65 | .ropeproject 66 | /site 67 | .mypy_cache/ 68 | .dmypy.json 69 | dmypy.json 70 | .pyre/ 71 | .idea 72 | .idea/**/tasks.xml 73 | .idea/**/usage.statistics.xml 74 | .idea/**/dictionaries 75 | .idea/**/shelf 76 | .idea/**/contentModel.xml 77 | .idea/**/dataSources/ 78 | .idea/**/dataSources.ids 79 | .idea/**/dataSources.local.xml 80 | .idea/**/sqlDataSources.xml 81 | .idea/**/dynamic.xml 82 | .idea/**/uiDesigner.xml 83 | .idea/**/dbnavigator.xml 84 | .idea/**/gradle.xml 85 | .idea/**/libraries 86 | cmake-build-*/ 87 | .idea/**/mongoSettings.xml 88 | *.iws 89 | out/ 90 | .idea_modules/ 91 | atlassian-ide-plugin.xml 92 | .idea/replstate.xml 93 | com_crashlytics_export_strings.xml 94 | crashlytics.properties 95 | crashlytics-build.properties 96 | fabric.properties 97 | .idea/httpRequests 98 | .idea/caches/build_file_checksums.ser 99 | */_trial_temp 100 | -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/Assets/css/variables.css: -------------------------------------------------------------------------------- 1 | /* Crie outro arquivo css e linke ele ao seu projeto, esse arquivo é apenas para a importação de estilos ao projeto*/ 2 | 3 | :root { 4 | /* Da mais clara (primária) para a mais escura (secundária, terciária etc) : Chame-as no seu codigo conforme a necessidade! */ 5 | --corFocinho: #FFFFFF; 6 | --corNariz: #D5E0E4; 7 | --corOlhos: #54221C; 8 | 9 | --corPrimariaPelagem: #FCAD3B; 10 | --corSecundariaPelagem: #F78A1D; 11 | } 12 | 13 | /* CSS RESET: REMOVENDO TODOS OS ESTILOS PADRÃO 14 | SAIBA MAIS EM: https://www.alura.com.br/artigos/o-que-e-reset-css 15 | */ 16 | html, body, div, span, applet, object, iframe, 17 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 18 | a, abbr, acronym, address, big, cite, code, 19 | del, dfn, em, img, ins, kbd, q, s, samp, 20 | small, strike, strong, sub, sup, tt, var, 21 | b, u, i, center, 22 | dl, dt, dd, ol, ul, li, 23 | fieldset, form, label, legend, 24 | table, caption, tbody, tfoot, thead, tr, th, td, 25 | article, aside, canvas, details, embed, 26 | figure, figcaption, footer, header, hgroup, 27 | menu, nav, output, ruby, section, summary, 28 | time, mark, audio, video { 29 | margin: 0; 30 | padding: 0; 31 | border: 0; 32 | font-size: 100%; 33 | font: inherit; 34 | vertical-align: baseline; 35 | } 36 | 37 | /* RESETANDO PAPÉIS DE EXIBIÇÃO DO HTML5 PARA NAVEGADORES MAIS ANTIGOS */ 38 | article, aside, details, figcaption, figure, 39 | footer, header, hgroup, menu, nav, section { 40 | display: block; 41 | } 42 | 43 | body { 44 | line-height: 1; 45 | } 46 | 47 | ol, ul { 48 | list-style: none; 49 | } 50 | 51 | blockquote, q { 52 | quotes: none; 53 | } 54 | 55 | blockquote:before, blockquote:after, 56 | q:before, q:after { 57 | content: ''; 58 | content: none; 59 | } 60 | 61 | table { 62 | border-collapse: collapse; 63 | border-spacing: 0; 64 | } 65 | -------------------------------------------------------------------------------- /Obsoleto/tcr_quarenta_e_duolingo/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.so 6 | .Python 7 | build/ 8 | develop-eggs/ 9 | dist/ 10 | downloads/ 11 | eggs/ 12 | .eggs/ 13 | lib/ 14 | lib64/ 15 | parts/ 16 | sdist/ 17 | var/ 18 | wheels/ 19 | pip-wheel-metadata/ 20 | share/python-wheels/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | MANIFEST 25 | *.manifest 26 | *.spec 27 | pip-log.txt 28 | pip-delete-this-directory.txt 29 | htmlcov/ 30 | .tox/ 31 | .nox/ 32 | .coverage 33 | .coverage.* 34 | .cache 35 | nosetests.xml 36 | coverage.xml 37 | *.cover 38 | .hypothesis/ 39 | .pytest_cache/ 40 | *.mo 41 | *.pot 42 | *.log 43 | local_settings.py 44 | db.sqlite3 45 | instance/ 46 | .webassets-cache 47 | .scrapy 48 | docs/_build/ 49 | target/ 50 | .ipynb_checkpoints 51 | profile_default/ 52 | ipython_config.py 53 | .python-version 54 | celerybeat-schedule 55 | *.sage.py 56 | .env 57 | .venv 58 | env/ 59 | venv/ 60 | ENV/ 61 | env.bak/ 62 | venv.bak/ 63 | .spyderproject 64 | .spyproject 65 | .ropeproject 66 | /site 67 | .mypy_cache/ 68 | .dmypy.json 69 | dmypy.json 70 | .pyre/ 71 | .idea 72 | .idea/**/tasks.xml 73 | .idea/**/usage.statistics.xml 74 | .idea/**/dictionaries 75 | .idea/**/shelf 76 | .idea/**/contentModel.xml 77 | .idea/**/dataSources/ 78 | .idea/**/dataSources.ids 79 | .idea/**/dataSources.local.xml 80 | .idea/**/sqlDataSources.xml 81 | .idea/**/dynamic.xml 82 | .idea/**/uiDesigner.xml 83 | .idea/**/dbnavigator.xml 84 | .idea/**/gradle.xml 85 | .idea/**/libraries 86 | cmake-build-*/ 87 | .idea/**/mongoSettings.xml 88 | *.iws 89 | out/ 90 | .idea_modules/ 91 | atlassian-ide-plugin.xml 92 | .idea/replstate.xml 93 | com_crashlytics_export_strings.xml 94 | crashlytics.properties 95 | crashlytics-build.properties 96 | fabric.properties 97 | .idea/httpRequests 98 | .idea/caches/build_file_checksums.ser 99 | */_trial_temp 100 | -------------------------------------------------------------------------------- /Obsoleto/tdd_jokenpo_diferentao/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | *.so 6 | .Python 7 | build/ 8 | develop-eggs/ 9 | dist/ 10 | downloads/ 11 | eggs/ 12 | .eggs/ 13 | lib/ 14 | lib64/ 15 | parts/ 16 | sdist/ 17 | var/ 18 | wheels/ 19 | pip-wheel-metadata/ 20 | share/python-wheels/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | MANIFEST 25 | *.manifest 26 | *.spec 27 | pip-log.txt 28 | pip-delete-this-directory.txt 29 | htmlcov/ 30 | .tox/ 31 | .nox/ 32 | .coverage 33 | .coverage.* 34 | .cache 35 | nosetests.xml 36 | coverage.xml 37 | *.cover 38 | .hypothesis/ 39 | .pytest_cache/ 40 | *.mo 41 | *.pot 42 | *.log 43 | local_settings.py 44 | db.sqlite3 45 | instance/ 46 | .webassets-cache 47 | .scrapy 48 | docs/_build/ 49 | target/ 50 | .ipynb_checkpoints 51 | profile_default/ 52 | ipython_config.py 53 | .python-version 54 | celerybeat-schedule 55 | *.sage.py 56 | .env 57 | .venv 58 | env/ 59 | venv/ 60 | ENV/ 61 | env.bak/ 62 | venv.bak/ 63 | .spyderproject 64 | .spyproject 65 | .ropeproject 66 | /site 67 | .mypy_cache/ 68 | .dmypy.json 69 | dmypy.json 70 | .pyre/ 71 | .idea 72 | .idea/**/tasks.xml 73 | .idea/**/usage.statistics.xml 74 | .idea/**/dictionaries 75 | .idea/**/shelf 76 | .idea/**/contentModel.xml 77 | .idea/**/dataSources/ 78 | .idea/**/dataSources.ids 79 | .idea/**/dataSources.local.xml 80 | .idea/**/sqlDataSources.xml 81 | .idea/**/dynamic.xml 82 | .idea/**/uiDesigner.xml 83 | .idea/**/dbnavigator.xml 84 | .idea/**/gradle.xml 85 | .idea/**/libraries 86 | cmake-build-*/ 87 | .idea/**/mongoSettings.xml 88 | *.iws 89 | out/ 90 | .idea_modules/ 91 | atlassian-ide-plugin.xml 92 | .idea/replstate.xml 93 | com_crashlytics_export_strings.xml 94 | crashlytics.properties 95 | crashlytics-build.properties 96 | fabric.properties 97 | .idea/httpRequests 98 | .idea/caches/build_file_checksums.ser 99 | */_trial_temp 100 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_putnbr_hex.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_hex.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/30 19:01:16 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 15:54:49 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libput.h" 14 | #define HEX_LOWER "0123456789abcdef" 15 | #define HEX_UPPER "0123456789ABCDEF" 16 | 17 | static int last_write(int n, char option) 18 | { 19 | int sub_print_len; 20 | 21 | sub_print_len = 0; 22 | if (0 <= n && n <= 9) 23 | { 24 | n += '0'; 25 | sub_print_len += write(1, &n, 1); 26 | } 27 | else if (n >= 10 && option == 'l') 28 | { 29 | n += 'W'; 30 | sub_print_len += write(1, &n, 1); 31 | } 32 | else if (n >= 10 && option == 'u') 33 | { 34 | n += '7'; 35 | sub_print_len += write(1, &n, 1); 36 | } 37 | return (sub_print_len); 38 | } 39 | 40 | int ft_putnbr_hex(unsigned long long n, char option) 41 | { 42 | char num; 43 | int print_len; 44 | 45 | num = 0; 46 | print_len = 0; 47 | if (n >= 16) 48 | { 49 | if (option == 'l') 50 | num = HEX_LOWER[n % 16]; 51 | else if (option == 'u') 52 | num = HEX_UPPER[n % 16]; 53 | n /= 16; 54 | print_len += ft_putnbr_hex(n, option); 55 | print_len += write(1, &num, 1); 56 | } 57 | else if (n <= 16) 58 | print_len += last_write(n, option); 59 | return (print_len); 60 | } 61 | -------------------------------------------------------------------------------- /TDD usando a libft/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose 3 | // If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. 4 | { 5 | "name": "Existing Docker Compose (Extend)", 6 | 7 | // Update the 'dockerComposeFile' list if you have more compose files or use different names. 8 | // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. 9 | "dockerComposeFile": [ 10 | "../docker-compose.yml", 11 | "docker-compose.yml" 12 | ], 13 | 14 | // The 'service' property is the name of the service for the container that VS Code should 15 | // use. Update this value and .devcontainer/docker-compose.yml to the real service name. 16 | "service": "app", 17 | 18 | // The optional 'workspaceFolder' property is the path VS Code should open by default when 19 | // connected. This is typically a file mount in .devcontainer/docker-compose.yml 20 | "workspaceFolder": "/workspace", 21 | "customizations": { 22 | "vscode": { 23 | "extensions": [ 24 | "ms-vscode.cpptools-extension-pack", 25 | "kube.42header" 26 | ] 27 | } 28 | } 29 | 30 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 31 | // "forwardPorts": [], 32 | 33 | // Uncomment the next line if you want start specific services in your Docker Compose config. 34 | // "runServices": [], 35 | 36 | // Uncomment the next line if you want to keep your containers running after VS Code shuts down. 37 | // "shutdownAction": "none", 38 | 39 | // Uncomment the next line to run commands after the container is created - for example installing curl. 40 | // "postCreateCommand": "apt-get update && apt-get install -y curl", 41 | 42 | // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. 43 | // "remoteUser": "vscode" 44 | } 45 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_atoi_hex.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_atoi_hex.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/11/04 13:42:36 by etachott #+# #+# */ 9 | /* Updated: 2023/03/16 12:20:04 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | * Convert a string representation of a hexadecimal number to an integer. 17 | * NOTE: If the input string is greater than MAX_INT, it WILL overflow. 18 | * 19 | * @param char *str: Pointer to a string. 20 | * 21 | * @return int result: A integer that corresponds to the converted string. 22 | */ 23 | int ft_atoi_hex(const char *str) 24 | { 25 | int index; 26 | int is_negative; 27 | int result; 28 | 29 | index = 0; 30 | is_negative = 1; 31 | result = 0; 32 | while (str[index] == ' ' || str[index] == '\t' || str[index] == '\n' 33 | || str[index] == '\v' || str[index] == '\f' || str[index] == '\r') 34 | index++; 35 | while (str[index]) 36 | { 37 | if (str[index] >= '0' && str[index] <= '9') 38 | result = result * 16 + str[index] - '0'; 39 | else if (str[index] >= 'A' && str[index] <= 'F') 40 | result = result * 16 + str[index] - 'A' + 10; 41 | else if (str[index] >= 'a' && str[index] <= 'f') 42 | result = result * 16 + str[index] - 'a' + 10; 43 | else 44 | return (result * is_negative); 45 | index++; 46 | } 47 | return (result * is_negative); 48 | } 49 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_itoa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_itoa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: etachott +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/11 15:15:34 by etachott #+# #+# */ 9 | /* Updated: 2023/03/16 14:48:09 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | static void fill_recursively(char *str, long int n) 16 | { 17 | size_t num; 18 | 19 | num = 0; 20 | if (n >= 10) 21 | { 22 | num = (n % 10) + '0'; 23 | n = n / 10; 24 | fill_recursively(str - 1, n); 25 | *str = num; 26 | } 27 | else if (0 <= n && n <= 9) 28 | { 29 | n = n + '0'; 30 | *str = n; 31 | } 32 | } 33 | 34 | static size_t get_digits(int n) 35 | { 36 | size_t i; 37 | 38 | i = 0; 39 | if (n <= 0) 40 | i++; 41 | while (n != 0) 42 | { 43 | n = n / 10; 44 | i++; 45 | } 46 | return (i); 47 | } 48 | 49 | /* 50 | * Convert an integer to string and return it. It allocates the size of the 51 | * number and then insterts the number recursively in the string. 52 | * 53 | * @param int n: Integer to be converted. 54 | * 55 | * @return char *str: String containg the number converted. 56 | */ 57 | char *ft_itoa(int n) 58 | { 59 | char *str; 60 | size_t i; 61 | long int j; 62 | 63 | i = get_digits(n); 64 | str = malloc(sizeof(char) * i + 1); 65 | if (n < 0) 66 | { 67 | j = n; 68 | *str = '-'; 69 | fill_recursively(str + i - 1, j * -1); 70 | } 71 | else 72 | fill_recursively(str + (i - 1), n); 73 | *(str + i) = '\0'; 74 | return (str); 75 | } 76 | -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/Assets/css/variables.css: -------------------------------------------------------------------------------- 1 | /* Crie outro arquivo css e linke ele ao seu projeto, esse arquivo é apenas para a importação de estilos ao projeto*/ 2 | 3 | :root { 4 | /* Da mais clara (primária) para a mais escura (secundária, terciária etc) : Chame-as no seu codigo conforme a necessidade! */ 5 | --corPrincipalBico: #FFCF01; 6 | --corSecundariaBico: #FFA300; 7 | --corTerciariaBico: #D86802; 8 | 9 | --corGalho: #E18541; 10 | 11 | --corPlumaPrimaria: #FFFFFF; 12 | --corPlumaSecundaria: #D5E0E4; 13 | --corPlumaTerciaria: #364542; 14 | 15 | --corIrisPrimaria: #459DE5; 16 | --corRaboPrimaria: #459DE5; /* Similar à da Iris */ 17 | --corRaboSecundaria: #2C73CB; 18 | } 19 | 20 | /* CSS RESET: REMOVENDO TODOS OS ESTILOS PADRÃO 21 | SAIBA MAIS EM: https://www.alura.com.br/artigos/o-que-e-reset-css 22 | */ 23 | html, body, div, span, applet, object, iframe, 24 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 25 | a, abbr, acronym, address, big, cite, code, 26 | del, dfn, em, img, ins, kbd, q, s, samp, 27 | small, strike, strong, sub, sup, tt, var, 28 | b, u, i, center, 29 | dl, dt, dd, ol, ul, li, 30 | fieldset, form, label, legend, 31 | table, caption, tbody, tfoot, thead, tr, th, td, 32 | article, aside, canvas, details, embed, 33 | figure, figcaption, footer, header, hgroup, 34 | menu, nav, output, ruby, section, summary, 35 | time, mark, audio, video { 36 | margin: 0; 37 | padding: 0; 38 | border: 0; 39 | font-size: 100%; 40 | font: inherit; 41 | vertical-align: baseline; 42 | } 43 | 44 | /* RESETANDO PAPÉIS DE EXIBIÇÃO DO HTML5 PARA NAVEGADORES MAIS ANTIGOS */ 45 | article, aside, details, figcaption, figure, 46 | footer, header, hgroup, menu, nav, section { 47 | display: block; 48 | } 49 | 50 | body { 51 | line-height: 1; 52 | } 53 | 54 | ol, ul { 55 | list-style: none; 56 | } 57 | 58 | blockquote, q { 59 | quotes: none; 60 | } 61 | 62 | blockquote:before, blockquote:after, 63 | q:before, q:after { 64 | content: ''; 65 | content: none; 66 | } 67 | 68 | table { 69 | border-collapse: collapse; 70 | border-spacing: 0; 71 | } 72 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_printf.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 12:27:56 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 15:52:55 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | #include "libput.h" 15 | 16 | static int print_formats(va_list ap, const char fmt) 17 | { 18 | int len; 19 | 20 | len = 0; 21 | if (fmt == '%') 22 | len += ft_putchar('%'); 23 | else if (fmt == 'c') 24 | len += ft_putchar((char) va_arg(ap, int)); 25 | else if (fmt == 's') 26 | len += ft_putstr(va_arg(ap, char *)); 27 | else if (fmt == 'd') 28 | len += ft_putnbr(va_arg(ap, int)); 29 | else if (fmt == 'i') 30 | len += ft_putnbr(va_arg(ap, int)); 31 | else if (fmt == 'u') 32 | len += ft_putnbr(va_arg(ap, unsigned int)); 33 | else if (fmt == 'p') 34 | len += print_pointer(va_arg(ap, unsigned long int)); 35 | else if (fmt == 'x') 36 | len += ft_putnbr_hex(va_arg(ap, unsigned int), 'l'); 37 | else if (fmt == 'X') 38 | len += ft_putnbr_hex(va_arg(ap, unsigned int), 'u'); 39 | return (len); 40 | } 41 | 42 | int ft_printf(const char *fmt, ...) 43 | { 44 | va_list ap; 45 | int len; 46 | 47 | len = 0; 48 | if (!fmt) 49 | return (-1); 50 | va_start(ap, fmt); 51 | while (*fmt) 52 | { 53 | if (*fmt == '%') 54 | { 55 | fmt++; 56 | len += print_formats(ap, *fmt); 57 | } 58 | else 59 | len += ft_putchar(*fmt); 60 | fmt++; 61 | } 62 | va_end(ap); 63 | return (len); 64 | } 65 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/ft_printfsources/ft_print.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_print.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/27 12:27:56 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 22:27:21 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | #include "libput.h" 15 | 16 | static int print_formats(va_list ap, const char fmt) 17 | { 18 | int len; 19 | 20 | len = 0; 21 | if (fmt == '%') 22 | len += ft_putchar('%'); 23 | else if (fmt == 'c') 24 | len += ft_putchar((char) va_arg(ap, int)); 25 | else if (fmt == 's') 26 | len += ft_putstr(va_arg(ap, char *)); 27 | else if (fmt == 'd') 28 | len += ft_putnbr(va_arg(ap, int)); 29 | else if (fmt == 'i') 30 | len += ft_putnbr(va_arg(ap, int)); 31 | else if (fmt == 'u') 32 | len += ft_putnbr(va_arg(ap, unsigned int)); 33 | else if (fmt == 'p') 34 | len += print_pointer(va_arg(ap, unsigned long int)); 35 | else if (fmt == 'x') 36 | len += ft_putnbr_hex(va_arg(ap, unsigned int), 'l'); 37 | else if (fmt == 'X') 38 | len += ft_putnbr_hex(va_arg(ap, unsigned int), 'u'); 39 | return (len); 40 | } 41 | 42 | int ft_print(const char *fmt, ...) 43 | { 44 | va_list ap; 45 | int len; 46 | 47 | len = 0; 48 | if (!fmt) 49 | return (-1); 50 | va_start(ap, fmt); 51 | while (*fmt) 52 | { 53 | if (*fmt == '%') 54 | { 55 | fmt++; 56 | len += print_formats(ap, *fmt); 57 | } 58 | else 59 | len += ft_putchar(*fmt); 60 | fmt++; 61 | } 62 | len += ft_putchar('\n'); 63 | va_end(ap); 64 | return (len); 65 | } 66 | -------------------------------------------------------------------------------- /docker-compose/Dojo de docker-compose.md: -------------------------------------------------------------------------------- 1 | 2 | > 📋 Resumo do desafio: subir usando `docker-compose` um conteiner com o `minishell` e fazer com sucesso um `ping` em uma página de um conteiner que tenha o nginx rodando 3 | 4 | ## Mddceu, quanta coisa! 5 | 6 | Se o resumo te abalou, calma... respira! Como `docker-compose` pressupõe antes ter usado `docker`, esse Dojo ficou um pouquiiiinho mais complicado. Se você não conseguir rodar todas as partes, tá suave. Com certeza você vai aprender bastante sobre `docker` mesmo assim. 👊🏾 7 | 8 | Maaaaaas, o começo do desafio vai ser justamente rodar a primeira parte de outros 2 dojos que usam `docker`. Quer ver? Se liga... 9 | 10 | ## O desafio 11 | 12 | O desafio está composto de 3 partes. 13 | 14 | ### 🐋 Primeira parte: dockerizando o `minishell 15 | 16 | Para dockerizar o `minishell`, na real, você terá que fazer a o desafio do nosso belíssimo [Dojo de Docker](https://github.com/42sp/dojos/blob/main/Docker/%F0%9F%90%8B%20Dojo%20de%20Docker.md). 17 | 18 | *obs: nem se preocupa com o bônus, ok? teoricamente é pra ser um desafio até que rápido, hehe.* 19 | 20 | *obs²: Como essa não é a parte principal do Dojo, se estiver demorando muito pra fazer você pode só usar uma imagem pronta de algum `minishell`, tipo [essa](docker pull edudocerrado/dockershell) (thx, edu!).* 21 | 22 | ### 🌐 Segunda parte: dockerizando o `nginx` 23 | 24 | Para dockerizar o `nginx`, ou até mesmo para saber o que é nginx, você vai rodar a **primeira parte** (E SOMENTE A PRIMEIRA PARTE) do nosso belíssimo [Dojo de Nginx e Webserv](https://github.com/42sp/dojos/tree/main/Nginx%20-%20Webserv#dojo-de-nginx-e-webserv). 25 | 26 | *obs: se você já tiver isso rodando em algum canto, pode usar o que já tá rodando mesmo (mas vê se tá funfando certin, hein) e pular para a terceira parte.* 😉 27 | 28 | ### 🐋🐋 Terceira parte: agora sim o `docker-compose` 29 | 30 | Nesta terceira parte vem o desafio de verdade! Seguinte... 31 | 32 | Usando `docker-compose` você terá que subir o conteiner do `minishell` e o conteiner do `nginx` dos passos anteriores desse desafio. 33 | 34 | Tudo deve subir com um simples `docker-compose up` 35 | 36 | De dentro do `minishell` você terá que fazer um `curl` para a página que está hospedada no conteiner do `nginx`. 37 | 38 | Bora? 😜 -------------------------------------------------------------------------------- /Algoritmos/Romanos/README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Quem tem boca vai a roma ou quem tem boca vaia roma? 4 |

5 | 6 | >XXX não é nada proibido não, é 30! 7 | 8 | ## 💫 Introdução 9 | 10 | Este é mais um desafio da série "bora implementar algoritmos"! 😛 11 | 12 | A ideia central dessa série de Dojos é preparar as pessoas que participam para conseguirem resolver problemas rapidamente e estarem prontas para entrevistas com esse tipo de desafio. 😜 13 | 14 | **Ele pode ser resolvido na linguagem de preferência do grupo.** 15 | 16 | ## 🤚🏽 Mas antes... 17 | 18 | Quer fazer no nível "hard"? Faz com teste! É altamente recomendável utilizar TDD neste desafio. Se vocês preferirem ignorar essa recomendação, além de deixar de praticar testes automatizados, provavelmente ao final do desafio também não terão certeza de que ele funciona como deveria. 😄 19 | 20 | ## 🚀Agora sim, vamos ao desafio! 21 | 22 | > **O desafio é simples: Converter números romanos.** 23 | 24 | O primeiro nível do desafio é você conseguir receber um número romano e devolver o inteiro equivalente. 25 | 26 | O segundo nível do desafio é você conseguir receber um número inteiro e devolver o equivalente em romanos. 27 | 28 | ;) 29 | 30 | - ## 💖 Umas coisitas a mais pra aquietar seu coração 31 | 32 | - Se preocupe com validar a entrada somente depois de o "core" estar funcionando (afinal, isso é um Dojo, não um projeto da 42, haha) 33 | 34 | - O desafio pode ser resolvido em qualquer linguagem 35 | 36 | - Se for usar C, tem um esqueleto de projeto já com testes [aqui](https://github.com/42sp/dojos/tree/main/TDD%20usando%20a%20libft) 37 | 38 | - Se for usar Python, tem um esqueleto de projeto já com testes [aqui](https://github.com/tiolula/dojos/tree/main/tdd_jokenpo_diferentao) 39 | 40 | - Se te der na telha fazer em Ruby, tem um esqueleto de projeto já com testes [aqui](https://github.com/tiolula/dojos/tree/main/tdd_ruby) 41 | ## Dica de ouro! ✨ 42 | 43 | - Baby Steps e TDD vão te ajudar muito. Sério! 👶🏾🍼 44 | 45 | ## 🙏🏾 Créditos 46 | 47 | A base deste desafio foi retirada da leetcode.com, traduzido para português e colocado numa linguagem mais 42SP. 😛 48 | 49 | Você encontra o original e muitos outros [aqui](https://leetcode.com/problems/roman-to-integer/) 50 | 51 | Obrigado, leetcode! 52 | -------------------------------------------------------------------------------- /Algoritmos/Números Romanos/README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Quem tem boca vai a roma ou quem tem boca vaia roma? 4 |

5 | 6 | >XXX não é nada proibido não, é 30! 7 | 8 | ## 💫 Introdução 9 | 10 | Este é mais um desafio da série "bora implementar algoritmos"! 😛 11 | 12 | A ideia central dessa série de Dojos é preparar as pessoas que participam para conseguirem resolver problemas rapidamente e estarem prontas para entrevistas com esse tipo de desafio. 😜 13 | 14 | **Ele pode ser resolvido na linguagem de preferência do grupo.** 15 | 16 | ## 🤚🏽 Mas antes... 17 | 18 | Quer fazer no nível "hard"? Faz com teste! É altamente recomendável utilizar TDD neste desafio. Se vocês preferirem ignorar essa recomendação, além de deixar de praticar testes automatizados, provavelmente ao final do desafio também não terão certeza de que ele funciona como deveria. 😄 19 | 20 | ## 🚀Agora sim, vamos ao desafio! 21 | 22 | > **O desafio é simples: Converter números romanos.** 23 | 24 | O primeiro nível do desafio é você conseguir receber um número romano e devolver o inteiro equivalente. 25 | 26 | O segundo nível do desafio é você conseguir receber um número inteiro e devolver o equivalente em romanos. 27 | 28 | ;) 29 | 30 | - ## 💖 Umas coisitas a mais pra aquietar seu coração 31 | 32 | - Se preocupe com validar a entrada somente depois de o "core" estar funcionando (afinal, isso é um Dojo, não um projeto da 42, haha) 33 | 34 | - O desafio pode ser resolvido em qualquer linguagem 35 | 36 | - Se for usar C, tem um esqueleto de projeto já com testes [aqui](https://github.com/42sp/dojos/tree/main/TDD%20usando%20a%20libft) 37 | 38 | - Se for usar Python, tem um esqueleto de projeto já com testes [aqui](https://github.com/tiolula/dojos/tree/main/tdd_jokenpo_diferentao) 39 | 40 | - Se te der na telha fazer em Ruby, tem um esqueleto de projeto já com testes [aqui](https://github.com/tiolula/dojos/tree/main/tdd_ruby) 41 | ## Dica de ouro! ✨ 42 | 43 | - Baby Steps e TDD vão te ajudar muito. Sério! 👶🏾🍼 44 | 45 | ## 🙏🏾 Créditos 46 | 47 | A base deste desafio foi retirada da leetcode.com, traduzido para português e colocado numa linguagem mais 42SP. 😛 48 | 49 | Você encontra o original e muitos outros [aqui](https://leetcode.com/problems/roman-to-integer/) 50 | 51 | Obrigado, leetcode! -------------------------------------------------------------------------------- /GDB e Valgrind/libft/libsources/ft_split.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_split.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/12 20:38:43 by coder #+# #+# */ 9 | /* Updated: 2023/03/16 16:00:20 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | static size_t get_word_quantity(char const *s, char c) 16 | { 17 | size_t i; 18 | size_t j; 19 | 20 | i = 0; 21 | j = 0; 22 | while (*(s + j)) 23 | { 24 | if (*(s + j) != c) 25 | i++; 26 | while (*(s + j) != c && *(s + j)) 27 | j++; 28 | while (*(s + j) == c && *(s + j)) 29 | j++; 30 | } 31 | return (i); 32 | } 33 | 34 | static size_t get_word_length(char const *s, char c) 35 | { 36 | size_t i; 37 | 38 | i = 0; 39 | while (s[i] != c && s[i]) 40 | i++; 41 | return (i); 42 | } 43 | 44 | /* 45 | * Split a string s in a matrix of strings using character c as delimiter. 46 | * 47 | * @param char const *s: The string to be split; 48 | * @param char c: The caracter used as delimiter. 49 | * 50 | * @return char **matrix: Matrix containing the splitted string. 51 | * Each element of the matrix is a string. 52 | */ 53 | char **ft_split(char const *s, char c) 54 | { 55 | size_t word_quantity; 56 | size_t index; 57 | char **matrix; 58 | 59 | index = 0; 60 | word_quantity = get_word_quantity(s, c); 61 | matrix = (char **) ft_calloc(word_quantity + 1, sizeof(char *)); 62 | while (*s) 63 | { 64 | if (*s != c) 65 | { 66 | matrix[index] = ft_substr(s, 0, get_word_length(s, c)); 67 | s++; 68 | index++; 69 | } 70 | while (*s != c && *s) 71 | s++; 72 | while (*s == c && *s) 73 | s++; 74 | } 75 | return (matrix); 76 | } 77 | -------------------------------------------------------------------------------- /The baby steps game/The Baby Steps Game 🍼.md: -------------------------------------------------------------------------------- 1 | 2 | # The Baby Steps Game 🍼 3 | 4 | > 📋 Resumo do desafio: Usando TDD, vocês resolverão um problema com código. A cada teste que falhe por conta da função não estar preparada ainda para lidar com aquele cenário, o time ganha 1 ponto. Cada vez que os testes estiverem passando e o time lembrar de fazer melhorias antes de escrever o próximo teste, o time ganha meio ponto. 5 | 6 | ## O desafio 🎯 7 | 8 | O problema a ser resolvido no desafio é simples: faça uma função que receba um texto e que retorne num array ordenado as 3 palavras mais utilizadas no texto. 9 | 10 | Qualquer carácter que não seja número, letra ou hífen é considerado como separador de palavras. Só devem ser consideradas palavras com três letras ou mais. 11 | 12 | ### Onde realmente mora o desafio: gamificando o rolê 🎰 13 | 14 | Para resolver o desafio o grupo deverá utilizar TDD, de uma forma bem estrita: 15 | 16 | 1. 🔴 **Buscando o vermelho**: Primeiro escreve-se um teste para o qual o código de negócio ainda não está preparado. O teste deve ser **sempre** de um cenário de negócio válido. Do contrário ele será considerado fraude. Nesta etapa é proibido mexer no código de negócio. 17 | 2. 🟢 **Buscando o verde**: Estando no vermelho, busca-se resolver da forma mais simples possível o problema apontado pelo teste. Nesta etapa só se pode tocar no código de negócio. Caso perceba-se que o teste está inconsistente ou é uma fraude, dê rollback nas modificações feitas no código de negócio até o início deste passo e volte ao passo 1. 18 | 3. 🟢 **Melhorando o código:** Estando no verde, busca-se melhorar o código, tanto de negócios quanto de teste. Nesta etapa não deve-se escrever novos testes e nem mesmo novas features no código de negócio. 19 | 4. Tendo melhorado o código, volta-se ao passo 1. 20 | 21 | ### Pontuação 🧮 22 | 23 | Cada time será responsável por contabilizar seus pontos de acordo com as seguintes regras: 24 | 25 | - Cada vez que chegar ao fim do passo 1 (encontrar o 🔴) o time ganha 1 ponto. 26 | - Cada vez que não pular o passo 3, o time ganha meio ponto 27 | - Caso se perca no fluxo, o time não deve contabilizar pontos até conseguir retornar à sequência de etapas proposta (🔴 > 🟢 > 🟢) 28 | 29 | QUE COMECEM OS JOGOS! 🙌🏾 30 | 31 | # Score Board 32 | 33 | Aqui você encontra as pontuações históricas deste jogo em desafios oficiais da 42 São Paulo. 34 | 35 | `Fake Natties -> 1 ponto` 36 | -------------------------------------------------------------------------------- /CI com Github Actions/✅ Dojo de CI com Github Actions.md: -------------------------------------------------------------------------------- 1 | 2 | > 📋 Resumo do desafio: Em grupos de pelo menos 3 pessoas, escolha um repositório de um projeto da 42 de um dos membros do time e configure o Github Actions para rodar automaticamente a cada push na `main` a sequência de passos `Norminette`, `Build`, `Tests` e `Valgrind` 3 | 4 | ## O desafio 5 | 6 | O desafio aqui é a configuração de um Pipeline usando Github Actions. Esse Pipeline pode ser construído em cima de qualquer projeto da 42 de qualquer pessoa que faça parte do grupo do Dojo. Projetos mais complexos são mais "divertidos" para o Dojo. 7 | 8 | Se uma etapa do Pipeline não passar, a seguinte não deve ser executada, de acordo com a seguinte ordem de etapas: 9 | 10 | `Norminette (linter)` > `Compilação` > `Execução de testes` > `Verificação de vazamento de memória` 11 | 12 | [Nesse link aqui](https://github.com/tiolula/tdd_libft/actions/runs/4953881034) você pode conferir um exemplo de como deve ficar a execução do pipeline depois que você configurá-lo para rodar a Norminette. Ao final do desafio, deve estar na imagem da execução não só o passo da Norminette, mas também os demais. 13 | 14 | _Obs: Se o projeto escolhido não tem testes, ta aí um bom Bônus maneirinho para esse Dojo: Escreva alguns testes pra ele e coloque pra rodar._ 15 | 16 | ## Dicas 😜 17 | 18 | ### Dica de ouro! ✨ 19 | 20 | O GitHub actions entende o que deve fazer com base nos arquivos `.yml` da pasta `.github` que deve estar na raíz do projeto. Use os repósitórios de exemplo ao final dessas dicas para tentar começar a fazer seu `.yml`. 21 | 22 | ### Outras dicas 23 | 24 | - Não tente fazer todos os passos de uma vez. Use Baby Steps! 👶🏾🍼 25 | - Vocês provavelmente farão muuuuuuitos pushes até terem sucesso 😅 26 | - Escolham um projeto que não seja muito difícil de compilar, ver leak e etc... 😉 27 | - Se vocês não tiverem nenhum projeto com testes, pulem esta etapa. E comecem a fazer testes! 🤬 28 | 29 | ## Repositórios de exemplo: 30 | 31 | - https://github.com/LuigiEnzoFerrari/philosophers 32 | - https://github.com/ThreeDP/ft_printf 33 | - https://github.com/tiolula/tdd_libft 34 | - https://github.com/AdrianWR/philosophers 35 | 36 | ## Um bônus de leve 37 | 38 | Se você conseguiu configurar o pipeline com testes e tudo, o Bônus de verdade é colocar etiquetas no `README.md` do projeto que mostrem o estado do Pipeline, [como no título desse readme aqui](https://github.com/tiolula/tdd_libft#readme) 39 | -------------------------------------------------------------------------------- /Rust/src/special/README.md: -------------------------------------------------------------------------------- 1 | # Special puzzle from day 1 of Advent of Code 2022 2 | 3 | Now use what you've learned and solve this fun puzzle. 4 | 5 | # Day 1: Calorie Counting 6 | 7 | Santa's reindeer typically eat regular reindeer food, but they need a lot of magical energy to deliver presents on Christmas. For that, their favorite snack is a special type of star fruit that only grows deep in the jungle. The Elves have brought you on their annual expedition to the grove where the fruit grows. 8 | 9 | To supply enough magical energy, the expedition needs to retrieve a minimum of fifty stars by December 25th. Although the Elves assure you that the grove has plenty of fruit, you decide to grab any fruit you see along the way, just in case. 10 | 11 | Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck! 12 | 13 | The jungle must be too overgrown and difficult to navigate in vehicles or access from the air; the Elves' expedition traditionally goes on foot. As your boats approach land, the Elves begin taking inventory of their supplies. One important consideration is food - in particular, the number of Calories each Elf is carrying (your puzzle input). 14 | 15 | The Elves take turns writing down the number of Calories contained by the various meals, snacks, rations, etc. that they've brought with them, one item per line. Each Elf separates their own inventory from the previous Elf's inventory (if any) by a blank line. 16 | 17 | For example, suppose the Elves finish writing their items' Calories and end up with the following list: 18 | 19 | ``` 20 | 1000 21 | 2000 22 | 3000 23 | 24 | 4000 25 | 26 | 5000 27 | 6000 28 | 29 | 7000 30 | 8000 31 | 9000 32 | 33 | 10000 34 | ``` 35 | 36 | This list represents the Calories of the food carried by five Elves: 37 | 38 | - The first Elf is carrying food with 1000, 2000, and 3000 Calories, a total of 6000 Calories. 39 | - The second Elf is carrying one food item with 4000 Calories. 40 | - The third Elf is carrying food with 5000 and 6000 Calories, a total of 11000 Calories. 41 | - The fourth Elf is carrying food with 7000, 8000, and 9000 Calories, a total of 24000 Calories. 42 | - The fifth Elf is carrying one food item with 10000 Calories. 43 | 44 | In case the Elves get hungry and need extra snacks, they need to know which Elf to ask: they'd like to know how many Calories are being carried by the Elf carrying the most Calories. In the example above, this is 24000 (carried by the fourth Elf). 45 | 46 | ## Part 1 47 | 48 | Find the Elf carrying the most Calories. *How many total Calories is that Elf carrying?* 49 | 50 | ***Don't forget to get your Puzzle input*** 51 | -------------------------------------------------------------------------------- /Algoritmos/String sem letras repetidas/README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Qual o tamanho da maior substring sem letras repetidas? 4 |

5 | 6 | > *"Se esta frase fosse o parametro de entrada deste problema a resposta provavelmente seria 9"* 7 | 8 | ## 💫 Introdução 9 | 10 | Este é mais um desafio da série "bora implementar algoritmos"! 😛 11 | 12 | A ideia central dessa série de Dojos é preparar as pessoas que participam para conseguirem resolver problemas rapidamente e estarem prontas para entrevistas com esse tipo de desafio. 😜 13 | 14 | **Ele pode ser resolvido na linguagem de preferência do grupo.** 15 | 16 | ## 🤚🏽 Mas antes... 17 | 18 | Teste! É altamente recomendável utilizar TDD neste desafio. Se vocês preferirem ignorar essa recomendação, além de deixar de praticar testes automatizados, provavelmente ao final do desafio também não terão certeza de que ele funciona como deveria. 😄 19 | 20 | ## 🚀Agora sim, vamos ao desafio! 21 | 22 | > **O desafio é encontrar dentro de uma string recebida, qual o tamanho da maior substring que não tenha caracteres repetidos.** 🤔 23 | 24 | Por exemplo: 25 | 26 | - Se a string de entrada for "abcdeabc", a resposta seria "5", já que "abcde" é a maior substring sem caracteres repetidos dentro de "**abcde**abc" 27 | 28 | - Se a string de entrada for "banana", a resposta seria "3", já que "ban" é a maior substring sem caracteres repetidos dentro de "**ban**ana" 29 | 30 | - Se a string de entrada for "abacate", a resposta seria "4", já que "cate" é a maior substring sem caracteres repetidos dentro de "aba**cate**" *(atente-se para o fato de que a substring não precisa ser necessariamente no começo da palavra )* 😉 31 | 32 | ⚠️ Importante: Espaços contam como caracter! 33 | ## 💖 Umas coisitas a mais pra aquietar seu coração 34 | 35 | - Não precisa se preocupar com acentos na string de entrada. Trate-os como quiser. Se quiser considerar inválida a entrada, pode. Se quiser considerar como letra sem acento, pode. Se quiser considerar como um caracter diferente, pode! Escolha o que for melhor para vocês! 36 | 37 | - Não precisa se preocupar com caracteres especiais (exceto espaços). Trate-os como quiser. Se quiser considerar inválida a entrada, pode. Se quiser considerar como um caracter normal, pode. Se quiser ignorar, pode. Escolha o que for melhor para vocês! 38 | 39 | ## Dica de ouro! ✨ 40 | 41 | - Baby Steps e TDD vão te ajudar muito. Sério! 👶🏾🍼 42 | 43 | ## 🙏🏾 Créditos 44 | 45 | Esse desafio foi retirado da leetcode.com, traduzido para português e colocado numa linguagem mais 42SP. 😛 46 | 47 | Você encontra o original e muitos outros [aqui](https://leetcode.com/problems/longest-substring-without-repeating-characters/description/?envType=study-plan-v2&envId=top-100-liked) 48 | 49 | Obrigado, leetcode! -------------------------------------------------------------------------------- /Algoritmos/Carteado/README.md: -------------------------------------------------------------------------------- 1 |

2 | ♥️ ♣️ 🃏 Carteado 🃏 ♠️ ♦️ 3 |

4 | 5 | > *"Não vai coringar, hein?"* 6 | 7 | ## Não adianta fazer mistério, você vai ter que mostrar sua mão 8 | Não é poker nem 21, não estamos jogando a dinheiro... a ideia é ir revelando os segredos das cartas... 9 | 10 | *Não, também não vamos levar para o lado esotérico, só queremos saber quais são as cartas mesmo.* 11 | 12 | ## 🚀 O Desafio 13 | 14 | Este desafio pode ser resolvido na linguagem de sua preferência, mas seria mais legal em C, não é mesmo? 15 | 16 | Você tem um array de inteiros chamado `baralho`. No seu baralho cada carta tem um inteiro único. O inteiro na `iª` carta é `baralho[i]`. 17 | Você pode ordenar o baralho em qualquer ordem que quiser. No início, as cartas estão viradas para baixo (sem ser reveladas) em um monte único. 18 | 19 | Você vai seguir os seguintes passos repetidamente até todas as cartas serem reveladas 20 | 21 | 1. Pegue a carta do topo do baralho, revele-a, e tire-a do baralho. 22 | 2. Se ainda houver cartas no baralho inicial, coloque a próxima carta do topo no fundo do baralho. 23 | 3. Se ainda houver cartas não reveladas, volte ao passo 1. Caso contrário, pare. 24 | 25 | Retorne **uma ordenação do baralho que revele as cartas em ordem crescente.** 26 | 27 | Observe que a primeira entrada na resposta é considerada o topo do baralho. 28 | 29 | ### ⌨️ Show me the code 30 | 31 | *Exemplo 1* 32 | 33 | **Entrada:** `baralho = [17,13,11,2,3,5,7]` 34 | 35 | **Saída:** `[2,13,3,11,5,17,7]` 36 | 37 | **Mas como?** 38 | 39 | Recebemos o baralho na ordem `[17, 13, 11, 2, 3, 5, 7]` (essa ordem não importa) e o reordenamos. 40 | 41 | Após a reordenação, o baralho começa como `[2, 13, 3, 11, 5, 17, 7]`, onde 2 é o topo do baralho. 42 | 43 | Revelamos o 2 e movemos o 13 para o fundo. O baralho agora é `[3, 11, 5, 17, 7, 13]`. 44 | 45 | Revelamos o 3 e movemos o 11 para o fundo. O baralho agora é `[5, 17, 7, 13, 11]`. 46 | 47 | Revelamos o 5 e movemos o 17 para o fundo. O baralho agora é `[7, 13, 11, 17]`. 48 | 49 | Revelamos o 7 e movemos o 13 para o fundo. O baralho agora é `[11, 17, 13]`. 50 | 51 | Revelamos o 11 e movemos o 17 para o fundo. O baralho agora é `[13, 17]`. 52 | 53 | Revelamos 13 e movemos 17 para o fundo. O baralho agora é `[17]`. 54 | 55 | Revelamos 17. 56 | 57 | Como todas as cartas reveladas estão em ordem crescente, a resposta está correta. 58 | 59 | Bora? 60 | 61 | ⭐ Bônus: O bônus do rolê não é algo para ser feito depois, mas sim antes, então decidam se vão fazer com bônus ou não desde já. O desafio do bônus é fazer tudo isso usando TDD. Se você não sabe o que é TDD, pergunta pro Chat GPT. Hihi. 62 | 63 | ## Dicas 😜 64 | ### Dica de ouro! ✨ 65 | - Não tente fazer todos os passos de uma vez. Use Baby Steps! 👶🏾🍼 66 | 67 | ## 📎 Referências 68 | - Este desafio foi retirado do [LeetCode](https://leetcode.com/problems/reveal-cards-in-increasing-order/description/). Dá uma olhada em outros por lá, é legal. 👍🏾 -------------------------------------------------------------------------------- /MLX/JRPG/set_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ECHO=/usr/bin/echo 4 | CAT=/usr/bin/cat 5 | UNZIP=/usr/bin/unzip 6 | 7 | selectMakefile () { 8 | case $($CAT .env) in 9 | "CODAM") if test ! -d MLX42 10 | then 11 | $UNZIP ../MLX42.zip 12 | fi 13 | $ECHO -e -n > Makefile "#CODAM 14 | NAME=JRPG.exec 15 | NAME_BONUS=JRPG.bonus 16 | GCC_FLAGS=-Wall -Wextra -Werror 17 | MLX_LIB=MLX42/build/libmlx42.a 18 | MLX_HEADER=-I./MLX42/include/MLX42 19 | MLX_FLAGS= -lm -ldl -pthread -lglfw 20 | REMOVE=/usr/bin/rm -fr 21 | YOUR_SRC=\${wildcard source/*.c} 22 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 23 | 24 | all: \${MLX_LIB} \${NAME} 25 | 26 | \${NAME}: \${YOUR_SRC} 27 | cc \${YOUR_SRC} \${MLX_HEADER} \${MLX_LIB} \${MLX_FLAGS} -o \${NAME} 28 | 29 | \${MLX_LIB}: 30 | ifeq (, \${wildcard MLX42/build}) 31 | cmake -S MLX42 -B MLX42/build 32 | cmake --build MLX42/build 33 | endif 34 | make -j4 -C MLX42/build 35 | 36 | bonus: 37 | make YOUR_SRC="\${YOUR_BONUS_SRC}" NAME=\${NAME_BONUS} 38 | 39 | fclean: 40 | \${REMOVE} MLX42/build \${NAME} \${NAME_BONUS} 41 | .PHONY:clean 42 | 43 | re: fclean 44 | ifneq (, \${wildcard \${NAME_BONUS}}) 45 | make YOUR_SRC="\${YOUR_BONUS_SRC}" 46 | else 47 | make 48 | endif 49 | .PHONY:re all fclean bonus clean";; 50 | "FRENCH") if test ! -d minilibx-linux 51 | then 52 | $UNZIP ../minilibx-linux.zip 53 | fi 54 | $ECHO -n -e > Makefile "#FRENCH 55 | NAME=JRPG.exec 56 | NAME_BONUS=JRPG.bonus 57 | GCC_FLAGS=-Wall -Wextra -Werror 58 | MLX_LIB=minilibx-linux/libmlx.a 59 | MLX_FLAGS=-Lminilibx-linux -lmlx -lX11 -lXext 60 | REMOVE=/usr/bin/rm -fr 61 | YOUR_SRC=\${wildcard source/*.c} 62 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 63 | 64 | all: \${MLX_LIB} \${NAME} 65 | .PHONY: all 66 | 67 | \${NAME}: \${YOUR_SRC} 68 | cc \${GCC_FLAGS} -I. \${MLX_FLAGS} \${YOUR_SRC} -o \${NAME} 69 | 70 | \${MLX_LIB}: 71 | make -C minilibx-linux 72 | 73 | bonus: 74 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" NAME=\${NAME_BONUS} 75 | 76 | fclean: 77 | \${REMOVE} mini*linux/*.a mini*linux/Makefile.gen mini*linux/obj \${NAME} \ 78 | \${NAME_BONUS} 79 | .PHONY:clean 80 | 81 | re: fclean 82 | ifneq (, \${wildcard \${NAME_BONUS}}) 83 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" 84 | else 85 | make 86 | endif 87 | .PHONY:re" ;; 88 | *) $ECHO "Error: .env!"; rm -fr .env Makefile;; 89 | esac 90 | } 91 | 92 | if test -f .env 93 | then 94 | selectMakefile 95 | else 96 | $ECHO "Are you going to use [C]odam or [F]rench MiniLibX?" 97 | while true 98 | do 99 | read -n1 -r -p "> " CHOICE 100 | $ECHO 101 | case $CHOICE in 102 | "C") $ECHO -n "CODAM" > $PWD/.env ;; 103 | "c") $ECHO -n "CODAM" > $PWD/.env ;; 104 | "F") $ECHO -n "FRENCH" > $PWD/.env ;; 105 | "f") $ECHO -n "FRENCH" > $PWD/.env ;; 106 | *) $ECHO "Error: input!";; 107 | esac 108 | sleep 1 109 | if test -f .env 110 | then 111 | break 112 | fi 113 | done 114 | selectMakefile 115 | fi 116 | -------------------------------------------------------------------------------- /MLX/Tron/set_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ECHO=/usr/bin/echo 4 | CAT=/usr/bin/cat 5 | UNZIP=/usr/bin/unzip 6 | 7 | selectMakefile () { 8 | case $($CAT .env) in 9 | "CODAM") if test ! -d MLX42 10 | then 11 | $UNZIP ../MLX42.zip 12 | fi 13 | $ECHO -e -n > Makefile "#CODAM 14 | NAME=Tron.exec 15 | NAME_BONUS=Tron.bonus 16 | GCC_FLAGS=-Wall -Wextra -Werror 17 | MLX_LIB=MLX42/build/libmlx42.a 18 | MLX_HEADER=-I./MLX42/include/MLX42 19 | MLX_FLAGS= -lm -ldl -pthread -lglfw 20 | REMOVE=/usr/bin/rm -fr 21 | YOUR_SRC=\${wildcard source/*.c} 22 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 23 | 24 | all: \${MLX_LIB} \${NAME} 25 | 26 | \${NAME}: \${YOUR_SRC} 27 | cc \${YOUR_SRC} \${MLX_HEADER} \${MLX_LIB} \${MLX_FLAGS} -o \${NAME} 28 | 29 | \${MLX_LIB}: 30 | ifeq (, \${wildcard MLX42/build}) 31 | cmake -S MLX42 -B MLX42/build 32 | cmake --build MLX42/build 33 | endif 34 | make -j4 -C MLX42/build 35 | 36 | bonus: 37 | make YOUR_SRC="\${YOUR_BONUS_SRC}" NAME=\${NAME_BONUS} 38 | 39 | fclean: 40 | \${REMOVE} MLX42/build \${NAME} \${NAME_BONUS} 41 | .PHONY:clean 42 | 43 | re: fclean 44 | ifneq (, \${wildcard \${NAME_BONUS}}) 45 | make YOUR_SRC="\${YOUR_BONUS_SRC}" 46 | else 47 | make 48 | endif 49 | .PHONY:re all fclean bonus clean";; 50 | "FRENCH") if test ! -d minilibx-linux 51 | then 52 | $UNZIP ../minilibx-linux.zip 53 | fi 54 | $ECHO -n -e > Makefile "#FRENCH 55 | NAME=Tron.exec 56 | NAME_BONUS=Tron.bonus 57 | GCC_FLAGS=-Wall -Wextra -Werror 58 | MLX_LIB=minilibx-linux/libmlx.a 59 | MLX_FLAGS=-Lminilibx-linux -lmlx -lX11 -lXext 60 | REMOVE=/usr/bin/rm -fr 61 | YOUR_SRC=\${wildcard source/*.c} 62 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 63 | 64 | all: \${MLX_LIB} \${NAME} 65 | .PHONY: all 66 | 67 | \${NAME}: \${YOUR_SRC} 68 | cc \${GCC_FLAGS} -I. \${MLX_FLAGS} \${YOUR_SRC} -o \${NAME} 69 | 70 | \${MLX_LIB}: 71 | make -C minilibx-linux 72 | 73 | bonus: 74 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" NAME=\${NAME_BONUS} 75 | 76 | fclean: 77 | \${REMOVE} mini*linux/*.a mini*linux/Makefile.gen mini*linux/obj \${NAME} \ 78 | \${NAME_BONUS} 79 | .PHONY:clean 80 | 81 | re: fclean 82 | ifneq (, \${wildcard \${NAME_BONUS}}) 83 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" 84 | else 85 | make 86 | endif 87 | .PHONY:re" ;; 88 | *) $ECHO "Error: .env!"; rm -fr .env Makefile;; 89 | esac 90 | } 91 | 92 | if test -f .env 93 | then 94 | selectMakefile 95 | else 96 | $ECHO "Are you going to use [C]odam or [F]rench MiniLibX?" 97 | while true 98 | do 99 | read -n1 -r -p "> " CHOICE 100 | $ECHO 101 | case $CHOICE in 102 | "C") $ECHO -n "CODAM" > $PWD/.env ;; 103 | "c") $ECHO -n "CODAM" > $PWD/.env ;; 104 | "F") $ECHO -n "FRENCH" > $PWD/.env ;; 105 | "f") $ECHO -n "FRENCH" > $PWD/.env ;; 106 | *) $ECHO "Error: input!";; 107 | esac 108 | sleep 1 109 | if test -f .env 110 | then 111 | break 112 | fi 113 | done 114 | selectMakefile 115 | fi 116 | -------------------------------------------------------------------------------- /MLX/Paint/set_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ECHO=/usr/bin/echo 4 | CAT=/usr/bin/cat 5 | UNZIP=/usr/bin/unzip 6 | 7 | selectMakefile () { 8 | case $($CAT .env) in 9 | "CODAM") if test ! -d MLX42 10 | then 11 | $UNZIP ../MLX42.zip 12 | fi 13 | $ECHO -e -n > Makefile "#CODAM 14 | NAME=Paint.exec 15 | NAME_BONUS=Paint.bonus 16 | GCC_FLAGS=-Wall -Wextra -Werror 17 | MLX_LIB=MLX42/build/libmlx42.a 18 | MLX_HEADER=-I./MLX42/include/MLX42 19 | MLX_FLAGS= -lm -ldl -pthread -lglfw 20 | REMOVE=/usr/bin/rm -fr 21 | YOUR_SRC=\${wildcard source/*.c} 22 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 23 | 24 | all: \${MLX_LIB} \${NAME} 25 | 26 | \${NAME}: \${YOUR_SRC} 27 | cc \${YOUR_SRC} \${MLX_HEADER} \${MLX_LIB} \${MLX_FLAGS} -o \${NAME} 28 | 29 | \${MLX_LIB}: 30 | ifeq (, \${wildcard MLX42/build}) 31 | cmake -S MLX42 -B MLX42/build 32 | cmake --build MLX42/build 33 | endif 34 | make -j4 -C MLX42/build 35 | 36 | bonus: 37 | make YOUR_SRC="\${YOUR_BONUS_SRC}" NAME=\${NAME_BONUS} 38 | 39 | fclean: 40 | \${REMOVE} MLX42/build \${NAME} \${NAME_BONUS} 41 | .PHONY:clean 42 | 43 | re: fclean 44 | ifneq (, \${wildcard \${NAME_BONUS}}) 45 | make YOUR_SRC="\${YOUR_BONUS_SRC}" 46 | else 47 | make 48 | endif 49 | .PHONY:re all fclean bonus clean";; 50 | "FRENCH") if test ! -d minilibx-linux 51 | then 52 | $UNZIP ../minilibx-linux.zip 53 | fi 54 | $ECHO -n -e > Makefile "#FRENCH 55 | NAME=Paint.exec 56 | NAME_BONUS=Paint.bonus 57 | GCC_FLAGS=-Wall -Wextra -Werror 58 | MLX_LIB=minilibx-linux/libmlx.a 59 | MLX_FLAGS=-Lminilibx-linux -lmlx -lX11 -lXext 60 | REMOVE=/usr/bin/rm -fr 61 | YOUR_SRC=\${wildcard source/*.c} 62 | YOUR_BONUS_SRC=\${wildcard bonus/*.c} 63 | 64 | all: \${MLX_LIB} \${NAME} 65 | .PHONY: all 66 | 67 | \${NAME}: \${YOUR_SRC} 68 | cc \${GCC_FLAGS} -I. \${MLX_FLAGS} \${YOUR_SRC} -o \${NAME} 69 | 70 | \${MLX_LIB}: 71 | make -C minilibx-linux 72 | 73 | bonus: 74 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" NAME=\${NAME_BONUS} 75 | 76 | fclean: 77 | \${REMOVE} mini*linux/*.a mini*linux/Makefile.gen mini*linux/obj \${NAME} \ 78 | \${NAME_BONUS} 79 | .PHONY:clean 80 | 81 | re: fclean 82 | ifneq (, \${wildcard \${NAME_BONUS}}) 83 | make YOUR_SRC=\"\${YOUR_BONUS_SRC}\" 84 | else 85 | make 86 | endif 87 | .PHONY:re" ;; 88 | *) $ECHO "Error: .env!"; rm -fr .env Makefile;; 89 | esac 90 | } 91 | 92 | if test -f .env 93 | then 94 | selectMakefile 95 | else 96 | $ECHO "Are you going to use [C]odam or [F]rench MiniLibX?" 97 | while true 98 | do 99 | read -n1 -r -p "> " CHOICE 100 | $ECHO 101 | case $CHOICE in 102 | "C") $ECHO -n "CODAM" > $PWD/.env ;; 103 | "c") $ECHO -n "CODAM" > $PWD/.env ;; 104 | "F") $ECHO -n "FRENCH" > $PWD/.env ;; 105 | "f") $ECHO -n "FRENCH" > $PWD/.env ;; 106 | *) $ECHO "Error: input!";; 107 | esac 108 | sleep 1 109 | if test -f .env 110 | then 111 | break 112 | fi 113 | done 114 | selectMakefile 115 | fi 116 | -------------------------------------------------------------------------------- /Algoritmos/Problema do doce/README.md: -------------------------------------------------------------------------------- 1 |

2 | 🍬🍭Doce 🧁🍪 3 |

4 | 5 | > *"Nunca aceite doces de estranhos" Mamãe* 6 | 7 | ## 😜 Quem tira nota mais alta ganha mais doce 8 | Ok. Parece um discurso um tanto quanto meritocrático, mas deixando a problematização de lado, a nossa missão aqui é saber o número mínimo de doces que precisamos levar para as crianças dado que **quem tirou nota mais alta na prova tem que ganhar mais doces do que os colegas ao lado**. 9 | 10 | *obs: por motivos legais não mencionaremos neste desafio questões médicas como diabetes e cáries.* 11 | 12 | ## 🚀 O Desafio 13 | 14 | Este desafio pode ser resolvido na linguagem de sua preferência. Qualquer linguagem tá valendo, até [BIRL](https://birl-language.github.io/)! 15 | 16 | Em uma fila de crianças que receberão doces, cada criança trará o boletim, com a nota que tirou. Sua missão é calcular a quantidade mínima de doces que precisamos levar, seguindo os seguintes critérios: 17 | 18 | 1. A inveja tá liberada: Todo mundo fica de olho no quanto a pessoinha do lado ganhou, então cada criança tem que ter garantido o direito de que, se o amiguinho do lado tirou uma nota mais baixa, ele tem que receber menos doce. 19 | 20 | ⚠️ **Considere somente a nota dos vizinhos neste critério.** 21 | 22 | 2. Ninguém fica sem doce: Cada criança deve ganhar pelo menos 1 doce. Esse número deve crescer de acordo com o critério anterior (ainda que digam por aí que inveja mata). 23 | 24 | ### ⌨️ Show me the code 25 | 26 | A lista de crianças com suas respectivas notas (único parâmetro de entrada) deve ser um `array` de `inteiros`. Cada elemento do `array` simboliza uma criança e sua respectiva nota, por exemplo: 27 | 28 | - ``[5, 7, 8, 3]``: Isso simboliza uma fila de 4 crionças 🐯, sendo que a primeira tirou 5, a segunda 7, a terceira 8 e quarta 3. 29 | 30 | A saída deve ser um inteiro, por exemplo: 31 | 32 | Se tomarmos como entrada o exemplo anterior ``[5, 7, 8, 3]`` a saída deve ser `7`, porque: 33 | 34 | - a segunda crionça (que tirou 7) deve receber mais doces do que a primeira (que tirou 5) 35 | - a terceira (que tirou 8) deve receber mais doces do que a segunda (que tirou 7) 36 | - a quarta (que tirou 3) deve receber menos doces do que a terceira (que tirou 8), então 1 doce é suficiente para ela 37 | 38 | Tendeu? 39 | 40 | ⭐ Bônus: O bônus do rolê não é algo para ser feito depois, mas sim antes, então decidam se vão fazer com bônus ou não desde já. O desafio do bônus é fazer tudo isso usando TDD. Se você não sabe o que é TDD, pergunta pro Chat GPT. Hihi. 41 | 42 | ## Dicas 😜 43 | ### Dica de ouro! ✨ 44 | - Não tente fazer todos os passos de uma vez. Use Baby Steps! 👶🏾🍼 45 | ### Dica de prata! 46 | - Não tente tratar corner cases antes de fazer o rolê funcionar. A criançada quer doce, não os deixe esperando. 47 | 48 | ## 📎 Referências 49 | - Este desafio foi retirado do [LeetCode](https://leetcode.com/problems/candy/?envType=study-plan-v2&envId=top-interview-150). Dá uma bizoiada em outros por lá, é legal. 👍🏾 -------------------------------------------------------------------------------- /minishell/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
D O J O DE M I N I S H E L L
🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 4 |

5 |

6 | 7 | ## Uma Breve Introdução 8 | 9 | Todo mundo sabe que o minishell é zica. Popularmente conhecido como 🔥minihell🔥, o projeto é grande e frequentemente gera ansiedade. A intenção desse Dojo é levar para um clima de diversão e descontração uma pitadinha do minishell pra quem já conhece dos pormenores conseguir trocar com quem ainda não finalizou o projeto e, juntos, aprenderem através do desafio proposto. 10 | 11 | ## 🚀 O Desafio 12 | 13 | O desafio é composto por 2 partes: 14 | 15 | ### 1. Fazer o Minishell Tester funcionar 16 | 17 | Foi utilizado como base para a construção desse Dojo [o minishell](https://github.com/LucasKuhn/minishell) e [o tester](https://github.com/LucasKuhn/minishell_tester) desenvolvido pelo lalex-ku. Ambos estão em uma versão simplificada, que serve como ponto de partida para o Dojo. 18 | 19 | Para compilar o minishell deste repo, é só rodar o comando abaixo: 20 | 21 | ```bash 22 | cc main.c -o minishell -lreadline 23 | ``` 24 | 25 | E para rodar o tester: 26 | 27 | ```bash 28 | cd tester 29 | bash dojo_tester.sh ./test_files/dojo_tests 30 | ``` 31 | 32 | Já existe um teste e uma implementação para o comando `pwd`, mas muito provavelmente o teste não está passando. 33 | 34 | 👉🏾 **Seu primeiro desafio é fazer o teste do `pwd` passar. Para isso você pode fazer ajustes tanto na `main.c` quanto no `tester/dojo_tester.sh`, ou qualquer outro arquivo necessário.** 35 | 36 | Depois que o teste do `pwd` estiver passando, avance para a segunda parte do desafio. 37 | 38 | ### 2. echo 39 | 40 | Assim que o tester estiver OK e o comando `pwd` estiver sendo executado com sucesso, o desafio é você fazer o minishell passar em cada um dos 5 cenários propostos abaixo: 41 | 42 | 1. `echo 42` 43 | 2. `echo Hello World` 44 | 3. `echo "Hello World"` 45 | 4. `echo hello'world'` 46 | 5. `echo hello""world` 47 | 48 | Para isso você terá que adicionar estes cenários no arquivo `dojo_tests`. 49 | 50 | ## Dicas 😜 51 | 52 | - Faça uma coisa por vez. Não tente resolver todos os problemas de uma vez só. Baby Steps é o que há! 53 | - Você não precisa resolver tooooodos os problemas do mundo. Concentre-se no que o desafio pede. 54 | - Feito hoje melhor do que perfeito um dia 55 | - Você pode usar o [o minishell](https://github.com/LucasKuhn/minishell) e [o tester](https://github.com/LucasKuhn/minishell_tester) originais do lalex-ku para entender possíveis caminhos para os desafios, só não vale aldrabar! 56 | 57 | ## Bônus ⭐ 58 | 59 | Se você completar o desafio, pode partir para o bônus! O bônus é você implementar alguma outra função diferente da echo à sua escolha, incluindo quantos testes forem necessários no tester! 60 | 61 | Inclusive esse é um bônus quase infinito, dado que você só acaba ele quando tiver um bash completo, né? hihi. 62 | 63 | ## Agradecimentos 64 | 65 | À Clari, por ter proposto o Dojo. <3 66 | Ao [Lucas Kuhnn](https://github.com/LucasKuhn) por tê-lo construído junto com o [Lula](https://github.com/tiolula). \o/ 67 | A toda a comunidade da 42SP! 68 | -------------------------------------------------------------------------------- /Docker/🐋 Dojo de Docker.md: -------------------------------------------------------------------------------- 1 | 2 | > 📋 Resumo do desafio: Em grupos de pelo menos 3 pessoas, escolha o minishell de alguma pessoa e faça-o rodar utilizando o comando `docker run minishell` 3 | 4 | ## Sdds minishell 5 | 6 | Não queremos acionar gatilhos, mas sabemos todos que o mini~~s~~hell é um projeto "desafiador" na 42. Passar pelo `minishell` é um marco. Um marco bom? Um marco ruim? Aí vai da experiência de cada um. 7 | 8 | Aqui vamos aproveitar um minishell já pronto para aprender um pouquinho sobre docker. Bora? 9 | 10 | ## O desafio 11 | 12 | O desafio é bem simples: disponibilizar um minishell para que qualquer pessoa no mundo consiga utilizá-lo simplesmente usando o comando `docker run minishell` 13 | 14 | Pode escolher o minshell de quem você quiser! 🙌🏾 15 | 16 | ## Dicas 😜 17 | 18 | ### Dicas de ouro! ✨ 19 | 20 | - O começo da mágica está em criar um arquivo `Dockerfile` 21 | - Para gerar uma imagem docker é só usar o comando `docker build .` na pasta em que está o `Dockerfile` 22 | - Utilize a imagem `ubuntu:latest` 23 | - Não compile o binário dentro do conteiner, faça só a cópia dele já compilado 24 | - Use o próprio `Dockerfile` para instalar o que for necessário no container 25 | - O `ENTRYPOINT` deve ser o próprio binário 26 | 27 | ### Outras dicas 💡 28 | 29 | - O comando `docker run ` sobe um container a partir de uma imagem 30 | - O comando `docker image ls` lista as imagens compiladas no computador 31 | - O comando `docker ps` lista os containers rodando no computador 32 | - Para investigar o que está acontecendo dentro de um container, talvez esse link seja útil: 33 | - https://devopscube.com/keep-docker-container-running/ 34 | 35 | ### Bônus 🎉 36 | 37 | > 😜 Se estiver conseguindo executar o binário a partir de um container Docker, faça o `push` dessa imagem para o `Dockerhub` e suba esse container a partir do `Dockerhub` em algum outro computador 38 | 39 | ### Bônus do Bônus 40 | 41 | Geralmente, quando você está subindo vários conteineres a partir de várias imagens para que funcionem em conjunto (por exemplo, um conteiner subindo uma imagem do front, outro subindo a do back e outro a do BD ) fica muito trabalhoso ficar subindo cada um usando uma linha de comando por vez. 42 | 43 | Para isso, existe uma solução muito utilizada por aí, que é o docker-compose. 44 | 45 | Segundo o chat GPT (usando um prompt muito doido): 46 | 47 | > O Docker Compose é como o diretor de uma orquestra para aplicativos, ajudando a organizar e gerenciar diferentes partes do programa para que possam trabalhar juntas sem confusão. Em vez de apenas lidar com músicos (contêineres) individualmente, ele também cuida dos instrumentos (imagens do Docker) necessários para cada um. Assim, seguindo uma partitura (arquivo de composição do Docker), o Docker Compose cria um ambiente harmonioso onde todos os componentes se unem para executar a melodia desejada do seu aplicativo. 48 | 49 | Aqui não vamos subir múltiplos conteineres, mas a ideia do bônus do bônus é você conseguir pelo menos usar o `docker-compose`. 50 | 51 | > O seu desafio aqui é conseguir subir este minishel usando simplesmente o comando `docker-compose up` ao invés do `docker run` -------------------------------------------------------------------------------- /TDD usando a libft/README.md: -------------------------------------------------------------------------------- 1 | # Dojo de TDD usando o libft 2 | 3 | > 📋 Resumo do desafio: Em grupos de pelo menos 3 pessoas, desenvolva a função ft_atoi utilizando o ciclo do TDD 4 | 5 | ## Precisamos falar sobre testes... 6 | 7 | 😅 Eu, você e o mundo todo sabemos: Testar qualquer coisa que já esteja minimamente pronta é um porre. É aí que entra a mágica de escrever testes ANTES de escrever seu código de negócio. Essa técnica se chama TDD, Test Driven Development. 8 | 9 | Como estou com preguiça de explicar o TDD, pedi ao ChatGPT que explicasse: 10 | 11 | > Olá! Você poderia me explicar os passos do TDD de forma bem resumida, por favor? 12 | 13 | > ChatGPT: Claro! O TDD (Test-Driven Development), ou Desenvolvimento Orientado a Testes, é uma abordagem de desenvolvimento de software que enfatiza a criação de testes antes da implementação do código. Os passos do TDD podem ser resumidos da seguinte forma: 14 | > 15 | > 1. **Escrever um teste**: O primeiro passo é escrever um teste automatizado para a funcionalidade que você deseja adicionar ou corrigir. O teste deve ser bem simples, focando apenas no requisito mais básico da funcionalidade. 16 | > 17 | > 2. **Executar o teste e ver falhar**: Inicialmente, o teste irá falhar, pois a funcionalidade ainda não foi implementada. 18 | > 19 | > 3. **Escrever a implementação mínima**: Agora é hora de escrever a quantidade mínima de código necessária para fazer o teste passar. Não se preocupe em fazer a implementação completa ainda. 20 | > 21 | > 4. **Executar todos os testes**: Certifique-se de que todos os testes, incluindo os antigos, estão sendo executados para garantir que a nova funcionalidade não quebrou nada no código existente. 22 | > 23 | 5. **Refatorar o código**: Após os testes passarem, você pode refatorar o código para melhorar sua estrutura, legibilidade e eficiência, mantendo os testes sempre verdes (passando). 24 | > 25 | 7. **Repetir**: Repita esses passos para adicionar novas funcionalidades ou corrigir bugs. Escreva um novo teste, verifique se ele falha, implemente a funcionalidade mínima, execute todos os testes e, se necessário, refatore o código. 26 | > 27 | > O ciclo de repetição do TDD **(escrever teste -> implementar a funcionalidade mínima -> refatorar)** é uma parte essencial da prática. Ele ajuda a garantir que o código seja confiável, mantenha-se testável e evolua de maneira mais segura ao longo do tempo. 28 | 29 | ## O desafio! 30 | 31 | 👉🏾O seu desafio vai ser implementar utilizar TDD para desenvolver a função `ft_atoi`. 32 | 33 | 🙌🏾O repositório já tem um esqueleto básico com, inclusive, um teste implementado no arquivo de testes `test_ft_atoi.c` para você utilizar como base para escrever os demais: 34 | 35 | ``` 36 | MU_TEST(test_atoi_convert_1_char_to_1_integer) 37 | 38 | { 39 |     // ARRANGE 40 |     char *c = "1"; 41 |     int expected_result = 1; 42 |     char actual_result; 43 |     44 |     // ACT 45 | 46 |     actual_result = ft_atoi(c); 47 | 48 |     // ASSERT 49 |     mu_assert_int_eq(expected_result, actual_result); 50 | } 51 | ``` 52 | 53 | 😜 Para rodar os testes, é só usar a linha de comando abaixo: 54 | 55 | `gcc ./src/ft_atoi.c ./tests/test_ft_atoi.c -lrt -lm -o test_program && ./test_program` 56 | 57 | Bora? 🚀 -------------------------------------------------------------------------------- /GDB e Valgrind/libft/includes/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/08/27 15:51:37 by coder #+# #+# */ 9 | /* Updated: 2023/06/21 07:27:25 by coder ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | # define MAX_SIZE 2147483647 19 | # include "linked_list.h" 20 | 21 | typedef struct s_mini 22 | { 23 | char *string; 24 | }t_mini; 25 | 26 | 27 | typedef struct s_shell 28 | { 29 | t_list *list; 30 | }t_shell; 31 | 32 | 33 | int ft_atoi(const char *str); 34 | void ft_bzero(void *s, size_t n); 35 | void *ft_calloc(size_t count, size_t size); 36 | int ft_isascii(int c); 37 | int ft_isalnum(int c); 38 | int ft_isalpha(int c); 39 | int ft_isdigit(int c); 40 | int ft_isprint(int c); 41 | char *ft_itoa(int n); 42 | void ft_lstadd_back(t_list **lst, t_list *new); 43 | void ft_lstadd_front(t_list **lst, t_list *new); 44 | void ft_lstclear(t_list **lst, void (*del)(void *)); 45 | void ft_lstdelone(t_list *lst, void (*del)(void *)); 46 | t_list *ft_lstlast(t_list *lst); 47 | t_list *ft_lstnew(void *content); 48 | int ft_lstsize(t_list *lst); 49 | void *ft_memchr(const void *s, int c, size_t n); 50 | int ft_memcmp(const void *s1, const void *s2, size_t n); 51 | void *ft_memcpy(void *dest, const void *src, size_t n); 52 | void *ft_memmove(void *dst, const void *src, size_t len); 53 | void *ft_memset(void *s, int c, size_t n); 54 | void ft_putchar_fd(char c, int fd); 55 | void ft_putendl_fd(char *s, int fd); 56 | void ft_putstr_fd(char *s, int fd); 57 | void ft_putnbr_fd(int n, int fd); 58 | char **ft_split(char const *s, char c); 59 | char *ft_strchr(const char *s, int c); 60 | char *ft_strdup(const char *s1); 61 | void ft_striteri(char *s, void (*f)(unsigned int, char*)); 62 | char *ft_strjoin(char const *s1, char const *s2); 63 | size_t ft_strlcat(char *dst, const char *src, size_t dstsize); 64 | size_t ft_strlcpy(char *dst, const char *src, size_t dstsize); 65 | size_t ft_strlen(const char *s); 66 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); 67 | int ft_strncmp(const char *s1, const char *s2, size_t n); 68 | char *ft_strnstr(const char *haystack, const char *needle, size_t len); 69 | char *ft_strrchr(const char *s, int c); 70 | char *ft_strtrim(char const *s1, char const *set); 71 | char *ft_substr(char const *s, unsigned int start, size_t len); 72 | int ft_toupper(int c); 73 | int ft_tolower(int c); 74 | //void *rand_string(int i); 75 | //int pegadinha(); 76 | int ft_strncmplist(const char *s1, const t_list *list, size_t n); 77 | #endif 78 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/gnlsources/get_next_line.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: coder +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2022/09/14 19:44:35 by coder #+# #+# */ 9 | /* Updated: 2022/10/14 16:05:45 by edu ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "get_next_line.h" 14 | 15 | static char *set_buffer(int fd, char *buffer); 16 | static char *get_line(char *buffer); 17 | static char *go_to_next_line(char *buffer); 18 | 19 | char *get_next_line(int fd) 20 | { 21 | static char *buf; 22 | char *line; 23 | 24 | if (fd < 0 || BUFFER_SIZE <= 0) 25 | return (NULL); 26 | buf = set_buffer(fd, buf); 27 | if (buf == NULL) 28 | return (NULL); 29 | line = get_line(buf); 30 | buf = go_to_next_line(buf); 31 | return (line); 32 | } 33 | 34 | static char *set_buffer(int fd, char *buffer) 35 | { 36 | char *tmp; 37 | ssize_t i; 38 | 39 | i = 0; 40 | tmp = ft_calloc(BUFFER_SIZE + 1, sizeof(char)); 41 | if (tmp == NULL) 42 | return (NULL); 43 | while (gnl_strchr(buffer, '\n') != 1) 44 | { 45 | i = read(fd, tmp, BUFFER_SIZE); 46 | if (i == 0 || i == -1) 47 | break ; 48 | tmp[i] = '\0'; 49 | buffer = gnl_strjoin(buffer, tmp); 50 | if (buffer == NULL) 51 | { 52 | free(tmp); 53 | return (NULL); 54 | } 55 | } 56 | free(tmp); 57 | if (i == -1) 58 | return (NULL); 59 | return (buffer); 60 | } 61 | 62 | static char *get_line(char *buffer) 63 | { 64 | char *line; 65 | size_t i; 66 | 67 | i = 0; 68 | if (*(buffer + i) == '\0') 69 | return (NULL); 70 | while (*(buffer + i) != '\0' && *(buffer + i) != '\n') 71 | i++; 72 | line = ft_calloc(i + (*(buffer + i) == '\n') + 1, sizeof(char)); 73 | if (line == NULL) 74 | return (NULL); 75 | i = 0; 76 | while (*(buffer + i) != '\0' && *(buffer + i) != '\n') 77 | { 78 | *(line + i) = *(buffer + i); 79 | i++; 80 | } 81 | if (*(buffer + i) == '\n') 82 | { 83 | *(line + i) = '\n'; 84 | i++; 85 | } 86 | return (line); 87 | } 88 | 89 | static char *go_to_next_line(char *buffer) 90 | { 91 | char *next; 92 | size_t i; 93 | size_t j; 94 | 95 | i = 0; 96 | j = 0; 97 | while (*(buffer + i) != '\n' && *(buffer + i) != '\0') 98 | i++; 99 | if (*(buffer + i) == '\0') 100 | { 101 | free(buffer); 102 | return (NULL); 103 | } 104 | next = ft_calloc((ft_strlen(buffer) - i + 1), sizeof(char)); 105 | if (next == NULL) 106 | return (NULL); 107 | i++; 108 | while (*(buffer + i + j) != '\0') 109 | { 110 | *(next + j) = *(buffer + i + j); 111 | j++; 112 | } 113 | free(buffer); 114 | return (next); 115 | } 116 | -------------------------------------------------------------------------------- /GDB e Valgrind/libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: coder +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2022/08/27 15:51:38 by coder #+# #+# # 9 | # Updated: 2023/06/21 06:23:44 by coder ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | 15 | PATH_LIBSRCS = libsources 16 | PATH_GNLSRCS = gnlsources 17 | PATH_FT_PRINTFSRCS = ft_printfsources 18 | PATH_LLSRCS = llsources 19 | PATH_INCL = includes 20 | PATH_OBJS = . 21 | 22 | CCFLAGS = -Wall -Wextra -Werror 23 | 24 | LIBSRCS = $(addprefix $(PATH_LIBSRCS)/, ft_atoi.c \ 25 | ft_bzero.c \ 26 | ft_calloc.c \ 27 | ft_isalnum.c \ 28 | ft_isalpha.c \ 29 | ft_isascii.c \ 30 | ft_isdigit.c \ 31 | ft_isprint.c \ 32 | ft_itoa.c \ 33 | ft_memchr.c \ 34 | ft_memcmp.c \ 35 | ft_memcpy.c \ 36 | ft_memmove.c \ 37 | ft_memset.c \ 38 | ft_putchar_fd.c \ 39 | ft_putendl_fd.c \ 40 | ft_putnbr_fd.c \ 41 | ft_putstr_fd.c \ 42 | ft_split.c \ 43 | ft_strchr.c \ 44 | ft_strdup.c \ 45 | ft_striteri.c \ 46 | ft_strjoin.c \ 47 | ft_strlcat.c \ 48 | ft_strlcpy.c \ 49 | ft_strlen.c \ 50 | ft_strmapi.c \ 51 | ft_strncmp.c \ 52 | ft_strnstr.c \ 53 | ft_strrchr.c \ 54 | ft_strtrim.c \ 55 | ft_substr.c \ 56 | ft_tolower.c \ 57 | ft_toupper.c \ 58 | rand_string.c) 59 | 60 | GNLSRCS = $(addprefix $(PATH_GNLSRCS)/, get_next_line.c \ 61 | get_next_line_utils.c) 62 | 63 | FT_PRINTFSRCS = $(addprefix $(PATH_FT_PRINTFSRCS)/, ft_printf.c \ 64 | ft_print.c \ 65 | ft_printf_utils.c \ 66 | ft_putchar.c \ 67 | ft_putnbr.c \ 68 | ft_putnbr_hex.c \ 69 | ft_putstr.c) 70 | 71 | LLSRCS = $(addprefix $(PATH_LLSRCS)/, ft_lstadd_back.c \ 72 | ft_lstadd_front.c \ 73 | ft_lstclear.c \ 74 | ft_lstdelone.c \ 75 | ft_lstiter.c \ 76 | ft_lstlast.c \ 77 | ft_lstmap.c \ 78 | ft_lstnew.c \ 79 | ft_lstsize.c) 80 | 81 | LIBOBJS = $(LIBSRCS:$(PATH_LIBSRCS)/%.c=$(PATH_OBJS)/%.o) 82 | GNLOBJS = $(GNLSRCS:$(PATH_GNLSRCS)/%.c=$(PATH_OBJS)/%.o) 83 | FT_PRINTFOBJS = $(FT_PRINTFSRCS:$(PATH_FT_PRINTFSRCS)/%.c=$(PATH_OBJS)/%.o) 84 | LLOBJS = $(LLSRCS:$(PATH_LLSRCS)/%.c=$(PATH_OBJS)/%.o) 85 | 86 | all: $(NAME) 87 | 88 | $(NAME): $(LIBOBJS) $(GNLOBJS) $(FT_PRINTFOBJS) $(LLOBJS) 89 | ar rcs $(NAME) $(LIBOBJS) $(GNLOBJS) $(LLOBJS) $(FT_PRINTFOBJS) 90 | 91 | $(LIBOBJS): $(LIBSRCS) 92 | $(CC) $(CCFLAGS) -I $(PATH_INCL)/ -c $(LIBSRCS) 93 | 94 | $(GNLOBJS): $(GNLSRCS) 95 | $(CC) $(CCFLAGS) -D BUFFER_SIZE=1 -I $(PATH_INCL)/ -c $(GNLSRCS) 96 | 97 | $(FT_PRINTFOBJS): $(FT_PRINTFSRCS) 98 | $(CC) $(CCFLAGS) -I $(PATH_INCL)/ -c $(FT_PRINTFSRCS) 99 | 100 | $(LLOBJS): $(LLSRCS) 101 | $(CC) $(CCFLAGS) -I $(PATH_INCL)/ -c $(LLSRCS) 102 | 103 | clean: 104 | /bin/rm -f *.o 105 | 106 | fclean: clean 107 | /bin/rm -f $(NAME) 108 | 109 | re: fclean all 110 | 111 | .PHONY = all clean fclean re 112 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 💻 Coding dojo 2 | 3 | > Coding dojo é um conceito inspirado nas artes maciais onde 2 lutadores praticam algo no dojo enquanto os demais olham e aprendem. 🤓 4 | 5 | O coding dojo consiste em um grupo de pelo menos 3 pessoas que se revezam entre codar, colaborar e observar. 6 | 7 | #### Objetivo do coding dojo: 8 | ❌ não é ser uma competição 9 | ✅ e sim um ambiente de aprendizado e colaboração 10 | ❌ não é sobre quem resolve o desafio mais rápido 11 | ✅ e sim sobre quem consegue resolver o desafio integrando todo o time 12 | 13 | ## Alguns conceitos fundamentais 14 | - Pair Programming: programação em par; 15 | - Baby steps: cada etapa para a solução deve ser pequena o suficiente para que todos possam compreender e replicar mais tarde; 16 | - Test Driven Development — TDD: antes de ser escrito uma implementação de código é escrito um teste; 17 | - Refactoring: refatoração de código; 18 | 19 | ## Como montar um dojo? 20 | 21 | - [ ] Considere um tempo de 1h30 no total! 22 | - [ ] Estabeleça o objetivo do desafio. Pode ser praticar algoritmos, ter contato com uma tecnologia específica... 23 | - [ ] O que você vai usar de ferramentas? 24 | - [ ] Pensando no objetivo, se você precisa de uma etapa inicial que talvez demande um pouco mais de tempo (como instalar um docker) considere fazer isso antes e salvar os comandos ou instruções utilizados. Assim você pode passar o comecinho já pronto pra quem for participar poder avançar rapidamente por essa etapa. 25 | - [ ] Você pode usar um outro dojo como referência de início para o seu, ex: "Começe seguindo os passos do dojo de postgres e volte para cá". 26 | - [ ] Há desafios prontos na internet que você pode adaptar, páginas como leetcode podem te ajudar 😉 27 | - [ ] Experimente o desafio todo antes de aplicar e recomendamos que faça isso nos computadores das naves 28 | 29 | ## 🚀 Começando o dojo 30 | 31 | 32 | - O grupo precisa ter equipes com pelo menos 3 pessoas: 33 | 1 pessoa que será o piloto, essa é a pessoa que vai codar. 34 | 1 pessoa que será o navegador, essa pessoa conversa e troca com o piloto. 35 | 1 pessoa ao menos para ser platéia, ela pode buscar coisas na internet enquanto os dois exercitam o P2P mas só pode conversar com outras pessoas da plateia. Falar com quem está codando somente se for solicitado (é difícil, mas segura a ansiedade hehe). 36 | 37 | > A cada 5 a 7 minutos quem está como piloto passa a ser plateia, quem está como navegador passa a pilotar e quem está na plateia passa a navegar. 38 | 39 | #### Instrua o grupo participante sobre o desafio a ser resolvido e informe se haverá algum prêmio e quais são as regras. 40 | - O desafio é em etapas? Explique bem como serão. 41 | Ex: desafio de algoritmos onde o objetivo é fazer um programa que recebe uma string e responde se ela é ou não é um palíndromo. 42 | - Considere passar pequenos desafios como construir um teste para receber uma string qualquer. Se o teste quebra, libera o grupo para escrever o código que faz passar no teste. 43 | - Após o código escrito e passando no teste, recomende que o grupo refatore o código se fizer sentido. 44 | 45 | ## 📫 Contribuindo para os dojos da 42 46 | 47 | Quer propor um desafio? Se você é da 42, pega essas infos, pensa em algo e apresenta pra comunidade! 48 | Se você não faz parte da comunidade mas quer desafiar a gente, siga estas etapas: 49 | 50 | 1. Crie um fork deste repositório. 51 | 2. Crie um branch: `git checkout -b `. 52 | 3. Faça suas alterações e confirme-as: `git commit -m ''` 53 | 4. Envie para o branch original: `git push origin / ` 54 | 5. Crie a solicitação de pull. 55 | 56 | Como alternativa, consulte a documentação do GitHub em [como criar uma solicitação pull](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). 57 | -------------------------------------------------------------------------------- /Rust/README.md: -------------------------------------------------------------------------------- 1 | # Rust Coding Dojo 2 | 3 | Welcome to the 42sp Rust coding dojo. 4 | 5 | ``` rust 6 | fn welcome() { 7 | println!("Hello, 42"); 8 | } 9 | ``` 10 | 11 | # Rust 12 | 13 | #### Empowering Safe and Efficient Systems Programming 14 | 15 | [Rust](https://www.rust-lang.org/) Is a modern systems programming language developed by Mozilla Research and the open-source community. It is designed to provide memory safety, concurrency, and performance. 16 | One of Rust's key differentiators is its focus on memory safety. It guarantees memory safety without sacrificing performance, preventing null pointer dereferences and data races at compile time. 17 | 18 | ### Features 19 | 20 | - Memory Safety: Rust guarantees memory safety at compile time, eliminating null pointer dereferences and data races. It enforces strict ownership, borrowing, and lifetimes, preventing common memory-related bugs. 21 | 22 | - Concurrency: Rust provides built-in support for safe concurrent programming. It ensures thread safety through its ownership model and enforces strict rules to prevent data races, allowing developers to write concurrent code without worrying about race conditions. 23 | 24 | - Performance: Rust delivers high performance by providing control over low-level details without sacrificing safety. It offers zero-cost abstractions, allowing developers to write code that is close to the metal, making it suitable for systems programming, networking, and other performance-critical applications. 25 | 26 | - Expressive Type System: Rust has a powerful and expressive type system that enables strong static typing, pattern matching, and algebraic data types (enums). This facilitates code reuse, error handling, and creating flexible abstractions. 27 | 28 | - Traits and Generics: Rust uses traits, similar to interfaces, to achieve code reuse and ad-hoc polymorphism. It supports generics, enabling the creation of reusable functions and data structures. 29 | 30 | - Pattern Matching: Rust provides pattern matching, allowing developers to destructure complex data structures and write expressive conditionals. Pattern matching simplifies control flow and data processing, leading to cleaner and more readable code. 31 | 32 | - Error Handling: Rust has a built-in error handling mechanism called "Result" and "Option" types. It encourages explicit handling of errors and forces developers to handle all possible error scenarios, improving code reliability. 33 | 34 | - Cargo Package Manager: Rust comes with Cargo, a powerful package manager and build system. Cargo streamlines project management, dependency resolution, and building, making it easier to manage and distribute Rust projects. 35 | - Cross-platform Support: Rust supports cross-platform development, allowing developers to write code that runs seamlessly on different operating systems and architectures. 36 | 37 | - Interoperability: Rust offers seamless interoperability with other programming languages, particularly C/C++. It provides a Foreign Function Interface (FFI) that enables calling C/C++ libraries and allows developers to leverage existing codebases. 38 | 39 | # Challenges 40 | 41 | In This Coding Dojo you will implement a set of libft functions and, for those who dare, a special puzzle from [Advent of Code](https://adventofcode.com/) using Rust. 42 | 43 | - ft_putstr 44 | - ft_strlen 45 | - ft_strcpy 46 | - ft_strjoin 47 | - ft_split 48 | - [AOC - Day 1, Part1](https://adventofcode.com/2022/day/1) 49 | 50 | ### Bonus 51 | - Enjoyed AOC? Their challenges can get pretty tough! 52 | - Can you get_next_line? 53 | 54 | # Compiling and executing 55 | 56 | We are going to use Rust's powerful package manager, Cargo. It is used to install dependecies, compile our crates (Rust packages) and make them distributable. Run `install_rust.sh` to install it. 57 | 58 | In the root of the repository, simply run: 59 | ```sh 60 | cargo run 61 | ``` 62 | It will compile, if it is not already compiled, and run the code. Beware! Rust's compiler is as strict as the norm regarding memory safety. 63 | 64 | # References 65 | 66 | * https://doc.rust-lang.org/stable/reference/index.html - The Rust Reference 67 | * https://doc.rust-lang.org/book/ - The Rust Programming Language 68 | * https://doc.rust-lang.org/stable/rust-by-example/ - Rust by Example 69 | 70 | Have fun :) 71 | -------------------------------------------------------------------------------- /MLX/Paint/README.md: -------------------------------------------------------------------------------- 1 | # Capitulo 1 2 | ## Introducao 📢 3 | 4 | > Mario Paint (マリオペイント Mario Peinto) é um jogo eletrônico de desenho de 1992 para o Super Nintendo Entertainment System. Ele foi lançado junto com o acessório Super NES Mouse. Foi desenvolvido pela Nintendo e a Intelligent Systems. -- WIKI, Pedia 2023 5 | 6 | > O que a Nintendo tava pensando quando lançou esse banger? 7 | 8 |
9 | Não, ele não se chamava Mickey 10 |
11 | 12 | # Capitulo 2 13 | ## Objetivo 🎯 14 | 15 | Por mais que os usuários de N/Vim não gostem do mouse, esse projeto é sobre aprender a amá-lo. 16 |   Tenha em mente que o mouse que deve ser utilizado para esse projeto é o padrão mais comum do mercado (dois botões superiores, um botão no scroll e o próprio scroll), mouses com botões laterais serão ignorados. 17 | 18 | # Capitulo 3 19 | ## Instrucoes Comuns 📝 20 | 21 | - Você deve codar em C. 22 | - Não há norma, voe alto como um pássaro livre. 23 | - Seu programa não deve apresentar errors fatais (segfault, bus error, double free, etc) ou comportamento inesperado. 24 | - Um makefile já estará disponível, você pode modificá-lo, mas não mexa muito. 25 | - Bônus devem estar em uma pasta separada (`cp` é um comando amigo). 26 | - Você deve utilizar a biblioteca gráfica MiniLibX. 27 | - Você deve criar uma imagem, desenhar diretamente na janela é estritamente proibido. 28 | - Por **Neith**! Use seu cérebro. 29 | 30 | # Capitulo 4 31 | ## Parte Mandatoria - MPaint.exec 🔰 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
Nome do programaMPaint.exec
Arquivos necessáriosYES.
DescriçãoVocê deverá criar um simples software de pintura.
47 | 48 | ### Graficos 👾 49 | 50 | - Você deve ter um hud que não faz parte do canvas do usuário (pense bem antes de limitar o tamanho do canvas). 51 | - Seu software deve ser responsivo. 52 | 53 | 57 | 58 | ### Software 💻 59 | 60 | - Seu hud deve conter as 9 cores básicas (vermelho, verde, azul, amarelo, magenta, roxo, ciano, branco e preto). 61 | - Você deve ser capaz de selecionar uma cor e desenhar com ela ao clicar com o botão esquerdo do mouse. 62 | - Seu hud deve mostrar a atual cor selecionada. 63 | - Ao apertar ESC o programa deve fechar. 64 | - Ao clicar no X da janela o programa deve fechar. 65 | 66 | 71 | 72 | # Capitulo 5 73 | ## Bonus - MPaint.bonus ⭐ 74 | 75 | - Você devera criar outro programa, dessa vez chamado `MPaint.bonus`. 76 | 77 | Você pode adicionar qualquer um desses bonus, ou todos para se sentir um especialista: 78 | 79 | - Implementar a ferramenta linha. 80 | - Implementar a ferramenta retângulo. 81 | - Implementar a ferramenta balde de tinta. 82 | - Adicionar mais cores. 83 | - Adicionar um botão de limpar. 84 | - Desenhar com outra cor ao clicar com o botão direito do mouse. 85 | - Sumir com o mouse (talvez a função da França falhe! Se falhar, ignore esse bonus). 86 | 87 | ### Bonus exclusivo da CODAM 🌟 88 | 89 | - Permitir cores com transparência. 90 | - Mudar o ícone do mouse. 91 | -------------------------------------------------------------------------------- /minishell/tester/dojo_tester.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MINISHELL_PATH="../minishell" 4 | 5 | # Run a specific test if the file name was specified 6 | if [[ $1 ]]; then 7 | test_lists=( 8 | $1 9 | ) 10 | else 11 | test_lists=( 12 | "builtins" 13 | "pipes" 14 | "redirects" 15 | "extras" 16 | ) 17 | fi 18 | 19 | if [[ $1 == "wildcards" || $1 == "bonus" ]]; then 20 | MINISHELL_PATH="../minishell_bonus" 21 | fi 22 | 23 | BOLD="\e[1m" 24 | YELLOW="\033[0;33m" 25 | GREY="\033[38;5;244m" 26 | PURPLE="\033[0;35m" 27 | BLUE="\033[0;36m" 28 | RED="\e[0;31m" 29 | END="\033[0m" 30 | 31 | #chmod 000 ./test_files/invalid_permission 32 | mkdir ./outfiles 33 | mkdir ./mini_outfiles 34 | mkdir ./bash_outfiles 35 | 36 | printf $RED 37 | echo "🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥"; 38 | echo " "; 39 | echo " ██ ██ █ ██ █ █ █████ █ █ █████ █ █ ██████ █████ █████ ██████ █████ █████ "; 40 | echo " ███ ███ █ ███ █ █ █ █ █ █ █ █ ██ █ █ ██ █ █ ██ "; 41 | echo " █ ████ █ █ █ ██ █ █ █████ █████ ████ █ █ ██ ████ █████ ██ ████ █████ "; 42 | echo " █ ██ █ █ █ ██ █ █ █ █ █ █ █ █ ██ █ █ ██ █ █ ██ "; 43 | echo " █ █ █ █ ███ █ █████ █ █ █████ █████ █████ ██ █████ █████ ██ █████ █ ██ "; 44 | echo " "; 45 | echo "🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥"; 46 | echo " "; 47 | 48 | PROMPT=$(echo -e "\nexit\n" | $MINISHELL_PATH | head -n 1 | sed "s/\x1B\[[0-9;]\{1,\}[A-Za-z]//g" ) 49 | # Helper commands: 50 | REMOVE_COLORS="sed s/\x1B\[[0-9;]\{1,\}[A-Za-z]//g" 51 | REMOVE_EXIT="grep -v ^exit$" 52 | 53 | for testfile in ${test_lists[*]}; do 54 | 55 | printf $RED 56 | echo ———————————— $testfile 57 | 58 | while read teste; do 59 | ((i++)) 60 | 61 | rm -rf ./outfiles/* 62 | rm -rf ./mini_outfiles/* 63 | MINI_OUTPUT=$(echo -e "$teste" | $MINISHELL_PATH 2> /dev/null) 64 | 65 | MINI_OUTFILES=$(cp ./outfiles/* ./mini_outfiles &>/dev/null) 66 | MINI_EXIT_CODE=$(echo -e "$MINISHELL_PATH\n$teste\necho \$?\nexit\n" | bash 2> /dev/null | $REMOVE_COLORS | grep -vF "$PROMPT" | $REMOVE_EXIT | tail -n 1) 67 | MINI_ERROR_MSG=$(trap "" PIPE && echo "$teste" | $MINISHELL_PATH 2>&1 > /dev/null | grep -o '[^:]*$' ) 68 | 69 | rm -rf ./outfiles/* 70 | rm -rf ./bash_outfiles/* 71 | BASH_OUTPUT=$(echo -e "$teste" | bash 2> /dev/null) 72 | BASH_EXIT_CODE=$(echo $?) 73 | BASH_OUTFILES=$(cp ./outfiles/* ./bash_outfiles &>/dev/null) 74 | BASH_ERROR_MSG=$(trap "" PIPE && echo "$teste" | bash 2>&1 > /dev/null | grep -o '[^:]*$' | head -n1) 75 | 76 | OUTFILES_DIFF=$(diff --brief ./mini_outfiles ./bash_outfiles) 77 | 78 | printf $YELLOW 79 | printf "Test %3s: " $i 80 | if [[ "$MINI_OUTPUT" == "$BASH_OUTPUT" && "$MINI_EXIT_CODE" == "$BASH_EXIT_CODE" && -z "$OUTFILES_DIFF" ]]; then 81 | printf ✅ 82 | ((ok++)) 83 | if [ "$MINI_ERROR_MSG" != "$BASH_ERROR_MSG" ]; then 84 | printf "⚠️ " 85 | fi 86 | else 87 | printf ❌ 88 | fi 89 | printf "$GREY $teste \n$END" 90 | if [ "$OUTFILES_DIFF" ]; then 91 | echo "$OUTFILES_DIFF" 92 | echo mini outfiles: 93 | cat ./mini_outfiles/* 94 | echo bash outfiles: 95 | cat ./bash_outfiles/* 96 | fi 97 | if [ "$MINI_OUTPUT" != "$BASH_OUTPUT" ]; then 98 | echo mini output = \($MINI_OUTPUT\) 99 | echo bash output = \($BASH_OUTPUT\) 100 | fi 101 | if [ "$MINI_EXIT_CODE" != "$BASH_EXIT_CODE" ]; then 102 | echo mini exit code = $MINI_EXIT_CODE 103 | echo bash exit code = $BASH_EXIT_CODE 104 | fi 105 | if [ "$MINI_ERROR_MSG" != "$BASH_ERROR_MSG" ]; then 106 | echo mini error = \($MINI_ERROR_MSG\) 107 | echo bash error = \($BASH_ERROR_MSG\) 108 | fi 109 | done < $testfile 110 | done 111 | 112 | rm -rf ./outfiles 113 | rm -rf ./mini_outfiles 114 | rm -rf ./bash_outfiles 115 | 116 | printf $PURPLE 117 | printf $BOLD 118 | echo $ok/$i 119 | printf $END 120 | 121 | if [[ "$ok" == "$i" ]]; then 122 | echo "🎊 🎊 🎊" 123 | echo "😎 😎 😎" 124 | echo "🎉 🎉 🎉" 125 | exit 0 126 | else 127 | echo "😭 😭 😭" 128 | exit 1 129 | fi 130 | -------------------------------------------------------------------------------- /CSSDesafios/01_Tucano/README.md: -------------------------------------------------------------------------------- 1 |

2 | Tucano e nenem tucanozinho 3 |

4 | 5 |

6 | CSSDesafios/01_Tucano 7 |

8 | 9 |

10 | Crie um Tucano com formas geométricas utilizando apenas HTML e CSS
11 |

12 | 13 | ## O Tucano: Uma Breve Introdução 14 | O tucano é uma ave tropical lindíssima, famosa por suas plumagens deslumbrantes e por um bico amarelo-alaranjado que mais parece uma obra de arte. Eles são conhecidos por sua vivacidade e são frequentemente associados à fauna exuberante das florestas tropicais da América Central e América do Sul. Que tal reproduzir essa beleza? 15 | 16 | ## 🚀 O Desafio 17 | Seu desafio é utilizar apenas HTML e CSS para recriar o tucano em um estilo flat geométrico (conforme mostrado no exemplo).
18 | ❗️ | Para conseguir realizar este desafio, você precisará ter conhecimento básico da sintaxe do HTML e CSS. Caso ainda não tenha, este projeto pode ajudá-lo, porém, a dificuldade será maior. 19 | 20 | Pontos a serem considerados durante a criação: 21 | - Não utilize arquivos externos não-CSS ou HTML para compor a arte, como SVG, PNG, JPG e outros. A ideia do desafio é que você seja capaz de criar cada elemento manualmente, sem a necessidade de importar assets externos no projeto. 22 | - Mantenha o projeto organizado: No desafio, há uma 'organização padrão' de como você pode entregar/produzir o projeto. Você não precisa seguir essa organização à risca, mas é bom que você tenha um arquivo dedicado ao HTML e outro ao CSS. Além disso, o arquivo variables.css presente dentro da pasta assets/css pode ajudá-lo a economizar tempo em relação à paleta de cores e ao reset no estilo padrão da web. 23 | - Sua arte deve ser responsiva, adaptando-se ao tamanho de tela em diferentes dispositivos. 24 | - Você não precisa ser fiel à paleta de cores presente no projeto. Caso queira alterá-la, fique à vontade. Imagine um tucano com a paleta de cores LGBTQIA+ ? 25 | 26 | ⭐ Bônus: Através do hover ou/e do focus, é possível interagir com o seu desenho de alguma forma. Seja o pássaro piscando ou interagindo com o neném. Você tem total liberdade criativa!
27 | ⭐⭐ Bônus do Bônus: Ter um repositório no Github para hospedar a sua solução, com um readme bonito e compartilhar o resultado nas redes sociais como no LinkedIn através da hashtag #42SPDOJOS e marcar a 42São Paulo na postagem. 28 | 29 | ## Estrutura do diretorio/ 30 | - ```Assets/``` | Pasta de Assets com uma subpasta dedicada ao CSS que contém as variáveis das cores a serem chamadas no projeto, e outra subpasta dedicada às imagens da arte com as quais você irá se referenciar na hora de criar. 31 | - ```index.html``` | Arquivo HTML com a estrutura básica pronta. 32 | - ```README.md``` | Com instruções sobre o desafio. 33 | 34 | ## Dicas 😜 35 | ### Dica de ouro! ✨ 36 | - Não tente fazer todos os passos de uma vez. Use Baby Steps! 👶🏾🍼 37 | ### Dica de prata! 38 | - Utilizar as propriedades para arredondar as bordas, posicionamentos específicos e sobreposições podem te ajudar. 39 | - Tenha o guia de estilo em mãos (ele está dentro da pasta assets/images), pois ele o ajudará a visualizar as formas geométricas necessárias a serem criadas. Caso ainda esteja enfrentando dificuldades em relação aos tamanhos, paletas e afins, acesse o Figma do desafio [Desafio do Tucano - 42Figma](https://www.figma.com/file/IMqXIoyd5fpnFveUSi3euf/42Dojos?type=design&node-id=0%3A1&mode=design&t=i1jCWuPBO5xVfzl7-1) e cutuque a arte. 🐦 40 | 41 | ## 🛠️ Instalações 42 | ### Requisitos/ Recomendações 43 | - Computador : Desktop, laptop etc. 44 | - Editor de Código : Visual Studio Code, Sublime Text, Atom, Brackets, entre outros. 45 | - Navegador Web : Google Chrome, Mozilla Firefox, Microsoft Edge ou/e Safari. 46 | 47 | ## 📎 Referências 48 | - [The Shapes of CSS](https://css-tricks.com/the-shapes-of-css/) | É possível ir além de quadrados, retângulos e círculos com CSS. 49 | - [Extensao : Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) | Extensão p/ o VSCODE que permite iniciar um servidor local diretamente do VSCode para testar seu site ou aplicativo web. Ele atualiza automaticamente a página no navegador quando você faz alterações no código, 50 | - [Batalha de CSS](https://cssbattle.dev/) | Caso você queira treinar off, neste site existem desafios diários que irão te ajudar ainda mais a praticar. 51 | - [Beresnev - Tucano](https://dribbble.com/Beresnev) | O tucano foi reproduzido utilizando as artes do artista como inspiração. 52 | - RTFM! 53 | 54 |

Desenvolvido com 💙 de Cadete para Cadetes

55 | -------------------------------------------------------------------------------- /CSSDesafios/00_Gatinho/README.md: -------------------------------------------------------------------------------- 1 |

2 | Gatingo Laranja 3 |

4 | 5 |

6 | CSSDesafios/00_Gatinho 7 |

8 | 9 |

10 | Crie um gatinho com formas geométricas utilizando apenas HTML e CSS
11 |

12 | 13 | ## O Gatinho Alaranjado: Uma Breve Introdução 14 | É laranja, odeia as segundas-feiras e gosta de lasanha. A primeira imagem que vem à sua mente é ele, não é? O Garfield.
15 | Sabia que o criador de Garfield, Jim Davis, escolheu a cor laranja para o personagem porque ela está associada à diversão e ao entusiasmo? Além disso, ele queria que Garfield fosse um gato que se destacasse em qualquer tira de quadrinhos, e o laranja certamente faz isso! Que tal reproduzir essa bolinha de pelos através do CSS? 16 | 17 | ## 🚀 O Desafio 18 | Seu desafio é utilizar apenas HTML e CSS para recriar um gatinho em um estilo flat geométrico (conforme mostrado no exemplo).
19 | ❗️ | Para conseguir realizar este desafio, você precisará ter conhecimento básico da sintaxe do HTML e CSS. Caso ainda não tenha, este projeto pode ajudá-lo, porém, a dificuldade será maior. 20 | 21 | Pontos a serem considerados durante a criação: 22 | - Não utilize arquivos externos não-CSS ou HTML para compor a arte, como SVG, PNG, JPG e outros. A ideia do desafio é que você seja capaz de criar cada elemento manualmente, sem a necessidade de importar assets externos no projeto. 23 | - Mantenha o projeto organizado: No desafio, há uma 'organização padrão' de como você pode entregar/produzir o projeto. Você não precisa seguir essa organização à risca, mas é bom que você tenha um arquivo dedicado ao HTML e outro ao CSS. Além disso, o arquivo variables.css presente dentro da pasta assets/css pode ajudá-lo a economizar tempo em relação à paleta de cores e ao reset no estilo padrão da web. 24 | - Sua arte deve ser responsiva, adaptando-se ao tamanho de tela em diferentes dispositivos. 25 | - Você não precisa ser fiel à paleta de cores presente no projeto. Caso queira alterá-la, fique à vontade. Imagine um gatinho siames ou roxo >:o ? 26 | 27 | ⭐ Bônus: Através do hover ou/e do focus, é possível interagir com o seu desenho de alguma forma. Seja o gato piscando ou I dont know. Você tem total liberdade criativa!
28 | ⭐⭐ Bônus do Bônus: Ter um repositório no Github para hospedar a sua solução, com um readme bonito e compartilhar o resultado nas redes sociais como no LinkedIn através da hashtag #42SPDOJOS e marcar a 42São Paulo na postagem. 29 | 30 | ## Estrutura do diretorio/ 31 | - ```Assets/``` | Pasta de Assets com uma subpasta dedicada ao CSS que contém as variáveis das cores a serem chamadas no projeto, e outra subpasta dedicada às imagens da arte com as quais você irá se referenciar na hora de criar. 32 | - ```index.html``` | Arquivo HTML com a estrutura básica pronta. 33 | - ```README.md``` | Com instruções sobre o desafio. 34 | 35 | ## Dicas 😜 36 | ### Dica de ouro! ✨ 37 | - Não tente fazer todos os passos de uma vez. Use Baby Steps! 👶🏾🍼 38 | ### Dica de prata! 39 | - Utilizar as propriedades para arredondar as bordas, posicionamentos específicos e sobreposições podem te ajudar. 40 | - Tenha o guia de estilo em mãos (ele está dentro da pasta assets/images), pois ele o ajudará a visualizar as formas geométricas necessárias a serem criadas. Caso ainda esteja enfrentando dificuldades em relação aos tamanhos, paletas e afins, acesse o Figma do desafio [Desafio do Gatinho - 42Figma](https://www.figma.com/file/IMqXIoyd5fpnFveUSi3euf/42Dojos?type=design&node-id=221%3A2&mode=design&t=wo78ck9618arm03H-1) e cutuque a arte. 🐱 41 | 42 | ## 🛠️ Instalações 43 | ### Requisitos/ Recomendações 44 | - Computador : Desktop, laptop etc. 45 | - Editor de Código : Visual Studio Code, Sublime Text, Atom, Brackets, entre outros. 46 | - Navegador Web : Google Chrome, Mozilla Firefox, Microsoft Edge ou/e Safari. 47 | 48 | ## 📎 Referências 49 | - [The Shapes of CSS](https://css-tricks.com/the-shapes-of-css/) | É possível ir além de quadrados, retângulos e círculos com CSS. 50 | - [Extensao : Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) | Extensão p/ o VSCODE que permite iniciar um servidor local diretamente do VSCode para testar seu site ou aplicativo web. Ele atualiza automaticamente a página no navegador quando você faz alterações no código. 51 | - [Batalha de CSS](https://cssbattle.dev/) | Caso você queira treinar off, neste site existem desafios diários que irão te ajudar ainda mais a praticar. 52 | - [Duolingo](https://pt.duolingo.com/) | O gatino foi reproduzido utilizando como referencia o gatinho do Duolingo. 53 | - RTFM! 54 | 55 |

Desenvolvido com 💙 de Cadete para Cadetes

--------------------------------------------------------------------------------