├── .idea ├── .gitignore ├── misc.xml ├── vcs.xml ├── Computer-Science-Study.iml └── modules.xml ├── resumos ├── cursos │ └── cs50 │ │ ├── all-challenges │ │ ├── labs │ │ │ ├── songs │ │ │ │ ├── 1.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 8.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 6.sql │ │ │ │ └── 7.sql │ │ │ ├── birthdays │ │ │ │ ├── birthdays.db │ │ │ │ ├── application.py │ │ │ │ ├── static │ │ │ │ │ └── styles.css │ │ │ │ └── templates │ │ │ │ │ └── index.html │ │ │ ├── ethics │ │ │ │ └── Facebook and Fake News.pdf │ │ │ ├── trivia │ │ │ │ ├── styles.css │ │ │ │ └── index.html │ │ │ ├── worldcup │ │ │ │ └── tournament.py │ │ │ └── inheritance │ │ │ │ └── inheterance.c │ │ ├── problems │ │ │ ├── movies │ │ │ │ ├── 1.sql │ │ │ │ ├── 2.sql │ │ │ │ ├── 4.sql │ │ │ │ ├── 3.sql │ │ │ │ ├── 5.sql │ │ │ │ ├── 6.sql │ │ │ │ ├── 7.sql │ │ │ │ ├── 8.sql │ │ │ │ ├── 9.sql │ │ │ │ ├── 10.sql │ │ │ │ ├── 11.sql │ │ │ │ ├── 13.sql │ │ │ │ └── 12.sql │ │ │ ├── finance │ │ │ │ ├── requirements.txt │ │ │ │ ├── finance.db │ │ │ │ ├── static │ │ │ │ │ ├── favicon.ico │ │ │ │ │ └── styles.css │ │ │ │ ├── templates │ │ │ │ │ ├── quoted.html │ │ │ │ │ ├── apology.html │ │ │ │ │ ├── quote.html │ │ │ │ │ ├── login.html │ │ │ │ │ ├── buy.html │ │ │ │ │ ├── register.html │ │ │ │ │ ├── sell.html │ │ │ │ │ ├── history.html │ │ │ │ │ ├── index.html │ │ │ │ │ └── layout.html │ │ │ │ └── helpers.py │ │ │ ├── fiftyville │ │ │ │ ├── answers.txt │ │ │ │ └── log.sql │ │ │ ├── sentimental │ │ │ │ ├── hello.py │ │ │ │ ├── mario-more.py │ │ │ │ ├── readability.py │ │ │ │ └── credit.py │ │ │ ├── homepage │ │ │ │ ├── assets │ │ │ │ │ └── video.mp4 │ │ │ │ ├── scripts.js │ │ │ │ ├── styles.css │ │ │ │ ├── currency.html │ │ │ │ ├── index.html │ │ │ │ ├── exchanges.html │ │ │ │ └── satoshi.html │ │ │ ├── scratch │ │ │ │ └── Bitcoin-Scratcher.sb3 │ │ │ ├── hello │ │ │ │ └── hello.c │ │ │ ├── mario │ │ │ │ └── mario-more.c │ │ │ ├── recover │ │ │ │ └── recover.c │ │ │ ├── readability │ │ │ │ └── readability.c │ │ │ ├── dna │ │ │ │ └── dna.py │ │ │ ├── plurality │ │ │ │ └── plurality.c │ │ │ ├── speller │ │ │ │ └── speller.c │ │ │ ├── substitution │ │ │ │ └── substitution.c │ │ │ ├── credit │ │ │ │ └── credit.c │ │ │ ├── filter │ │ │ │ └── filter-less.c │ │ │ └── runoff │ │ │ │ └── runoff.c │ │ └── final-project │ │ │ ├── images │ │ │ ├── cryfo16.png │ │ │ ├── cryfo32.png │ │ │ ├── cryfo48.png │ │ │ ├── cryfo128.png │ │ │ └── screenshot.png │ │ │ ├── manifest.json │ │ │ ├── options.html │ │ │ ├── LICENSE │ │ │ ├── options.css │ │ │ ├── popup.html │ │ │ ├── global.css │ │ │ ├── popup.js │ │ │ ├── popup.css │ │ │ ├── options.js │ │ │ └── README.md │ │ ├── security.md │ │ ├── final.md │ │ ├── lecture10.md │ │ ├── lecture6.md │ │ ├── lecture7.md │ │ ├── artificial-inteligence.md │ │ ├── lecture0.md │ │ ├── lecture9.md │ │ ├── lecture2.md │ │ ├── lecture3.md │ │ ├── lecture1.md │ │ ├── lecture5.md │ │ ├── lecture4.md │ │ └── lecture8.md ├── README.md ├── livros │ ├── getting-real │ │ ├── book │ │ │ └── Caindo-na-Real.pdf │ │ └── resumo-getting-real.md │ ├── programador-apaixonado │ │ └── images │ │ │ ├── oferta_demanda.png │ │ │ ├── trends-de-2019.jpg │ │ │ ├── mapa-tecnologias.png │ │ │ └── Schematic-representation-of-technology-adoption-curves-and-adopter-groups-with-defining.png │ ├── clean-code │ │ └── resumo.md │ └── the-pragmatic-programmer │ │ └── resumo-the-pragmatic-programmer.md ├── akita-videos │ ├── mm-m-melhor-livro-de-software.md │ ├── o-que-vem-depois-do-hello-world.md │ ├── introducao-a-videogames-e-emuladores.md │ ├── entendendo-git.md │ ├── covid-matou-minha-startup.md │ ├── aprendendo-sobre-computadores-com-mario-hardcore.md │ ├── hello-world-como-nunca-entendendo-c.md │ ├── arvores-o-comeco-de-tudo.md │ ├── qual-a-diferenca-entre-binarios-e-textos.md │ ├── guia-hardcore-introducao-a-computacao.md │ ├── o-computador-de-turing-e-von-neumann.md │ ├── o-dilema-das-redes-e-como-voce-e-manipulado.md │ ├── o-que-vem-depois-covid-19.md │ ├── selo-de-seguranca-e-marketing.md │ ├── o-guia-definitivo-de-aprendendo-a-aprender.md │ ├── rant-realidade-software-livre.md │ ├── so-precisamos-de-640-kb-de-memoria.md │ ├── discutindo-sobre-banco-de-dados.md │ └── rant-programacao-nao-e-facil.md └── posts │ ├── spectum-of-abstraction.md │ ├── como-o-cerebro-aprende-pierluigi.md │ └── good-code-checklist.md ├── header-iaurg.png └── LICENSE /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml 3 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/1.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/5.sql: -------------------------------------------------------------------------------- 1 | SELECT AVG(energy) FROM songs; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/2.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs ORDER BY tempo ASC; -------------------------------------------------------------------------------- /header-iaurg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/header-iaurg.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/8.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs WHERE name LIKE "%feat%"; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/1.sql: -------------------------------------------------------------------------------- 1 | SELECT title FROM movies WHERE year = 2008; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/3.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs ORDER BY duration_ms DESC LIMIT 5; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/2.sql: -------------------------------------------------------------------------------- 1 | SELECT birth FROM people WHERE name = "Emma Stone"; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/4.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(rating) FROM ratings WHERE rating = 10.0; -------------------------------------------------------------------------------- /resumos/README.md: -------------------------------------------------------------------------------- 1 | # Resumos 2 | 3 | Nesta pasta irei reunir os resumos e anotações que faço durante meus estudos. 4 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/requirements.txt: -------------------------------------------------------------------------------- 1 | cs50 2 | Flask 3 | Flask-Session 4 | requests 5 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/3.sql: -------------------------------------------------------------------------------- 1 | SELECT title FROM movies WHERE year > 2018 OR year = 2018 ORDER BY title ASC; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/4.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs WHERE danceability > 0.75 AND energy > 0.75 AND valence > 0.75; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/5.sql: -------------------------------------------------------------------------------- 1 | SELECT title, year FROM movies WHERE title LIKE "%Harry Potter%" ORDER BY year; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/6.sql: -------------------------------------------------------------------------------- 1 | SELECT AVG(rating) FROM ratings JOIN movies ON id = movie_id WHERE year = 2012; -------------------------------------------------------------------------------- /resumos/cursos/cs50/security.md: -------------------------------------------------------------------------------- 1 | # How keep your computer and phone secure 2 | 3 | Never trust. 4 | 5 | There's always a trade off. -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/6.sql: -------------------------------------------------------------------------------- 1 | SELECT name FROM songs WHERE artist_id = (SELECT id FROM artists WHERE name="Post Malone"); -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/songs/7.sql: -------------------------------------------------------------------------------- 1 | SELECT AVG(energy) FROM songs WHERE artist_id = (SELECT id FROM artists WHERE name="Drake"); -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/fiftyville/answers.txt: -------------------------------------------------------------------------------- 1 | The THIEF is:Ernest 2 | The thief ESCAPED TO:London 3 | The ACCOMPLICE is:Berthold 4 | -------------------------------------------------------------------------------- /resumos/livros/getting-real/book/Caindo-na-Real.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/livros/getting-real/book/Caindo-na-Real.pdf -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/sentimental/hello.py: -------------------------------------------------------------------------------- 1 | from cs50 import get_string 2 | 3 | answer = get_string("What is your name?") 4 | print("hello, " + answer) -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/birthdays/birthdays.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/labs/birthdays/birthdays.db -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/finance.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/problems/finance/finance.db -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/7.sql: -------------------------------------------------------------------------------- 1 | SELECT title, rating FROM movies JOIN ratings ON movie_id = id WHERE rating > 0 AND year = 2010 ORDER BY rating DESC, title ASC; -------------------------------------------------------------------------------- /resumos/livros/programador-apaixonado/images/oferta_demanda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/livros/programador-apaixonado/images/oferta_demanda.png -------------------------------------------------------------------------------- /resumos/livros/programador-apaixonado/images/trends-de-2019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/livros/programador-apaixonado/images/trends-de-2019.jpg -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/images/cryfo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/final-project/images/cryfo16.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/images/cryfo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/final-project/images/cryfo32.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/images/cryfo48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/final-project/images/cryfo48.png -------------------------------------------------------------------------------- /resumos/livros/programador-apaixonado/images/mapa-tecnologias.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/livros/programador-apaixonado/images/mapa-tecnologias.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/images/cryfo128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/final-project/images/cryfo128.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/assets/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/problems/homepage/assets/video.mp4 -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/final-project/images/screenshot.png -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/problems/finance/static/favicon.ico -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/ethics/Facebook and Fake News.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/labs/ethics/Facebook and Fake News.pdf -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/scratch/Bitcoin-Scratcher.sb3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/cursos/cs50/all-challenges/problems/scratch/Bitcoin-Scratcher.sb3 -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resumos/akita-videos/mm-m-melhor-livro-de-software.md: -------------------------------------------------------------------------------- 1 | # The MM-M: O Melhor Livro de Software? 2 | 3 | [Video](https://www.youtube.com/watch?v=wcGGklDfHM4) 4 | 5 | 6 | > Defina prioridades, milestones, datas finais. -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/8.sql: -------------------------------------------------------------------------------- 1 | SELECT name 2 | FROM people AS people 3 | JOIN stars AS stars ON people.id = stars.person_id 4 | JOIN movies AS movies ON movie_id = movies.id 5 | WHERE title = "Toy Story"; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/9.sql: -------------------------------------------------------------------------------- 1 | SELECT name 2 | FROM people AS people 3 | JOIN stars AS stars ON people.id = stars.person_id 4 | JOIN movies AS movies ON movies.id = stars.movie_id 5 | WHERE movies.year = 2004 6 | ORDER BY people.birth ASC; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/hello/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(void) 4 | { 5 | //Ask user name and print hello to them 6 | string name = get_string("What's your name?"); 7 | printf("hello, %s\n", name); 8 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/10.sql: -------------------------------------------------------------------------------- 1 | SELECT name 2 | FROM people AS people 3 | JOIN directors AS directors ON people.id = directors.person_id 4 | JOIN movies AS movies ON movies.id = directors.movie_id 5 | JOIN ratings AS ratings ON ratings.movie_id = movies.id 6 | WHERE ratings.rating >= 9.0; -------------------------------------------------------------------------------- /resumos/livros/programador-apaixonado/images/Schematic-representation-of-technology-adoption-curves-and-adopter-groups-with-defining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iaurg/Computer-Science-Study/HEAD/resumos/livros/programador-apaixonado/images/Schematic-representation-of-technology-adoption-curves-and-adopter-groups-with-defining.png -------------------------------------------------------------------------------- /resumos/posts/spectum-of-abstraction.md: -------------------------------------------------------------------------------- 1 | # Cheng Lou - On the Spectrum of Abstraction 2 | 3 | [Video](https://www.youtube.com/watch?v=mVVNJKv9esE) 4 | 5 | - Muitos problemas surgem do mal entendimento de onde estamos no nivel de abstração 6 | - Código é simples, a abstração é o ponto dificil que devemos estar atentos 7 | 8 | Rever -------------------------------------------------------------------------------- /.idea/Computer-Science-Study.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/quoted.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Quoted 5 | {% endblock %} 6 | 7 | {% block main %} 8 |

9 | A share of {{symbolValues.name}} ({{symbolValues.symbol}}) costs {{symbolValues.price | usd}} 10 |

11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/11.sql: -------------------------------------------------------------------------------- 1 | SELECT title 2 | FROM movies AS movies 3 | JOIN ratings AS ratings ON ratings.movie_id = movies.id 4 | JOIN stars AS stars ON stars.movie_id = movies.id 5 | JOIN people AS people ON people.id = stars.person_id 6 | WHERE people.name = "Chadwick Boseman" 7 | ORDER BY ratings.rating DESC 8 | LIMIT 5; -------------------------------------------------------------------------------- /resumos/akita-videos/o-que-vem-depois-do-hello-world.md: -------------------------------------------------------------------------------- 1 | # O que vem DEPOIS do Hello World | Consertando meu C 2 | 3 | [Video](https://www.youtube.com/watch?v=YyWMN_0g3BQ) 4 | 5 | > Cuidado com copy e paste de código 6 | 7 | 8 | ## Estudar sobre 9 | - Swift arc 10 | - Rust 11 | - Estatistica básica (curva gaussiana...) 12 | 13 | ## Links 14 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/13.sql: -------------------------------------------------------------------------------- 1 | SELECT name 2 | FROM people AS people 3 | JOIN stars AS stars ON people.id = stars.person_id 4 | WHERE stars.movie_id IN 5 | ( 6 | SELECT stars.movie_id 7 | FROM stars 8 | INNER JOIN people ON stars.person_id = people.id 9 | WHERE name = "Kevin Bacon" 10 | AND birth = 1958 11 | ) 12 | AND name != "Kevin Bacon"; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/apology.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Apology 5 | {% endblock %} 6 | 7 | {% block main %} 8 | {{ top }} 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /resumos/akita-videos/introducao-a-videogames-e-emuladores.md: -------------------------------------------------------------------------------- 1 | # Introdução a Videogames e Emuladores 2 | 3 | [Video](https://www.youtube.com/watch?v=vUqLLpUJ47s) 4 | 5 | ## Assistir: 6 | 7 | - [Modern Vintage Gamer](https://www.youtube.com/user/jimako123) 8 | - [Coding Secrets](https://www.youtube.com/channel/UCkY047vYjF92-8HcoVTXAOg) 9 | - [Retro Game Mechanics Explained](https://www.youtube.com/channel/UCwRqWnW5ZkVaP_lZF7caZ-g) 10 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/scripts.js: -------------------------------------------------------------------------------- 1 | async function getBtcPrice(){ 2 | const card = document.getElementById("card-btc") 3 | const currentPrice = await fetch("https://api.gdax.com/products/BTC-USD/book").then(response => response.json()) 4 | card.innerHTML = "1BTC = " + currentPrice.bids[0][0] 5 | } 6 | 7 | document.addEventListener("DOMContentLoaded", function(event) { 8 | getBtcPrice(); 9 | }); 10 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/movies/12.sql: -------------------------------------------------------------------------------- 1 | SELECT title 2 | FROM movies AS movies 3 | JOIN stars AS stars ON stars.movie_id = movies.id 4 | JOIN people AS people ON stars.person_id = people.id 5 | WHERE people.name = "Johnny Depp" 6 | 7 | INTERSECT 8 | 9 | SELECT title 10 | FROM movies AS movies 11 | JOIN stars AS stars ON stars.movie_id = movies.id 12 | JOIN people AS people ON stars.person_id = people.id 13 | WHERE people.name = "Helena Bonham Carter"; -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/quote.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Quote 5 | {% endblock %} 6 | 7 | {% block main %} 8 |
9 |
10 | 11 |
12 | 13 |
14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/sentimental/mario-more.py: -------------------------------------------------------------------------------- 1 | from cs50 import get_int 2 | from sys import exit 3 | 4 | height = get_int("Height: ") 5 | 6 | while height < 1 or height > 8: 7 | height = get_int("Height: ") 8 | 9 | for line in range(1, height + 1): 10 | 11 | for spaces in range(height - line): 12 | print(" ", end="") 13 | 14 | print(f"{line * '#'}", end="") 15 | 16 | for gap in range(2): 17 | print(" ", end="") 18 | 19 | print(f"{line * '#'}", end="\n") -------------------------------------------------------------------------------- /resumos/cursos/cs50/final.md: -------------------------------------------------------------------------------- 1 | # Final Project Readme 2 | 3 | - Extension to see cryptocurrencies on browser 4 | 5 | What will your software do? 6 | Provided a real time data from choosen cryptos inside browser extensions. 7 | 8 | What features will it have? 9 | - Save prefered cryptos 10 | - Order cryptos 11 | - See real time values and market 12 | - Find exchanges 13 | 14 | How will it be executed? 15 | - Creating extension for browser 16 | - Collect data from https://www.coingecko.com/en/api 17 | - Saved data into a custom python server 18 | -------------------------------------------------------------------------------- /resumos/akita-videos/entendendo-git.md: -------------------------------------------------------------------------------- 1 | # Entendendo GIT 2 | 3 | [Video](https://www.youtube.com/watch?v=6Czd1Yetaac) 4 | 5 | ## Desenvolvedores citados: 6 | 7 | - Junio Hamano 8 | - Linus Torvalds 9 | - Alan Cox 10 | - Andrew Morton 11 | - Eugene Roschal 12 | - Igor Pavlov 13 | - Phil Katz 14 | 15 | ## Video e materiais: 16 | 17 | - [Tech Talk Linus Git](https://www.youtube.com/watch?v=4XpnKHJAok8) 18 | - [Post Git Akita](https://www.akitaonrails.com/git) 19 | 20 | ## Estudar: 21 | 22 | - Algoritmo LCS 23 | - Algoritmo de Huffman 24 | - [Pro Git, Livro Oficial](https://git-scm.com/book/pt-br/v2) 25 | - CHMOD 26 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Log In 5 | {% endblock %} 6 | 7 | {% block main %} 8 |
9 |
10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /resumos/akita-videos/covid-matou-minha-startup.md: -------------------------------------------------------------------------------- 1 | # A COVID-19 matou minha Startup? 2 | 3 | [Video](https://www.youtube.com/watch?v=Y8SaMX30X1g) 4 | 5 | > Nada será como era antes da pandemia 6 | 7 | > Se um sistema depende do programador original para funcionar ele está mal feito. Rotacione programadores. 8 | 9 | > Não faça a solução mais complicada no dia 1. Faça o essencial, com certeza se o negócio der certo mudará muita coisa. 10 | 11 | ## Estudar sobre 12 | 13 | Quantitative easing (QE) 14 | Entendendo criptografia 15 | Consenso Bizantino 16 | 17 | ## Links 18 | 19 | [But how does bitcoin actually work?](https://www.youtube.com/watch?v=bBC-nXj3Ng4) - :heavy_check_mark: 20 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/buy.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Quote 5 | {% endblock %} 6 | 7 | {% block main %} 8 |
9 |
10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /resumos/akita-videos/aprendendo-sobre-computadores-com-mario-hardcore.md: -------------------------------------------------------------------------------- 1 | # Aprendendo sobre Computadores com Super Mario (do jeito Hardcore++) 2 | 3 | [Video](https://www.youtube.com/watch?v=hYJ3dvHjeOE) 4 | 5 | > Você sabe que um programador é bom quando programa em ambientes limitados e precisa extrair o máximo do hardware. 6 | 7 | Normalmete soluções e algoritmos universais não são bons para todos os casos. Você precisa analisar seu caso e ver o que comporta. 8 | 9 | Algoritmos costumam ser um balanço de dois fatores: se quiser economizar memória vai gastar mais ciclos de processamento - se quiser velocidade economizando ciclos provavelmente via gastar mais memória. 10 | 11 | ## Estudar sobre 12 | 13 | - Lookup table (cache) 14 | 15 | ## Links 16 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cryfo", 3 | "description": "Keep an eye on your favorite cryptocurrencies!", 4 | "version": "1.0", 5 | "manifest_version": 3, 6 | "options_ui": { 7 | "page": "options.html", 8 | "open_in_tab": false 9 | }, 10 | "permissions": ["storage"], 11 | "action": { 12 | "default_popup": "popup.html", 13 | "default_icon": { 14 | "16": "/images/cryfo16.png", 15 | "32": "/images/cryfo32.png", 16 | "48": "/images/cryfo48.png", 17 | "128": "/images/cryfo128.png" 18 | } 19 | }, 20 | "icons": { 21 | "16": "/images/cryfo16.png", 22 | "32": "/images/cryfo32.png", 23 | "48": "/images/cryfo48.png", 24 | "128": "/images/cryfo128.png" 25 | } 26 | } -------------------------------------------------------------------------------- /resumos/akita-videos/hello-world-como-nunca-entendendo-c.md: -------------------------------------------------------------------------------- 1 | # Hello World Como Você Nunca Viu! | Entendendo C 2 | 3 | [Video](https://www.youtube.com/watch?v=Gp2m8ZuXoPg) 4 | 5 | Tudo em computação tem um custo, e toda troca terá seu prejuizo 6 | 7 | Cuidado com valores de precisão de base 2 em contas com float number 8 | 9 | Tuple não é a mesma coisa que array 10 | 11 | O código é feito para outros programadores entenderem, o binário não se importa com nomes 12 | 13 | ## Estudar sobre 14 | - Inteiros e negativos em bytes 15 | - Teoria Two's Complement 16 | - Booth's Multiplication Algorithm 17 | - Tipo Number no Javascript sempre converter para float 18 | - Números complexos e grandes em computação 19 | - Stack LIFO-FIFO 20 | - Queue 21 | - Tail Recursion 22 | - Protobuf 23 | - Programação Funcional 24 | 25 | ## Links -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/register.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Register 5 | {% endblock %} 6 | 7 | {% block main %} 8 |
9 |
10 | 11 |
12 |
13 | 14 |
15 |
16 | 17 |
18 | 19 |
20 | {% endblock %} 21 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture10.md: -------------------------------------------------------------------------------- 1 | # Ethic - Final 2 | 3 | Some frustrations never goes away, be comfortable with this 4 | 5 | Computer Science is hard 6 | 7 | Be comfortable with google search 8 | 9 | Computational Thinking: 10 | input problems -> ***** -> Output solutions 11 | 12 | Always take a look into correctness, design and style of your solution 13 | 14 | You work with abstraction of ideas and precision 15 | 16 | Be ethic and choose well when developing 17 | 18 | Democracy society: 19 | - Rights 20 | - Opportunity of expression 21 | - Access 22 | - Diversity 23 | - Comunicative power 24 | 25 | Ask questions better 26 | 27 | The main of course is to you figure out how to do things by your own 28 | 29 | - Admitly frustration, and keep going 30 | - Read Documentation 31 | - Teach your own new languages 32 | 33 | -------------------------------------------------------------------------------- /resumos/akita-videos/arvores-o-comeco-de-tudo.md: -------------------------------------------------------------------------------- 1 | # Árvores: O Começo de TUDO | Estruturas de Dados e Algoritmos 2 | 3 | [Video](https://www.youtube.com/watch?v=9GdesxWtOgs) 4 | 5 | > Cometer erros faz parte do processo 6 | 7 | Arvóres podem ter várias aplicações mas se resumem ao conceito de criar uma lista eficiente para atender um propósito, seja inserções mais rápidas, buscas mais eficientes, equilibrio de arvore, organização de dados... 8 | 9 | É uma das várias estruturas de dados e como todas elas possui casos de utilização, o ideal é entender sua vantagens e desvantagens em cada tipo de aplicação para analisar se deve ou não utilizar. 10 | 11 | Existem diversos algoritmos para implementação de árvores cada um com seu propósito. 12 | 13 | Estudar: 14 | - Números pseudo aleatórios 15 | - red black tree 16 | - b-tree 17 | - avl 18 | - try color marking 19 | - Cormen 20 | - Tanenbaum -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/sell.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | Sell 5 | {% endblock %} 6 | 7 | {% block main %} 8 |
9 |
10 | 16 |
17 |
18 | 19 |
20 | 21 |
22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/history.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | CS50 5 | {% endblock %} 6 | 7 | {% block main %} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for transaction in transactions %} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {% endfor %} 28 | 29 |
SymbolTypeSharesPriceTransacted
{{transaction.stock}}{{transaction.operation}}{{transaction.shares}}{{transaction.price | usd}}{{transaction.datetime}}
30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/static/styles.css: -------------------------------------------------------------------------------- 1 | nav .navbar-brand 2 | { 3 | /* size for brand */ 4 | font-size: xx-large; 5 | } 6 | 7 | /* Colors for brand */ 8 | nav .navbar-brand .blue 9 | { 10 | color: #537fbe; 11 | } 12 | nav .navbar-brand .red 13 | { 14 | color: #ea433b; 15 | } 16 | nav .navbar-brand .yellow 17 | { 18 | color: #f5b82e; 19 | } 20 | nav .navbar-brand .green 21 | { 22 | color: #2e944b; 23 | } 24 | 25 | main .form-control 26 | { 27 | /* Center form controls */ 28 | display: inline-block; 29 | 30 | /* Override Bootstrap's 100% width for form controls */ 31 | width: auto; 32 | } 33 | 34 | main 35 | { 36 | /* Scroll horizontally as needed */ 37 | overflow-x: auto; 38 | 39 | /* Center contents */ 40 | text-align: center; 41 | } 42 | 43 | main img 44 | { 45 | /* Constrain images on small screens */ 46 | max-width: 100%; 47 | } 48 | 49 | main table { 50 | text-align: left; 51 | } -------------------------------------------------------------------------------- /resumos/akita-videos/qual-a-diferenca-entre-binarios-e-textos.md: -------------------------------------------------------------------------------- 1 | # Qual a REAL diferença entre Arquivos Binário e Texto?? 🤔 2 | 3 | [Video](https://www.youtube.com/watch?v=oSCVb4Ts-G4) 4 | 5 | > Aprenda a se acostumar a conviver com hexadecimais 6 | > Tudo em computador é um mapeamento de bits 7 | > Torne-se intimo do computador que você utiliza 8 | 9 | - Linha que indica o interpretador do arquivo é chamada de shebang 10 | 11 | ## Estudar sobre 12 | 13 | 14 | ## Links 15 | 16 | [Techquickie: The Magic Behind RAM](https://www.youtube.com/watch?v=UKTc9toqgU0) 17 | [IDN homograph attack](https://en.wikipedia.org/wiki/IDN_homograph_attack) 18 | [Introduction to the ELF Format](http://blog.k3170makan.com/2018/09/introduction-to-elf-format-elf-header.html) 19 | [Characters, Symbols and the Unicode Miracle - Computerphile](https://www.youtube.com/watch?v=MijmeoH9LT4) 20 | [História da Commodore - Parte 1 - O PET](https://www.youtube.com/watch?v=eP9y_7it3ZM&list=PLfABUWdDse7Y6LLPlfsHKcvBCgqaudzVY) -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Select coins to track

13 |
14 | 16 | 17 |
18 |
19 |
20 |

Tracked Coins

21 |
22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /resumos/posts/como-o-cerebro-aprende-pierluigi.md: -------------------------------------------------------------------------------- 1 | # Como o cérebro aprende 2 | 3 | Anotações do [video](https://www.youtube.com/watch?v=ai4VPDdOHUo) e [livro](https://amzn.to/2xFU0H5) do Professor Pierluigi Piazzi 4 | 5 | - Estudar diariamente e constantemente 6 | - Estudar em lugares tranquilos e confortáveis 7 | - Matérias lógicas precisam de base, por isso parecem mais difíceis 8 | - Primeiro haverá a dor de aprender e depois o prazer de saber 9 | 10 | ## Passos para aprender 11 | - Acreditar 12 | - Evitar Burrice 13 | - Estudar Pouco 14 | - Procurar Desafios 15 | 16 | ## Facetas da Inteligência 17 | - Lógica: Entender relações de causa e efeito 18 | - Linguistica: Recepção e entendimento de palavras 19 | - Espacial: Habilidade de se orientar no mundo 20 | - Psicocinética: Dominar o corpo e movimentos 21 | - Intrapessoal: Conhecer você mesmo. Quanto mais você se conhece, mais você desenvolve. 22 | - Musical: Produzir e entender músicas e gosto musical 23 | - Interpessoal: Conhecimento de outras pessoas, contato social. 24 | 25 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture6.md: -------------------------------------------------------------------------------- 1 | # Resume 2 | 3 | ## Python 4 | 5 | Python: 6 | - infer types 7 | - is loosely typed 8 | - works with identation and : 9 | - strings are called str 10 | 11 | Import `from cs50 import get_string` 12 | 13 | For loop 14 | ```python 15 | for i in range(3) 16 | print("hello") 17 | ``` 18 | 19 | Functions 20 | ```python 21 | def load(params): 22 | print(params) 23 | ``` 24 | 25 | There's always a price to pay when changing something into computer science 26 | 27 | Computer program always come with tradeoffs. Being a programmer is know what tools to use for the trade. 28 | 29 | Interpreter languages always need to "translate" the code, that means more time, because we not compile code itself, we just write and a program (interpreter) translate to us. 30 | 31 | ```python 32 | for something in other 33 | 34 | if x in z #for with if 35 | ``` 36 | 37 | Dictionaries are really fast in Python, they use hashtables under the hood to get the better iterate time 38 | 39 | module argv access commands from terminal -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Italo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/sentimental/readability.py: -------------------------------------------------------------------------------- 1 | from cs50 import get_string 2 | 3 | text = get_string("Text: ") 4 | 5 | 6 | def calculateGrade(text): 7 | length = len(text) 8 | countLetters = 0 9 | countWords = 0 10 | countSentences = 0 11 | 12 | if text[0].isalpha: 13 | countWords += 1 14 | 15 | for i in range(length): 16 | unicodeLetter = ord(text[i]) 17 | 18 | if text[i].isalpha(): 19 | countLetters += 1 20 | elif unicodeLetter == 32: 21 | if text[i+1].isalpha() or text[i+2].isalpha(): 22 | countWords += 1 23 | 24 | if unicodeLetter == 46 or unicodeLetter == 33 or unicodeLetter == 63: 25 | countSentences += 1 26 | 27 | L = countLetters / countWords * 100 28 | S = countSentences / countWords * 100 29 | grade = round(0.0588 * L - 0.296 * S - 15.8) 30 | 31 | if grade < 1: 32 | print("Before Grade 1") 33 | elif grade > 16: 34 | print("Grade 16+") 35 | else: 36 | print(f"Grade {grade}") 37 | 38 | 39 | calculateGrade(text) -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Italo Aurelio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/sentimental/credit.py: -------------------------------------------------------------------------------- 1 | from cs50 import get_string 2 | import re 3 | import sys 4 | 5 | 6 | def main(): 7 | cardNumber = get_string("Number: ") 8 | 9 | isValidLength = re.match('[0-9]{15,16}', cardNumber) 10 | 11 | if not isValidLength: 12 | print("INVALID") 13 | sys.exit() 14 | 15 | finalCardFlag = checkCardFlags(cardNumber) 16 | print(finalCardFlag) 17 | 18 | 19 | def checkFirstTwoDigits(cardNumber): 20 | return f"{cardNumber[0]}{cardNumber[1]}" 21 | 22 | 23 | def checkCardFlags(cardNumber): 24 | firstDigits = int(checkFirstTwoDigits(cardNumber)) 25 | cardLength = len(cardNumber) 26 | 27 | if (cardLength == 15): 28 | if (firstDigits == 37 or firstDigits == 34): 29 | return ("AMEX") 30 | 31 | if (cardLength == 16 and firstDigits > 50): 32 | if (firstDigits > 50 and firstDigits <= 55): 33 | return ("MASTERCARD") 34 | 35 | if (cardLength == 13 or cardLength == 16): 36 | if (firstDigits >= 40 and firstDigits <= 49): 37 | return ("VISA") 38 | 39 | return ("INVALID") 40 | 41 | 42 | if __name__ == "__main__": 43 | main() -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/mario/mario-more.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int mario(int height); 5 | 6 | int main(void) 7 | { 8 | int height; 9 | // Ask user for input 10 | do 11 | { 12 | height = get_int("Height:"); 13 | } 14 | while (height > 8 || height < 1); 15 | mario(height); 16 | } 17 | 18 | int mario(int height) 19 | { 20 | for (int line = 0; line < height; line++) 21 | { 22 | // Add spaces in the left pyramid 23 | for (int spaces = 1; spaces < height - line; spaces++) 24 | { 25 | printf(" "); 26 | } 27 | // Print left pyramid 28 | for (int left = 0; left <= line; left++) 29 | { 30 | printf("#"); 31 | } 32 | // Print gap between pyramids 33 | for (int gap = 0; gap < 2; gap++) 34 | { 35 | printf(" "); 36 | } 37 | // Print right pyramid 38 | for (int right = 0; right <= line; right++) 39 | { 40 | printf("#"); 41 | } 42 | 43 | printf("\n"); 44 | } 45 | return 1; 46 | } -------------------------------------------------------------------------------- /resumos/akita-videos/guia-hardcore-introducao-a-computacao.md: -------------------------------------------------------------------------------- 1 | # O Guia +Hardcore de Introdução à COMPUTAÇÃO 2 | 3 | [Video](https://www.youtube.com/watch?v=8G80nuEyDN4) 4 | 5 | > Um computador é uma grande orquestra de componentes e o clock é o maestro 6 | 7 | Breadboard consegue simular o funcionamento de um computador de forma mais "palpável" 8 | 9 | Se quiser estudar lógica comece por: Portas lógicas e Máquina de estado 10 | 11 | Obviamente iniciando das bases o entendimento de programação será melhor aproveitado se compreender como tudo acontece no inicio, assim para trabalhar na parte de alto nível a complexidade tende a diminuir e as abstrações fazem mais sentido. 12 | 13 | Boa parte da programação é retrabalhar dados 14 | 15 | Em programação primeiro vemos a forma mais simples de fazer funcionar e depois identificamos padrões para refatorar o código 16 | 17 | Prefira código legível ao inves de otimização prematura. Otimize o código quando puder mensurar 18 | 19 | ## Estudar sobre 20 | 21 | - Aprofundar em Hexadecimal 22 | - Little Endian vs Big Endian 23 | - Bit fields 24 | 25 | ## Links 26 | 27 | [MissingNo.'s Glitchy Appearance Explained](https://www.youtube.com/watch?v=ZI50XUeN6QE) 28 | [Ben Eater Channel](https://www.youtube.com/user/eaterbc) 29 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | 3 | {% block title %} 4 | CS50 5 | {% endblock %} 6 | 7 | {% block main %} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for stock in userStocks %} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | {% endfor %} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
SymbolNameSharesPriceTotal
{{stock.stock}}{{stock.name}}{{stock.shares}}{{stock.actualPrice | usd}}{{(stock.actualPrice * stock.shares) | usd}}
CASH{{actualCash | usd}}
{{(actualCash) | usd}}
43 | {% endblock %} 44 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/birthdays/application.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from cs50 import SQL 4 | from flask import Flask, flash, jsonify, redirect, render_template, request, session 5 | 6 | # Configure application 7 | app = Flask(__name__) 8 | 9 | # Ensure templates are auto-reloaded 10 | app.config["TEMPLATES_AUTO_RELOAD"] = True 11 | 12 | # Configure CS50 Library to use SQLite database 13 | # birthdays table: id, name, month, and day 14 | db = SQL("sqlite:///birthdays.db") 15 | 16 | @app.route("/", methods=["GET", "POST"]) 17 | def index(): 18 | if request.method == "POST": 19 | name = request.form["name"] 20 | month = request.form["month"] 21 | day = request.form["day"] 22 | # TODO: Add the user's entry into the database 23 | if not name or not month or not day: 24 | print("Fields Error") 25 | return redirect("/") 26 | db.execute("INSERT INTO birthdays (name, month,day) VALUES (?, ?, ?)", name, month, day) 27 | print(name, month, day) 28 | return redirect("/") 29 | 30 | else: 31 | # TODO: Display the entries in the database on index.html 32 | rows = db.execute("SELECT name, day, month FROM birthdays") 33 | return render_template("index.html", birthdays = rows) 34 | 35 | 36 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture7.md: -------------------------------------------------------------------------------- 1 | # Resume 2 | 3 | ## SQL 4 | 5 | Queries 6 | 7 | Data usually are placed in columns and rows 8 | 9 | CSV is a flat-file database 10 | 11 | Lambda functions in Python can be usefull for tiny functions 12 | 13 | Relational databases are databases implemented in softwares with more features, also managed by something like MySQL, Postregres... 14 | 15 | SQL means Structured Query Language 16 | 17 | Database file binary -> Database software/SQL interpreter -> GUI Interface/CLI 18 | 19 | **C**reate - **R**ead - **U**pdate - **D**elete 20 | 21 | SQL comum operations: CREATE, INSERT, SELECT, UPDATE, DELETE 22 | 23 | Commands in SQL look like: 24 | 25 | ```sql 26 | CREATE TABLE tablename(columname INT) 27 | SELECT * FROM tablename 28 | INSERT INTO tablename(columname) VALUES (valuename) 29 | ``` 30 | You can nest queries 31 | 32 | Always normalize your data, eliminate redundances. 33 | 34 | There is many data type in SQL like: BLOB, INTEGER, NUMERIC, TEXT, REAL... 35 | 36 | Primary Key = Original identifier 37 | Foreign Key = Reference Identifier 38 | 39 | Try to avoid SQL Injection Attacks, they are very common, always sanitize your data and keep your queries secure using better patterns. 40 | 41 | SQL Reference: https://www.w3schools.com/sql/sql_ref_keywords.asp -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/options.css: -------------------------------------------------------------------------------- 1 | .content { 2 | max-width: 1120px; 3 | margin:1rem auto; 4 | background: var(--white-bg-color); 5 | padding: 2rem; 6 | border-radius: 0.5rem; 7 | } 8 | 9 | .title { 10 | font-size: 1.5rem; 11 | color: var(--content-color) 12 | } 13 | 14 | .select-coin { 15 | display:flex; 16 | } 17 | 18 | .select-coin select{ 19 | border: 0.15rem solid #E0E8F2; 20 | background: var(--white-bg-color); 21 | border-radius: 0.5rem; 22 | padding: 0.5rem; 23 | max-width: 23.75rem; 24 | } 25 | 26 | .select-coin button { 27 | background: var(--primary-color); 28 | color: var(--white-bg-color); 29 | padding:0.25rem 1rem; 30 | border-radius: 0.5rem; 31 | border:none; 32 | margin-left: 0.5rem; 33 | } 34 | 35 | .select-coin button:hover { 36 | filter: brightness(0.9) 37 | } 38 | 39 | #selected-coins { 40 | display: flex; 41 | flex-wrap: wrap; 42 | } 43 | 44 | .coin-item { 45 | background: var(--light-bg-color); 46 | padding: 0.5rem; 47 | font-size: 0.875rem; 48 | border-radius: 0.25rem; 49 | margin: 0.5rem; 50 | } 51 | 52 | .coin-item button { 53 | border:none; 54 | color: var(--content-color); 55 | padding: 0.25rem 0.5rem; 56 | border-radius: 0.25rem; 57 | margin-left: 0.5rem; 58 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |

Tracking

11 | 33 |
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 |
USDT MarketPriceChange (24h)
43 |
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/artificial-inteligence.md: -------------------------------------------------------------------------------- 1 | # Artificial Intelligence 2 | 3 | Some kind of inteligence provided to computers 4 | 5 | Suggestions and auto selections can be made by a AI 6 | 7 | A lot of decision making 8 | 9 | Decision trees: a tree with a bunch decision tha computer can flow 10 | 11 | Optimal decision making 12 | 13 | Minimax: Some concept used in AI to know "weights" of each values and make a decision based on that 14 | 15 | Depth Limite Minimax: Calculate a limited number of next possible options 16 | 17 | Depth First Search: Try between options and go randomly in a direction until hit the final target 18 | 19 | Breath-First Search: Pickup many options and advance a little bit in each one 20 | 21 | Informed Serach: Search strategy that uses problem special knowledge to find solutions more efficiently 22 | 23 | Greedy Best-First Search: Calculate manhtan distance for each value and make decisions based on that 24 | 25 | A* Search: Work with more information to find result, some like grab each value and remembering steps 26 | 27 | ## Machine Learning 28 | 29 | - Reinforcement Learning: Computer make good and bad decisions retaining results and trying again with better ones. 30 | 31 | Is always good to an AI to balance between explore and exploit 32 | 33 | Genetic Algotrithms: Create and generate random itens eliminating not sucessful one and repeat the process with good ones 34 | 35 | -------------------------------------------------------------------------------- /resumos/akita-videos/o-computador-de-turing-e-von-neumann.md: -------------------------------------------------------------------------------- 1 | # O Computador de Turing e Von Neumann | Por que calculadoras não são computadores? 2 | 3 | [Video](https://www.youtube.com/watch?v=G4MvFT8TGII) 4 | 5 | ### Pesquisar sobre 6 | 7 | - Sequências computáveis 8 | - Hierarquia de Chonski 9 | - Compilers 10 | - Turign tarpit 11 | - Automatos Finitos 12 | - Maquina de estado 13 | - Linear Bounded automation 14 | 15 | ### Livro 16 | 17 | - The Computer from Pascal to Von Neumann 18 | 19 | ### Links 20 | 21 | - [Turing Paper](https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf) 22 | - [Boy Who Wanted to 'Make a Typewriter' Instead Became Father of Computer Science](https://oztypewriter.blogspot.com/2013/09/boy-who-wanted-to-make-typewriter.html) 23 | - [What exactly is Turing Completeness?](https://medium.com/@evinsellin/what-exactly-is-turing-completeness-a08cc36b26e2) 24 | - [Are There Problems That Computers Can't Solve?](https://www.youtube.com/watch?v=eqvBa...) 25 | - [Turing Machine Visualization](https://turingmachine.io/) 26 | - [Turing Complete](https://wiki.c2.com/?TuringComplete) 27 | - [Who Invented the Computer?](https://www.turing.org.uk/scrapbook/computer.html) 28 | - [Konrad Zuses Z3 in Detail](http://www.inf.fu-berlin.de/lehre/SS01/hc/zuse/node4.html) 29 | - [The Unparalleled Genius of John von Neumann](https://medium.com/cantors-paradise/the-unparalleled-genius-of-john-von-neumann-791bb9f42a2d) 30 | - [Plankalkül](https://en.wikipedia.org/wiki/Plankalk%C3%BCl) 31 | - [PC Jr](https://www.pcjs.org/) 32 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/trivia/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #212529; 4 | font-size: 1rem; 5 | font-weight: 400; 6 | line-height: 1.5; 7 | margin: 0; 8 | text-align: left; 9 | } 10 | 11 | .container { 12 | margin-left: auto; 13 | margin-right: auto; 14 | padding-left: 15px; 15 | padding-right: 15px; 16 | } 17 | 18 | .jumbotron { 19 | background-color: #477bff; 20 | color: #fff; 21 | margin-bottom: 2rem; 22 | padding: 2rem 1rem; 23 | text-align: center; 24 | } 25 | 26 | .section { 27 | padding: 0.5rem 2rem 1rem 2rem; 28 | } 29 | 30 | .section:hover { 31 | background-color: #f5f5f5; 32 | transition: color 2s ease-in-out, background-color 0.15s ease-in-out; 33 | } 34 | 35 | h1 { 36 | font-family: 'Montserrat', sans-serif; 37 | font-size: 48px; 38 | } 39 | 40 | button, input[type="submit"] { 41 | background-color: #d9edff; 42 | border: 1px solid transparent; 43 | border-radius: 0.25rem; 44 | font-size: 0.95rem; 45 | font-weight: 400; 46 | line-height: 1.5; 47 | padding: 0.375rem 0.75rem; 48 | text-align: center; 49 | transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; 50 | vertical-align: middle; 51 | } 52 | 53 | 54 | input[type="text"] { 55 | line-height: 1.8; 56 | width: 25%; 57 | } 58 | 59 | input[type="text"]:hover { 60 | background-color: #f5f5f5; 61 | transition: color 2s ease-in-out, background-color 0.15s ease-in-out; 62 | } 63 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/recover/recover.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | if (argv[1]) 8 | { 9 | FILE *file; 10 | file = fopen(argv[1], "r"); 11 | 12 | FILE *recoverImg = NULL; 13 | unsigned char buffer[512]; 14 | int jpegCount = 0; 15 | char filename[8]; 16 | 17 | if (file == NULL) 18 | { 19 | fputs("File error", stderr); 20 | exit(1); 21 | } 22 | 23 | 24 | while (fread(buffer, 512, 1, file) > 0) 25 | { 26 | 27 | if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] & 0xf0) == 0xe0) 28 | { 29 | // If already open image, close 30 | if (recoverImg != NULL) 31 | { 32 | fclose(recoverImg); 33 | } 34 | 35 | // Create new file and name it adding 1 into name and increment jpeg count 36 | sprintf(filename, "%03i.jpg", jpegCount); 37 | recoverImg = fopen(filename, "w"); 38 | jpegCount++; 39 | 40 | } 41 | 42 | if (recoverImg != NULL) 43 | { 44 | // If is not jpeg header write bytes into file 45 | fwrite(buffer, 512, 1, recoverImg); 46 | } 47 | } 48 | 49 | return 0; 50 | } 51 | 52 | printf("Usage: ./recover image \n"); 53 | return 1; 54 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture0.md: -------------------------------------------------------------------------------- 1 | ## Resume 2 | 3 | Computer are only 0 and 1. On/Off, True/False, 0/1, like a eletricity plug. Because in the end is all about eletricity. 4 | 5 | Every character in a binary is a _bit_, a group of 8 bit is a byte 8bit = 1byte. 6 | 7 | How computer differ binary 01000001(65) to show number 65 integer or 'A' character? 8 | R: The compiler or interpreter "say" to computer which one to use. Your program define the rules, like something: 9 | 10 | ```c 11 | int x = 65; 12 | char c = 'a'; 13 | ``` 14 | 15 | In binary both are 01000001, but the C compiler define one like int and another like char. 16 | 17 | - [Source 1](https://www.quora.com/How-do-computers-differentiate-between-letters-and-numbers-in-binary) 18 | - [Source 2](https://www.reddit.com/r/explainlikeimfive/comments/263036/eli5_how_can_computers_tell_the_difference/) 19 | 20 | Characters are translated from binary using de [UNICODE](https://home.unicode.org) pattern. 21 | 22 | Computer works in this way: 23 | INPUT -> ALGORITHMS -> OUTPUT 24 | 25 | _functions_ are equal actions you ask computer to do 26 | _if, else, elseif..._ are conditions to change 27 | 28 | The big point of good functions is to divide and conquer the problem, less steps. Even try to less repeat (DRY), to good abstractions and advance in baby steps. 29 | 30 | SOURCE CODE -> COMPILER -> MACHINE CODE (0010) 31 | 32 | > Computers only do what you tell they to do 33 | 34 | ## Links 35 | 36 | - [MIT Scratch](https://scratch.mit.edu) 37 | - [MIT Scratch CS50 Studio](https://scratch.mit.edu/studios/25128634/) 38 | -------------------------------------------------------------------------------- /resumos/akita-videos/o-dilema-das-redes-e-como-voce-e-manipulado.md: -------------------------------------------------------------------------------- 1 | # Entendendo "O Dilema das Redes" e Como Você é Manipulado 2 | 3 | [Video](https://www.youtube.com/watch?v=mNHKNyhSn8I) 4 | 5 | Bayesian Filter 6 | 7 | Estatistica e probabilidade 8 | 9 | As vezes você acha que está no controle, mas não está 10 | 11 | Apache Mahout/Hadoop 12 | 13 | Teorema de Bayes -> Machine Learning 14 | 15 | Probabilidade não é certeza 16 | 17 | Qualidade dos dados muda os retornos 18 | 19 | Psicologos: Asch e Milgram 20 | 21 | Não somos tão racionais assim 22 | 23 | Links: 24 | 25 | - Adam Ruins Social Media (https://www.youtube.com/watch?v=5pFX2...) 26 | - A Plan for Spam (http://www.paulgraham.com/spam.html) 27 | - Veritasium: The Bayesian Trap (https://www.youtube.com/watch?v=R13BD...) 28 | - 3Blue1Brown: Bayes Theorem (https://www.youtube.com/watch?v=HZGCo...) 29 | - Julia Galef: A Visual Guide to Bayesian Thinking (https://www.youtube.com/watch?v=BrK7X...) 30 | - AkitaOnRails: Somos Matematicamente Ignorantes (https://www.akitaonrails.com/2008/03/...) 31 | - TED: Dan Ariely - Controlamos nossas decisões? (https://www.ted.com/talks/dan_ariely_...) 32 | - Experimento da Conformidade de Asch (https://www.youtube.com/watch?v=Ijop2...) 33 | - Adam Ruins Electric Cars (https://www.youtube.com/watch?v=MQLba...) 34 | 35 | - No, Social Media Isn’t Destroying Civilization (https://www.jacobinmag.com/2020/09/th...) 36 | - The Social Dilemma Fails to Blame the Individual (http://tripod.domains.trincoll.edu/ar...) 37 | - Bayes Theorem: A Framework for Critical Thinking (https://neilkakkar.com/Bayes-Theorem-...) 38 | -------------------------------------------------------------------------------- /resumos/akita-videos/o-que-vem-depois-covid-19.md: -------------------------------------------------------------------------------- 1 | # O que vem DEPOIS do COVID-19? 2 | 3 | [Video](https://www.youtube.com/watch?v=Hrg0MnyE2jM) 4 | 5 | Oferta e demanda. 6 | 7 | Mercado estava em excesso, ele iria ajustar. 8 | 9 | Criptomoedas são volateis? E as moedas caindo sem parar, lembra algo? 10 | 11 | Tenha controle e distribuição, seja anti-frágil. 12 | 13 | Empresas com "valuation" mas sem um valor real estão com os dias contados. Grandes unicórnios que rodam no negativo precisam se espertar. 14 | 15 | O fluxo de contratações excessivas, profissionais duvidosos e cargos de cabide está para acabar. As empresas serão forçadas a cobrar eficiência, cortar experimentos e focar em entregar resultado. 16 | 17 | O meu foco em ser único e excelente continua como sempre. [Programador apaixonado](../resumes/getting-real/resumo-getting-real.md) 18 | 19 | > Crie fundações de conhecimento sólidas. O mercado precisa de gente preparada. Com ou sem crise o mercado sempre tem espaço para gente competente de verdade. 20 | 21 | ## Video e materiais 22 | 23 | - [Crescimento exponencial e epidemias](https://www.youtube.com/watch?v=Kas0tIxDvrg) 24 | - [A lógica do Cisne Negro](https://amzn.to/2QGtuUY) 25 | 26 | ## Assistir: 27 | 28 | - [Panic: The Untold Story of the 2008 Financial Crisis](https://www.youtube.com/watch?v=QozGSS7QY_U) 29 | - Filme The Big Short 30 | - [1929 Stock Market Crash and the Great Depression](https://www.youtube.com/watch?v=qlSxPouPCIM) Assistido 31 | 32 | ## Estudar: 33 | 34 | - [Oferta e Demanda](https://www.youtube.com/watch?v=ph5Ra4vd0SE) 35 | - Curva exponencial 36 | - Curva logistica 37 | - Regressão linear 38 | -------------------------------------------------------------------------------- /resumos/akita-videos/selo-de-seguranca-e-marketing.md: -------------------------------------------------------------------------------- 1 | # RANT: Selo de Segurança é Marketing | Entendendo o Fator Humano 2 | 3 | [Video](https://www.youtube.com/watch?v=wz1Ioqb89Jo) 4 | 5 | > Um bom desenvolvedor de software precisa saber o básico de segurança 6 | 7 | Se quiser ficar bom leia o código fonte e documentação das coisas, é lá que moram as falhas de segurança. 8 | 9 | Quanto antes se educar sobre segurança, melhor desenvolvedor você será e conquentemente terá mais valor. 10 | 11 | Mitigue e crie contingências de segurança, não a para ser 100% seguro, não é porque ainda nada aconteceu que você pode ficar "tranquilo" 12 | 13 | Dificilmente uma startup irá se preocupar com processos e burocracias desde o inicio, o objetivo no começo é sobreviver mais um dia e implementar novas funcionalidades, de longe estão preocupadas com padrões, a maior preocupação é captar usuários e crescer o mais rápido que puder. Cresceu? Deu tudo certo? Ai começa a governança e estruturação para "limpar" o parquinho. 14 | 15 | Conforme empresas crescem as governanças começam a aparecer para organizar e estruturar padrões e processos para que o "todo" fique organizado de alguma forma e possa ser controlado de uma maneira mais profissional. 16 | 17 | Fator Humano = Inseguro 18 | 19 | Engenharia social sempre foi e sempre será a forma mais simples e eficiente de invadir um sistema 20 | 21 | Normalmente as pessoas cometem erros simples e inacreditáveis, sempre esteja atento e duvide de cada situação. 22 | 23 | Qualquer pessoa representa um risco para a empresa, independente do nivel de conhecimento. 24 | 25 | ## Links 26 | 27 | ## Pesquisar 28 | 29 | - Darknet 30 | - COBIT, TOGAF, ITIL, CMMI, PMBOK 31 | - HTTP Tunel 32 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/global.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-bg-color: #f4f9fd; 3 | --white-bg-color: #fff; 4 | --headline-color: #1a1a1a; 5 | --subheadline-color: #2a3440; 6 | --content-color: #364254; 7 | --primary-color: #007aff; 8 | --blue-bg-color: #0054dc; 9 | --dark-bg-color: #141a26; 10 | --error-color: #fc4848; 11 | --success-color: #00d69a; 12 | } 13 | 14 | ::-webkit-scrollbar { 15 | width: 4px; 16 | height: 4px; 17 | } 18 | ::-webkit-scrollbar-button { 19 | width: 0px; 20 | height: 0px; 21 | } 22 | ::-webkit-scrollbar-thumb { 23 | background: #e1e1e1; 24 | border: 0px none #ffffff; 25 | border-radius: 40px; 26 | } 27 | ::-webkit-scrollbar-thumb:hover { 28 | background: #ffffff; 29 | } 30 | ::-webkit-scrollbar-thumb:active { 31 | background: #fff; 32 | } 33 | ::-webkit-scrollbar-track { 34 | background: #f4f9fd; 35 | border: 0px none #ffffff; 36 | border-radius: 51px; 37 | } 38 | ::-webkit-scrollbar-track:hover { 39 | background: #f4f9fd; 40 | } 41 | ::-webkit-scrollbar-track:active { 42 | background: #fff; 43 | } 44 | ::-webkit-scrollbar-corner { 45 | background: transparent; 46 | } 47 | 48 | * { 49 | margin:0; 50 | padding:0; 51 | box-sizing: border-box; 52 | } 53 | 54 | html { 55 | @media (max-width:1080px) { 56 | font-size: 93.75%; 57 | } 58 | 59 | @media (max-width:720px) { 60 | font-size: 87.5%; 61 | } 62 | } 63 | 64 | body { 65 | background:var(--light-bg-color); 66 | -webkit-font-smoothing: antialiased; 67 | } 68 | 69 | body, input, textarea, button{ 70 | font-family: 'Poppins', sans-serif; 71 | font-weight: 400; 72 | } 73 | 74 | h1, h2, h3, h4, h5, h6, strong { 75 | font-weight:600; 76 | } 77 | 78 | button { 79 | cursor: pointer; 80 | } 81 | 82 | [disabled] { 83 | opacity:0.6; 84 | cursor:not-allowed; 85 | } -------------------------------------------------------------------------------- /resumos/akita-videos/o-guia-definitivo-de-aprendendo-a-aprender.md: -------------------------------------------------------------------------------- 1 | # Guia DEFINITIVO de Aprendendo a Aprender | A maior BRONCA da sua vida [RATED R] 2 | 3 | [Video](https://www.youtube.com/watch?v=oUPaJxk6TZ0) 4 | 5 | Equilibre-se com a oferta e demanda do mercado, esteja ciente de como tudo isso funciona para que possa se posicionar de maneira correta. Parasita que apenas surfam na onda do mercado serão expurgados nos momentos de crise. 6 | 7 | Tempos difíceis criam pessoas fortes. Pessoas fortes criam tempos fáceis. Tempos fáceis criam pessoas fracas e pessoas fracas criam tempos difíceis. 8 | 9 | Programar é difícil e precisa de prática deliberada, pare de acreditar em contos de fadas e coachs mágicos. 10 | 11 | Aprenda a estudar por conta e buscar seu próprio conteúdo, no mundo real é assim que funciona. Se vire sozinho, você precisará aprender a se virar. 12 | 13 | Talento = Prática Deliberada + Dedicação 14 | 15 | Aprenda a aprender e desafie-se constantemente para que possa confirmar seus aprendizados. 16 | 17 | Criando a responsabilidade de aprender por conta você terá que: 18 | 19 | 1 - Encontrar problemas para resolver, de preferência que desafie você mesmo 20 | 2 - Encontrar seu próprio material para que possa consultar 21 | 3 - Criar seu próprio senso de autonomia e responsabilidade 22 | 23 | Tudo que você for fazer pela primeira vez será ruim e provavelmente descartável, porém acostume-se com o desconforto e a dor de aprender, deixe-se vulnerável e continue focando no objetivo. 24 | 25 | Pare de procurar elogios baratos e certificados confirmando que viu X horas de algo, comprometa-se em fazer e ser bom. 26 | 27 | Tenha uma base sólida de conhecimentos para que você entenda realmente o que está acontecendo, isso fará com que você não seja escravo de ferramentas ou marcas. Seja autonomo, cuide de você mesmo. 28 | 29 | Links: 30 | [42 SP](https://www.42sp.org.br/) 31 | [CodeMiner 42](https://www.codeminer42.com) 32 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture9.md: -------------------------------------------------------------------------------- 1 | # Flask 2 | 3 | Connect Server Side with Client Side 4 | 5 | Web Server constantly listen to an port 6 | 7 | HTTP request tells to server what do you want 8 | 9 | Framework is a way ofdoing thing, organize your code and so on... 10 | 11 | MVC = Model, View, Controller 12 | 13 | Simple http server in Flask 14 | 15 | ```python 16 | from flask import Flask 17 | app = Flask(__name__) 18 | 19 | @app.route('/') 20 | def hello_world(): 21 | return 'Hello, World!' 22 | ``` 23 | 24 | Listen users then responds 25 | 26 | Decoratos (@) inside backend code associate some functions to next function 27 | 28 | Web frameworks usually allow templates 29 | 30 | Do baby steps when programming 31 | 32 | Never ever trust user inputs 33 | 34 | Programm defensively 35 | 36 | Never type sensitive information directly into your code, use environment variables 37 | 38 | session = remember something about you 39 | 40 | cookie = piece of data placed on your device used to remember who you are 41 | 42 | be carefull with cookie hijack 43 | 44 | sessions = stamps on your hand, identifies you 45 | 46 | Flask allow python to implement a web app using backend writen in Python 47 | 48 | Your web server can do different things based on type of HTTP request 49 | 50 | AJAX = Asynchronous JavaScript and XML 51 | 52 | Ajax allow us to dinamycally update a webpage, this use a special JS object called XMLHttpRequest 53 | 54 | Example pure JS function doing a AJAX request: 55 | ```js 56 | function ajax_request(argument){ 57 | var aj = new XMLHttpRequest(); 58 | 59 | aj.onreadystatechange = function () { 60 | if (aj.readtState == 4 && aj.status == 200){ 61 | // do something to the page 62 | } 63 | } 64 | 65 | aj.open("GET", /* URL */, true); 66 | aj.send(); 67 | } 68 | ``` 69 | 70 | More commonly, you'll see Ajax written with Jquery https://api.jquery.com/jquery.ajax/ -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/helpers.py: -------------------------------------------------------------------------------- 1 | import os 2 | import requests 3 | import urllib.parse 4 | 5 | from flask import redirect, render_template, request, session 6 | from functools import wraps 7 | 8 | 9 | def apology(message, code=400): 10 | """Render message as an apology to user.""" 11 | def escape(s): 12 | """ 13 | Escape special characters. 14 | 15 | https://github.com/jacebrowning/memegen#special-characters 16 | """ 17 | for old, new in [("-", "--"), (" ", "-"), ("_", "__"), ("?", "~q"), 18 | ("%", "~p"), ("#", "~h"), ("/", "~s"), ("\"", "''")]: 19 | s = s.replace(old, new) 20 | return s 21 | return render_template("apology.html", top=code, bottom=escape(message)), code 22 | 23 | 24 | def login_required(f): 25 | """ 26 | Decorate routes to require login. 27 | 28 | https://flask.palletsprojects.com/en/1.1.x/patterns/viewdecorators/ 29 | """ 30 | @wraps(f) 31 | def decorated_function(*args, **kwargs): 32 | if session.get("user_id") is None: 33 | return redirect("/login") 34 | return f(*args, **kwargs) 35 | return decorated_function 36 | 37 | 38 | def lookup(symbol): 39 | """Look up quote for symbol.""" 40 | 41 | # Contact API 42 | try: 43 | api_key = os.environ.get("API_KEY") 44 | url = f"https://cloud-sse.iexapis.com/stable/stock/{urllib.parse.quote_plus(symbol)}/quote?token={api_key}" 45 | response = requests.get(url) 46 | response.raise_for_status() 47 | except requests.RequestException: 48 | return None 49 | 50 | # Parse response 51 | try: 52 | quote = response.json() 53 | return { 54 | "name": quote["companyName"], 55 | "price": float(quote["latestPrice"]), 56 | "symbol": quote["symbol"] 57 | } 58 | except (KeyError, TypeError, ValueError): 59 | return None 60 | 61 | 62 | def usd(value): 63 | """Format value as USD.""" 64 | return f"${value:,.2f}" 65 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/readability/readability.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int calculateGrade(string text); 8 | 9 | int main(void) 10 | { 11 | string text = get_string("Please type a text: "); 12 | int resultGrade = calculateGrade(text); 13 | } 14 | 15 | int calculateGrade(string text) 16 | { 17 | int length = strlen(text); 18 | int countLetters = 0; 19 | int countWords = 0; 20 | int countSentences = 0; 21 | 22 | if (isalpha(text[0])) 23 | { 24 | countWords++; 25 | } 26 | 27 | // Pass for every letter in a input 28 | for (int i = 0; i < length; i++) 29 | { 30 | // If is a letter count based on is alphanumeric 31 | if (isalpha(text[i])) 32 | { 33 | countLetters++; 34 | } 35 | 36 | // Finded a space? Check if the next character is a letter, then count a word 37 | else if (text[i] == 32) 38 | { 39 | 40 | // Avoid "", but I think it can be better... 41 | if (isalpha(text[i + 1]) || isalpha(text[i + 2])) 42 | { 43 | countWords++; 44 | } 45 | } 46 | 47 | // Check if character is a !,? or ., then end a sentence. 48 | else if (text[i] == 46 || text[i] == 33 || text[i] == 63) 49 | { 50 | countSentences++; 51 | } 52 | 53 | } 54 | 55 | // Calculate Coleman-Liau index 56 | float L = (float)countLetters / (float)countWords * 100; 57 | float S = (float)countSentences / (float)countWords * 100; 58 | float grade = round(0.0588 * L - 0.296 * S - 15.8); 59 | 60 | if ((int) grade < 1) 61 | { 62 | printf("Before Grade 1\n"); 63 | return 0; 64 | } 65 | else if ((int) grade >= 16) 66 | { 67 | printf("Grade 16+\n"); 68 | return 0; 69 | } 70 | 71 | printf("Grade %i\n", (int) grade); 72 | 73 | return 0; 74 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/birthdays/static/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #212529; 4 | font-size: 1rem; 5 | font-weight: 400; 6 | line-height: 1.5; 7 | margin: 0; 8 | text-align: left; 9 | } 10 | 11 | .container { 12 | margin-left: auto; 13 | margin-right: auto; 14 | padding-left: 15px; 15 | padding-right: 15px; 16 | text-align: center; 17 | width: 90%; 18 | } 19 | 20 | .jumbotron { 21 | background-color: #477bff; 22 | color: #fff; 23 | margin-bottom: 2rem; 24 | padding: 2rem 1rem; 25 | text-align: center; 26 | } 27 | 28 | .section { 29 | padding-bottom: 1rem; 30 | padding-left: 2rem; 31 | padding-right: 2rem; 32 | padding-top: 0.5rem; 33 | } 34 | 35 | .section:hover { 36 | background-color: #f5f5f5; 37 | transition: color 2s ease-in-out, background-color 0.15s ease-in-out; 38 | } 39 | 40 | h1 { 41 | font-family: 'Montserrat', sans-serif; 42 | font-size: 48px; 43 | } 44 | 45 | button, input[type="submit"] { 46 | background-color: #d9edff; 47 | border: 1px solid transparent; 48 | border-radius: 0.25rem; 49 | font-size: 0.95rem; 50 | font-weight: 400; 51 | line-height: 1.5; 52 | padding: 0.375rem 0.75rem; 53 | text-align: center; 54 | transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; 55 | vertical-align: middle; 56 | } 57 | 58 | input[type="text"], input[type="number"] { 59 | line-height: 1.8; 60 | width: 25%; 61 | } 62 | 63 | input[type="text"]:hover, input[type="number"]:hover { 64 | background-color: #f5f5f5; 65 | transition: color 2s ease-in-out, background-color 0.15s ease-in-out; 66 | } 67 | 68 | table { 69 | background-color: transparent; 70 | margin-bottom: 1rem; 71 | width: 100%; 72 | } 73 | 74 | table th, 75 | table td { 76 | padding: 0.75rem; 77 | vertical-align: middle; 78 | } 79 | 80 | tbody tr:nth-of-type(odd) { 81 | background-color: rgb(179, 208, 255, 0.3) 82 | } 83 | 84 | -------------------------------------------------------------------------------- /resumos/akita-videos/rant-realidade-software-livre.md: -------------------------------------------------------------------------------- 1 | # RANT: A Realidade do "Software Livre" 2 | [Video](https://www.youtube.com/watch?v=FVy1fZhNSDA) 3 | 4 | Aberturas de códigos de software "livre" para que as empresas possam mudar a sua imagem no mercado. São abertos apenas códigos não criticos como API's e Frameworks. Além de funcionar como marketing as empresas ainda podem criar uma legião de programadores especializados em suas tecnologias, o que gera um imensa camada de profissionais disponíveis. 5 | 6 | Cuidado com ofertas e brindes baratos usados para comprar sua fidelidade á empresas. Deixe de adorar ou amar empresas, você paga e compra serviços, fim. 7 | 8 | As estratégias de marketing utilizadas em "open source" criam a ideia de comunidade e induzem diversas pessoas a defenderem um produto de terceiros. 9 | 10 | Hoje em dia perdemos muito de nossa liberdade confiando em servidores de terceiros (eu postando o documento no github). A grande parte do que utilizamos esté em um servidor externo, desconhecido e compilado de uma maneira que não sabemos como, o máximo que podemos fazer é ter uma cópia se baixarmos (o que é raro) como segurança. Onde estão seus documentos? Suas planilhas estão bem guardadas? Quem pode ativar ou desativar esses serviços? 11 | 12 | Nunca use um código que encontrou em um Git(hub/lab) se este não tiver licenças. Principalmente se você desenvolve produtos que são vendidos. 13 | 14 | Na dúvida sobre qual licença escolher utilize MIT/BSD e suas variáveis, porém é bom estudar e entender sobre elas. 15 | 16 | Use repositórios abertos e contribuições para testar seu nível de programação, veja o quão bom você usando como base outros desenvolvedores. 17 | 18 | Como desenvolvedor aproveite-se dessa abundância e dessas ferramentas ao máximo, tudo que for benéfico para você faça uso. Só revise suas ações caso fique defendendo marcas ou produtos de forma impensada. 19 | 20 | ## Links 21 | 22 | - [Como escolher uma licença open source](https://choosealicense.com/) 23 | - [Definição de Copyright](https://www.thebalancesmb.com/copyright-definition-2948254) -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/birthdays/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Birthdays 8 | 9 | 10 |
11 |

Birthdays

12 |
13 |
14 |
15 | 16 |

Add a Birthday

17 |
18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |

All Birthdays

29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | {% for birthday in birthdays %} 39 | 40 | 41 | 42 | 43 | {% endfor %} 44 | 45 |
NameBirthday
{{birthday.name}}{{birthday.month}}/{{birthday.day}}
46 |
47 |
48 | 49 | 50 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/popup.js: -------------------------------------------------------------------------------- 1 | const apiUrl = "https://api.coingecko.com/api/v3/" 2 | const tableElement = document.getElementById("coin-table") 3 | 4 | document.getElementById('go-to-options').addEventListener("click", function() { 5 | if (chrome.runtime.openOptionsPage) { 6 | chrome.runtime.openOptionsPage(); 7 | } else { 8 | window.open(chrome.runtime.getURL('options.html')); 9 | } 10 | }); 11 | 12 | function constructCoinModel(image, symbol, name, price, change) { 13 | const changeType = change < 0 ? 'negative' : 'positive' 14 | const formatedPrice = new Intl.NumberFormat('en', { style: 'currency', currency: 'USD' }).format(price) 15 | return ` 16 | 17 | ${name} 18 |
19 | ${symbol} 20 | ${name} 21 |
22 | 23 | 24 | ${formatedPrice} 25 | 26 | 27 | ${change.toFixed(2)}% 28 | 29 | ` 30 | } 31 | 32 | function getSelectedCoins() { 33 | chrome.storage.sync.get("coins"); 34 | } 35 | 36 | function fillTable(coins) { 37 | coins.forEach(async element => { 38 | await fetch(`${apiUrl}/coins/${element.id}?localization=false&tickers=false&community_data=false&developer_data=false&sparkline=false`) 39 | .then(response => response.json()) 40 | .then(response => { 41 | const { image, symbol, name, market_data} = response 42 | const element = constructCoinModel(image.small, symbol, name, market_data.current_price.usd, market_data.price_change_percentage_24h) 43 | const trElement = document.createElement('tr') 44 | trElement.id = 'coin-data' 45 | trElement.innerHTML = element 46 | tableElement.appendChild(trElement) 47 | }) 48 | }); 49 | } 50 | 51 | chrome.storage.sync.get(['coins'], function({ coins }) { 52 | fillTable(coins); 53 | }); -------------------------------------------------------------------------------- /resumos/akita-videos/so-precisamos-de-640-kb-de-memoria.md: -------------------------------------------------------------------------------- 1 | # Só Precisamos de 640 kB de Memória? | 16-bits até 64-bits! 2 | 3 | [Video](https://www.youtube.com/watch?v=cTVXKfYOYxo) 4 | 5 | Memórias sempre foram um assunto complicado e desde os primeiros chips os trabalhos são basicamente endereçar e encontrar as melhores formas de mapear esses endereços para aproveitar o máximo do programa. 6 | 7 | Antigamente como os endereços eram fixos e acessíveis era muito fácil haver conflitos de endereços entre programas, principalmente pela limitação de memória e por falhas de gerenciador, pois haviam muitas adaptações de mappers. 8 | 9 | Técnicas de mapper sempre foram utilizadas para conseguir ter "mais" memória do que realmente existia, algo como uma memória virtual. 10 | 11 | Com essa necessidade de organização de memória naturalmente surgiram os gerenciadores de memória que eram programas embutidos no sistema operacional que gerenciavam os endereços para evitar conflitos de memória. O seu programa solicitava um espaço de memoria e o gerenciador providenciava para voce um espaço adequado, evitando conflito entre programas, desta forma abrir vários programas ao mesmo tempo começou a se tornar algo real. 12 | 13 | Desde os 16bits nunca se foi utilizada toda a memória disponivel, pois era necessário que os chips dos processadores tivessem a capacidade de endereçar as memórias, e também existe o fato de que o sistema operacional sempre vai reservar uma espaço X de memória para ele gerenciar suas próprias tarefas e programas, então os programas que eram executados em um SO tinham um limite de memória acessivel que nunca era o limite da memória total. 14 | 15 | Hoje em dia existem gerenciadores de memória que endereçam os programas em posições estratégicas e aleatórias para evitar conflitos e amenizar vírus que se aproveitam de posições fixas em memória. Por mais que tenhamosa tecnologia de 64bits os processadores atuais usam apenas 40bits que já é um número alto em relação a tecnologia de processadores atuais, endereçar uma memoria de 64bits exigiria uma quantidade de espaço em memoria absurda para os dias atuais. 16 | 17 | Estudar: 18 | - offset de memória -------------------------------------------------------------------------------- /resumos/akita-videos/discutindo-sobre-banco-de-dados.md: -------------------------------------------------------------------------------- 1 | # Discutindo sobre Banco de Dados - Dos primórdios a Big Data 2 | 3 | [Video](https://www.youtube.com/watch?v=Bfm3Ms2cTg0) 4 | 5 | > Tudo que você não sabe como realmente funciona, vira superstição 6 | 7 | > O seu trabalho como programador é encontrar o teto máximo de recursos que realmente precisam ser utilizados da máquina 8 | 9 | > Sempre monitore o que está acontecendo com o seu sistema 10 | 11 | > Toda manutenção deve usar métricas 12 | 13 | O banco de dados mais rudimentar pode ser uma array guardando os valores em memória, porém em algum momento esta memória vai chegar em seu limite e o caminho natural de avanço é gravar esses dados em disco, sendo inicialmente um arquivo de texto que pode ser lido e escrito. 14 | 15 | Nunca faça busca em banco de dados olhando registro a registro, é a pior solução, foque em ter um índice. 16 | 17 | Todo indice tem um tradeoff, é mais rapido mas custa mais espaço em disco, e a atualização desse indíce terá o seu peso... 18 | 19 | Não existem bancos de dados SQL, existem bancos de dados que entendem SQL. 20 | 21 | Cuidando com comandos que armazenam muito recurso de memória e processamento, como o `SELECT * FROM` que pode trazer uma quantidade enorme de dados desnecessários. Tente buscar formas otimizadas de trabalhar com os dados que possui, toda operação tem um custo. 22 | 23 | Se tem um loop no cliente para fazer uma busca no banco de dados, você está fazendo algo errado. Reflita seu código. 24 | 25 | Se você não consegue medir, com certeza não consegue concertar 26 | 27 | Cuidado com two-phase commit 28 | 29 | Evite auto_increment, principalmente o sequencial, pois pode gerar problemas de segurança, pois é fácil de prever o próximo valor. É mais arriscado em casos que você expõe essa informação para o usuário, como um código de pedido. 30 | 31 | ## Estudar sobre 32 | 33 | Database Indexes 34 | Árvores Balanceadas 35 | Árvores BTree 36 | Transações ACID (DB) 37 | SQLite3 38 | Constraints 39 | CAP Theorem 40 | Graceful degradation 41 | Surrogate keys 42 | Consistent Hashing 43 | 44 | ## Links 45 | 46 | [ Dynamo: Amazon’s highly available key-value store ](https://www.amazon.science/publications/dynamo-amazons-highly-available-key-value-store) 47 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/worldcup/tournament.py: -------------------------------------------------------------------------------- 1 | # Simulate a sports tournament 2 | 3 | import csv 4 | import sys 5 | import random 6 | 7 | # Number of simulations to run 8 | N = 1000 9 | 10 | 11 | def main(): 12 | 13 | # Ensure correct usage 14 | if len(sys.argv) != 2: 15 | sys.exit("Usage: python tournament.py FILENAME") 16 | 17 | teams = [] 18 | 19 | teamfile = sys.argv[1] 20 | 21 | with open(teamfile, "r") as file: 22 | csvReader = csv.DictReader(file) 23 | for row in csvReader: 24 | row['rating'] = int(row['rating']) 25 | teams.append(row) 26 | 27 | # team: rating: 28 | # key "name" value "how many tournaments this team won" 29 | counts = {} 30 | for _ in range(N): 31 | tournamentWinner = simulate_tournament(teams) 32 | if tournamentWinner in counts: 33 | counts[tournamentWinner] += 1 34 | else: 35 | counts[tournamentWinner] = 1 36 | 37 | # Print each team's chances of winning, according to simulation 38 | for team in sorted(counts, key=lambda team: counts[team], reverse=True): 39 | print(f"{team}: {counts[team] * 100 / N:.1f}% chance of winning") 40 | 41 | 42 | def simulate_game(team1, team2): 43 | """Simulate a game. Return True if team1 wins, False otherwise.""" 44 | rating1 = team1["rating"] 45 | rating2 = team2["rating"] 46 | probability = 1 / (1 + 10 ** ((rating2 - rating1) / 600)) 47 | return random.random() < probability 48 | 49 | 50 | def simulate_round(teams): 51 | """Simulate a round. Return a list of winning teams.""" 52 | winners = [] 53 | 54 | # Simulate games for all pairs of teams 55 | for i in range(0, len(teams), 2): 56 | if simulate_game(teams[i], teams[i + 1]): 57 | winners.append(teams[i]) 58 | else: 59 | winners.append(teams[i + 1]) 60 | 61 | return winners 62 | 63 | 64 | def simulate_tournament(teams): 65 | """Simulate a tournament. Return name of winning team.""" 66 | if len(teams) == 1: 67 | return teams[0]['team'] 68 | else: 69 | simulateResult = simulate_round(teams) 70 | return simulate_tournament(simulateResult) 71 | 72 | 73 | if __name__ == "__main__": 74 | main() -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/popup.css: -------------------------------------------------------------------------------- 1 | @import url('https://css.gg/extension.css'); 2 | 3 | main { 4 | min-width: 350px; 5 | } 6 | 7 | header { 8 | background-color: var(--white-bg-color); 9 | width: 100%; 10 | padding: 0.5rem 1.25rem; 11 | display: flex; 12 | justify-content: space-between; 13 | align-items: center; 14 | } 15 | 16 | #go-to-options { 17 | background-color: var(--light-bg-color); 18 | border:none; 19 | border-radius: 0.25rem; 20 | } 21 | 22 | #go-to-options svg{ 23 | color: var(--subheadline-color); 24 | display: block; 25 | padding: 0.25rem; 26 | } 27 | 28 | h2 { 29 | color:var(--content-color); 30 | font-size: 0.875rem; 31 | font-weight: normal; 32 | } 33 | 34 | .content { 35 | padding:0 20px; 36 | background-color: var(--light-bg-color); 37 | } 38 | 39 | .tracked-coins { 40 | background-color: var(--white-bg-color); 41 | border-radius:8px; 42 | width: 90%; 43 | margin: 1rem 0; 44 | max-height: 350px; 45 | overflow-y: scroll; 46 | } 47 | 48 | #coin-table { 49 | width: 100%; 50 | border-spacing:0 0.5rem; 51 | } 52 | 53 | #coin-table th { 54 | font-weight: 400; 55 | padding: 0.25rem 0.5rem; 56 | text-align:left; 57 | color:var(--content-color); 58 | } 59 | 60 | #coin-table th:last-child { 61 | text-align:center; 62 | } 63 | 64 | #coin-data .coin-market { 65 | display: flex; 66 | align-items: center; 67 | } 68 | 69 | #coin-data td { 70 | border: 0; 71 | font-weight: normal; 72 | padding: 0.5rem; 73 | color: var(--content-color); 74 | border-radius:0.25rem; 75 | } 76 | 77 | .coin-image { 78 | width: 2rem; 79 | height: 2rem; 80 | margin-right: 0.8rem; 81 | } 82 | 83 | .coin-identifiers { 84 | display: flex; 85 | flex-direction: column; 86 | } 87 | 88 | .coin-identifiers--symbol, .coin-price { 89 | font-weight: 600; 90 | } 91 | 92 | .coin-change { 93 | text-align: center; 94 | } 95 | 96 | .coin-change--positive { 97 | background: rgba(207, 255, 241, 0.4); 98 | color: var(--success-color); 99 | font-weight: 600; 100 | padding: 0.25rem 0.5rem; 101 | border-radius: 0.5rem; 102 | } 103 | 104 | .coin-change--negative { 105 | background: rgba(252, 55, 55, 0.1); 106 | color: var(--error-color); 107 | font-weight: 600; 108 | padding: 0.25rem 0.5rem; 109 | border-radius: 0.5rem; 110 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/dna/dna.py: -------------------------------------------------------------------------------- 1 | from sys import exit, argv 2 | import os 3 | import csv 4 | import re 5 | 6 | 7 | def main(): 8 | if len(argv) != 3: 9 | print("Usage: python dna.py CSVSTR TXTDNA") 10 | exit() 11 | 12 | dnaFile = argv[1] 13 | sequenceFile = argv[2] 14 | 15 | validateFileType(dnaFile, '.csv') 16 | validateFileType(sequenceFile, '.txt') 17 | 18 | openSequence = open(sequenceFile, 'r') 19 | sequenceContent = openSequence.read() 20 | openSequence.close() 21 | 22 | with open(dnaFile, "r") as file: 23 | csvReader = csv.DictReader(file) 24 | result = {} 25 | for row in csvReader: 26 | result[row['name']] = [] 27 | for key in row: 28 | if key != "name": 29 | if maximumStrRepeats(sequenceContent, key) == str(row[key]): 30 | result[row['name']].append(True) 31 | else: 32 | result[row['name']].append(False) 33 | 34 | finalResult = 'No Match' 35 | 36 | for key in result: 37 | if all(result[key]): 38 | finalResult = key 39 | 40 | print(finalResult) 41 | 42 | 43 | def validateFileType(file, expectedExtension): 44 | name, extension = os.path.splitext(file) 45 | if extension != expectedExtension: 46 | print("Invalid file type") 47 | exit() 48 | 49 | 50 | def maximumStrRepeats(sequence, dnaPattern): 51 | p = rf'({dnaPattern})\1*' 52 | pattern = re.compile(p) 53 | match = [match for match in pattern.finditer(sequence)] 54 | max = 0 55 | for i in range(len(match)): 56 | if match[i].group().count(dnaPattern) > max: 57 | max = match[i].group().count(dnaPattern) 58 | return str(max) 59 | 60 | ''' 61 | I don't know where it's wrong, ever has 1 of difference in some sequences.txt. 62 | lengthPattern = len(dnaPattern) 63 | totalSequence = 0 64 | maxSequence = 0 65 | for i in range(len(sequence)): 66 | if sequence[i : i + lengthPattern] == dnaPattern: 67 | while sequence[i - lengthPattern : i] == dnaPattern: 68 | totalSequence += 1 69 | i+=1 70 | elif totalSequence > maxSequence: 71 | maxSequence = totalSequence 72 | #print(maxSequence, totalSequence, 'x') 73 | return str(maxSequence + 1) 74 | ''' 75 | 76 | 77 | if __name__ == "__main__": 78 | main() -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/plurality/plurality.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Max number of candidates 6 | #define MAX 9 7 | 8 | // Candidates have name and vote count 9 | typedef struct 10 | { 11 | string name; 12 | int votes; 13 | } 14 | candidate; 15 | 16 | // Array of candidates 17 | candidate candidates[MAX]; 18 | 19 | // Number of candidates 20 | int candidate_count; 21 | 22 | // Function prototypes 23 | bool vote(string name); 24 | void print_winner(void); 25 | 26 | int main(int argc, string argv[]) 27 | { 28 | // Check for invalid usage 29 | if (argc < 2) 30 | { 31 | printf("Usage: plurality [candidate ...]\n"); 32 | return 1; 33 | } 34 | 35 | // Populate array of candidates 36 | candidate_count = argc - 1; 37 | if (candidate_count > MAX) 38 | { 39 | printf("Maximum number of candidates is %i\n", MAX); 40 | return 2; 41 | } 42 | for (int i = 0; i < candidate_count; i++) 43 | { 44 | candidates[i].name = argv[i + 1]; 45 | candidates[i].votes = 0; 46 | } 47 | 48 | int voter_count = get_int("Number of voters: "); 49 | 50 | // Loop over all voters 51 | for (int i = 0; i < voter_count; i++) 52 | { 53 | string name = get_string("Vote: "); 54 | 55 | // Check for invalid vote 56 | if (!vote(name)) 57 | { 58 | printf("Invalid vote.\n"); 59 | } 60 | } 61 | 62 | // Display winner of election 63 | print_winner(); 64 | } 65 | 66 | // Update vote totals given a new vote 67 | bool vote(string name) 68 | { 69 | // TODO 70 | for (int i = 0; i < candidate_count; i++) 71 | { 72 | if (strcmp(name, candidates[i].name) == 0) 73 | { 74 | candidates[i].votes += 1; 75 | return true; 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | // Print the winner (or winners) of the election 82 | void print_winner(void) 83 | { 84 | // TODO 85 | int actualGreatter = 0; 86 | //How can I return this without 2 loops? 87 | for (int i = 0; i < candidate_count; i++) 88 | { 89 | if (candidates[i].votes > actualGreatter) 90 | { 91 | actualGreatter = candidates[i].votes; 92 | } 93 | } 94 | 95 | for (int i = 0; i < candidate_count; i++) 96 | { 97 | if (candidates[i].votes == actualGreatter) 98 | { 99 | printf("%s\n", candidates[i].name); 100 | } 101 | } 102 | return; 103 | } -------------------------------------------------------------------------------- /resumos/akita-videos/rant-programacao-nao-e-facil.md: -------------------------------------------------------------------------------- 1 | # RANT: Programação NÃO É Fácil 2 | 3 | [Video](https://www.youtube.com/watch?v=V7oUDL7E1g4) 4 | 5 | ## Resumo 6 | 7 | Monopólios ou oligopólio são massacrantes e normalmente criados por governos. Sempre prejudicam os menores. 8 | 9 | --- 10 | 11 | Os "vales" (Silicon Valey e afins) de riqueza chamam muita atenção pela fartura presente no meio. 12 | 13 | É necessário tomar cuidado com o "equity", muitas pessoas buscando um mesmo local com salários altos faz o mercado se equilibrar na outra ponta. O que muitas vezes faz o salário "alto" ser diluido em serviços básicos. 14 | 15 | Ao analisar médias salariais lembre-se de analisar contexto, valores e custos de vida. Evite análise de valores absolutos ou conversões diretas. 16 | 17 | Cuidado com promessas de "equity". Valores não absolutos. 18 | 19 | --- 20 | 21 | Empresas em busca de redução de custos podem pender para "Outsourcing" e buscar profissionais mais baratos em outros países (India, Brasil, Ucrânia...) 22 | 23 | --- 24 | 25 | Programador não é herói do mundo. É uma profissão como qualquer outra. 26 | 27 | Quando todo esse dinheiro "fantasma" sumir e a bolha estourar, quem não for [programador de verdade](https://www.eximiaco.tech/pt/2019/05/31/somos-amadores-remunerados/) e não souber entregar resultado, ficará sem emprego. 28 | 29 | Oferta vs Demanda. 30 | ![Oferta e Demanda](https://s.dicionariofinanceiro.com/imagens/leidaofertaedemanda-0-cke.jpg) 31 | 32 | O quando você vale é = sua qualidade, oferta e demanda. 33 | 34 | Quando a demanda está desproporcional profissionais de baixa qualidade acabam ganhando algo. Mas são os primeiros a serem cortados em um retração do mercado. 35 | 36 | > Mercados não melhoram com discursos 37 | 38 | --- 39 | 40 | Cuidado com promessas de conhecimento rápido e certificados magicamente extraordinários, isso é reflexo de um mercado em abundância. 41 | 42 | > É impossivel tornar-se um ótimo programador do 0 em 2 semanas" 43 | 44 | Não entre em promessas de coach excepcional, você pode acabar correndoa atrás do ouro de tolo. 45 | 46 | Poucas horas de treino é um % muito baixa para se tornar um profissional excelente. 47 | 48 | > O excesso de pessoas na defensiva e em um nível básico é devido ao crescimento excessivo e posições desnecessárias 49 | 50 | > Evite estacionar no básico e se achar bom o suficiente 51 | 52 | Foque em ter uma base sólida para que suas habilidades sempre cresçam. Profissionais com essa visão sempre terão seu lugar. 53 | 54 | Em toda profissão de prátca você pode ter ídolos, mas as chances de se tornar um deles é baixa. O sucesso é uma combinação de habilidade, prática, sorte e hora certa. 55 | 56 | **Pare de colocar a culpa na sociedade, assuma seus riscos e tenha responsabilidade.** 57 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/styles.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&family=Poppins:wght@800&display=swap'); 2 | 3 | /* 4 | font-family: 'Open Sans', sans-serif; 5 | 6 | font-family: 'Poppins', sans-serif; 7 | */ 8 | 9 | body{ 10 | font-family: 'Open Sans', sans-serif; 11 | } 12 | 13 | .logo{ 14 | font-family: 'Poppins', sans-serif; 15 | } 16 | 17 | .banner{ 18 | background-color:#b7cbfd; 19 | } 20 | 21 | .banner h1{ 22 | color:#4d51ac; 23 | font-family: 'Poppins', sans-serif; 24 | } 25 | 26 | .banner p { 27 | font-size:18px; 28 | } 29 | 30 | .banner a{ 31 | padding:12px 21px; 32 | align-items:center; 33 | -webkit-transition: box-shadow .25s ease,-webkit-transform .25s ease; 34 | transition: box-shadow .25s ease,-webkit-transform .25s ease; 35 | transition: box-shadow .25s ease,transform .25s ease; 36 | transition: box-shadow .25s ease,transform .25s ease,-webkit-transform .25s ease; 37 | } 38 | 39 | .banner a:hover{ 40 | box-shadow: 0 1rem 2.5rem rgba(22,28,45,.1),0 .5rem 1rem -.75rem rgba(22,28,45,.1) !important; 41 | -webkit-transform: translate3d(0,-3px,0); 42 | transform: translate3d(0,-3px,0); 43 | } 44 | 45 | .card-home i{ 46 | font-size:36px; 47 | color:#ffc107; 48 | } 49 | 50 | .floating-card { 51 | position:fixed; 52 | right:0; 53 | bottom:0; 54 | box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px; 55 | z-index:8; 56 | } 57 | 58 | /* Loader */ 59 | 60 | .card-btc{ 61 | width:150px; 62 | height:40; 63 | } 64 | 65 | .spinner { 66 | border: 8px solid rgba(0, 0, 0, 0.1); 67 | border-left-color: #ffc107; 68 | border-radius: 50%; 69 | width: 30px; 70 | height: 30px; 71 | animation: spin 1s linear infinite; 72 | } 73 | 74 | @keyframes spin { 75 | to { 76 | transform: rotate(360deg); 77 | } 78 | } 79 | 80 | .card-exchange { 81 | box-shadow: 0 1.5rem 4rem rgba(22,28,45,.05); 82 | border:none; 83 | padding:16px; 84 | -webkit-transition: box-shadow .25s ease,-webkit-transform .25s ease; 85 | transition: box-shadow .25s ease,-webkit-transform .25s ease; 86 | transition: box-shadow .25s ease,transform .25s ease; 87 | transition: box-shadow .25s ease,transform .25s ease,-webkit-transform .25s ease; 88 | } 89 | 90 | .card-exchange:hover { 91 | box-shadow: 0 1rem 2.5rem rgba(22,28,45,.1),0 .5rem 1rem -.75rem rgba(22,28,45,.1) !important; 92 | -webkit-transform: translate3d(0,-3px,0); 93 | transform: translate3d(0,-3px,0); 94 | } 95 | 96 | .card-exchange a { 97 | color:#4c4c4c; 98 | } 99 | 100 | .card-exchange a:hover { 101 | text-decoration:none; 102 | } 103 | 104 | .card-exchange h3 { 105 | font-weight:bold; 106 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture2.md: -------------------------------------------------------------------------------- 1 | ## Resume 2 | 3 | CS50 commands: 4 | 5 | - debug50 (Try to ever use debugger) 6 | - check50 (Helps muscle on do things with test) 7 | - style50 (Helps to develop muscle on design codes) 8 | - help50 (Help to find bug like a teacher in your console) 9 | 10 | Library is code that other people wrote 11 | 12 | > If stucked explain code to yourself 13 | 14 | Debug can add breakpoints into your code 15 | 16 | > Use debbuger even is possible 17 | 18 | On Clang compiler this happen: 19 | Preprocessing -> Compiling -> Assembling -> Linking 20 | 21 | Preprocessing: Something like copy/paste all library codes inside your programm 22 | 23 | Compiling: Transform source code into machine code, in Clang this take C code and compile in Assembly 24 | 25 | Assembling: Transform Assembly code in Binary 26 | 27 | Linking: Link all binary files in one file 28 | 29 | > Write code that is easy to read, mantain and understand 30 | 31 | **TEST!** 32 | 33 | ### Functions 34 | 35 | Function can be named like procedure, methods or subroutines 36 | 37 | Function = blackbox with 0+inputs and 1 output 38 | 39 | Functions can help us with organization, simplification and reusability 40 | 41 | > Give functions meaningful names 42 | 43 | Functions separate our code into small pieces of code with one purpose. 44 | 45 | Declaration: `return-type name(argument-list);` 46 | Definition: 47 | 48 | ```c 49 | int sum(num1, num2){ 50 | return num1 + num2; 51 | } 52 | ``` 53 | 54 | Exercise: 55 | Is a valid triangle? 56 | 57 | ```c 58 | #include 59 | #include 60 | 61 | bool valid_triangle(float side1, float side2, float side3); 62 | 63 | int main(void){ 64 | valid_triangle(2,3,4); 65 | } 66 | 67 | bool valid_triangle(float side1, float side2, float side3){ 68 | 69 | if(side1 < 0 || side2 < 0 || side3 < 0){ 70 | return false; 71 | } 72 | 73 | if(side1 + side2 < side3 || side2 + side1 < side3 || side2 + side3 < side1){ 74 | return false; 75 | } 76 | 77 | return true; 78 | } 79 | ``` 80 | 81 | ### Arrays 82 | 83 | Arrays hold values of the same data type 84 | 85 | Array is a block of contiguos space in memory 86 | 87 | Array of elements acessed by index number 88 | 89 | Model array `type name[size]` <- size is amount of elements array contain 90 | 91 | `int student_grades[40]` 92 | 93 | Instantiation syntax: `bool truthtable[3] = {true, false, true}` 94 | 95 | ### Command Line Arguments 96 | argc - Argument count 97 | argv - Argument vector 98 | 99 | ```c 100 | int main(int argc string argv[]) 101 | ``` 102 | 103 | This means if I provide a command like: `./hello cs50` the argc is equal 2 and argv equal ["./hello", "cs50"] 104 | 105 | ## Mentions 106 | 107 | - [Grace Hopper](https://en.wikipedia.org/wiki/Grace_Hopper) 108 | 109 | ## Links 110 | 111 | - [Origin of bug term](https://en.wikipedia.org/wiki/Software_bug) 112 | - [CS50 IDE](https://ide.cs50.io/) 113 | - [CS50 Docs](https://cs50.readthedocs.io/) 114 | - [CS50 Programmer's Manual](https://man.cs50.io/) 115 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture3.md: -------------------------------------------------------------------------------- 1 | ## Resume 2 | 3 | Big O notation = To describe the worst case algorithm scenario 4 | Omega Ω notation = To describe the best case algorithm scenario 5 | Theta Θ notation = To describe a algorithm if the best and worst case is the same O 6 | 7 | Linear search go one by one searching: Big(O) = O(n) / Ω = Ω(1) 8 | 9 | Binary search divide search in half, but this only work in sorted array: Big(O) = O(logn) / Ω = Ω(1) 10 | 11 | Selection Sort: Look for small number and move to the start... one by one = O(n2) / Ω = Ω(n-1) 12 | 13 | ```c 14 | // C simple linear search 15 | #include 16 | #include 17 | 18 | int main(void) 19 | { 20 | int numbers[6] = {3,5,2,12,31,42}; 21 | for (int i = 0; i < 6; i++) 22 | { 23 | if(numbers[i] == 50) 24 | { 25 | printf("Found!\n"); 26 | return 0; //Return convention 1 equals success 27 | } 28 | } 29 | prinf ("Not found\n"); 30 | return 1; //Return convention 1 equals failure 31 | } 32 | ``` 33 | 34 | typedef = Type definition in C 35 | With type definition you can create some like an object 36 | 37 | ```c 38 | #include 39 | #include 40 | #include 41 | 42 | typedef struct // Struct is a container for multiple data types 43 | { 44 | string name; 45 | string number; 46 | } 47 | person; //Defined a custom data type called person 48 | 49 | int main(void) 50 | { 51 | person people[2]; 52 | 53 | people[0].name = "Italo"; 54 | people[0].number = "41 9999-0595"; 55 | people[1].name = "Helo"; 56 | people[1].number = "43 9856-6598"; 57 | 58 | for (int i=0; i < 2; i++) 59 | { 60 | if (strcmp(people[i].name, "Italo") == 0) 61 | { 62 | printf("%s\n", people[i].number); 63 | return 0; 64 | } 65 | } 66 | 67 | printf ("Not found \n"); 68 | return 1; 69 | } 70 | 71 | ``` 72 | 73 | Recursion 74 | 75 | ```c 76 | #include 77 | #include 78 | 79 | void draw(int height); 80 | 81 | int main(void) 82 | { 83 | int height = get_int("Height of pyramid: "); 84 | draw(height); 85 | } 86 | 87 | void draw(int height) 88 | { 89 | if (height == 0){ 90 | return; 91 | } 92 | 93 | draw(height - 1); 94 | 95 | for (int i = 0; i < height; i++) 96 | { 97 | printf ("#"); 98 | } 99 | 100 | printf ("\n"); 101 | } 102 | ``` 103 | 104 | If some algorithm is dividing, dividing, dividing... This is a logarithm 105 | 106 | ## Linear Search 107 | 108 | Iterate from all array left->right, until find the target value. 109 | O(n) - Worst scenario 110 | Ω(1) - Best scenario 111 | 112 | ## Binary Search 113 | 114 | Divide and conquer, we just can use binary search if the array is shorted 115 | 116 | Take the middle point of the array 117 | Is your value? Finish 118 | Not? Is less or high? 119 | Change position to middle (left or right) and do all again 120 | 121 | O(log n) - Worst scenario 122 | Ω(1) - Best scenario 123 | 124 | ## Links 125 | 126 | - [Big O Notation](https://en.wikipedia.org/wiki/Big_O_notation) 127 | - [Comparison Sorting Algorithm Visualization](https://www.cs.usfca.edu/~galles/visualization/ComparisonSort.html) 128 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/options.js: -------------------------------------------------------------------------------- 1 | /*---- Target DOM Elements ----*/ 2 | 3 | let divCoins = document.getElementById('selected-coins') 4 | let dropdown = document.getElementById('coins-dropdown'); 5 | const formSelectCoin = document.getElementById("select-coin"); 6 | 7 | 8 | /*---- Create and Fill Select Coin Options ----*/ 9 | dropdown.length = 0; 10 | let defaultOption = document.createElement('option'); 11 | defaultOption.text = 'Choose Coin'; 12 | 13 | dropdown.add(defaultOption); 14 | dropdown.selectedIndex = 0; 15 | 16 | const url = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=gecko_desc&per_page=250'; 17 | 18 | async function getCoinList(){ 19 | return fetch(url) 20 | .then(response => { 21 | if (!response.ok) { throw response } 22 | return response.json() 23 | }) 24 | .catch(error => console.log(error)) 25 | } 26 | 27 | async function populateSelectCoin() { 28 | const data = await getCoinList(); 29 | if(data){ 30 | let option; 31 | for (let i = 0; i < data.length; i++) { 32 | option = document.createElement('option'); 33 | option.text = data[i].name; 34 | option.value = data[i].id; 35 | dropdown.add(option); 36 | } 37 | } 38 | } 39 | 40 | populateSelectCoin(); 41 | 42 | /*---- Change and update storage ----*/ 43 | 44 | function addCoinToStorage(coin){ 45 | chrome.storage.sync.get(['coins'], function(result) { 46 | if(result.coins) { 47 | const newArray = [...result.coins, coin] 48 | chrome.storage.sync.set({'coins': newArray}); 49 | } else { 50 | chrome.storage.sync.set({'coins': [ coin ]}); 51 | } 52 | }); 53 | location.reload() 54 | } 55 | 56 | function deleteCoinFromStorage(id) { 57 | chrome.storage.sync.get(['coins'], function(result) { 58 | if(result.coins) { 59 | const filterResult = result.coins.filter(coin => coin.id !== id) 60 | chrome.storage.sync.set({'coins': filterResult}); 61 | } 62 | }); 63 | location.reload() 64 | } 65 | 66 | /*---- Listen to form submit ----*/ 67 | 68 | formSelectCoin.addEventListener("submit", function(evt) { 69 | evt.preventDefault(); 70 | const { text:name, value:id } = dropdown.options[dropdown.selectedIndex] 71 | addCoinToStorage({ id, name }) 72 | }); 73 | 74 | /*---- Crate selected Coin List ----*/ 75 | 76 | function createCoinItem(id, name) { 77 | let itemCoin = document.createElement('div') 78 | let itemContent = document.createTextNode(name) 79 | let deleteButton = document.createElement('button') 80 | deleteButton.innerHTML = "x" 81 | deleteButton.id = id 82 | deleteButton.addEventListener('click', (e) => deleteCoinFromStorage(e.target.id)) 83 | itemCoin.className = 'coin-item' 84 | itemCoin.appendChild(itemContent) 85 | itemCoin.appendChild(deleteButton) 86 | divCoins.appendChild(itemCoin) 87 | } 88 | 89 | function createCoinsList(coins) { 90 | coins.forEach((item) => { 91 | createCoinItem(item.id, item.name) 92 | }); 93 | } 94 | 95 | function populateSelecteds() { 96 | chrome.storage.sync.get(['coins'], function (obj) { 97 | createCoinsList(obj.coins) 98 | }) 99 | } 100 | 101 | /* Run on Start */ 102 | 103 | populateSelecteds(); -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/trivia/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Trivia! 8 | 9 | 45 | 46 | 47 | 48 | 49 |
50 |

Trivia!

51 |
52 | 53 |
54 | 55 |
56 |

Part 1: Multiple Choice

57 |
58 |

What is the approximate ratio of people to sheep in New Zeland?

59 |

60 | 61 | 62 | 63 | 64 | 65 | 66 |
67 | 68 |
69 |

Part 2: Free Response

70 |
71 |

In which country is it illegal to own only one guinea pig, as a lone guinea pig might get lonely?

72 |

73 | 74 |
75 | 76 | 77 |
78 |
79 | 80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/finance/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | C$50 Finance: {% block title %}{% endblock %} 23 | 24 | 25 | 26 | 27 | 28 | 52 | 53 | {% if get_flashed_messages() %} 54 |
55 | 58 |
59 | {% endif %} 60 | 61 |
62 | {% block main %}{% endblock %} 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture1.md: -------------------------------------------------------------------------------- 1 | ## Resume 2 | 3 | SOURCE CODE (file.c) -> COMPILER -> MACHINE CODE(file.out) (0010) 4 | 5 | > Computers only do what you tell they to do 6 | 7 | First code in C: 8 | 9 | ```c 10 | #include 11 | 12 | int main(void){ 13 | printf("Hello World!\n"); 14 | } 15 | ``` 16 | 17 | Second code: 18 | 19 | ```c 20 | #include 21 | #include 22 | 23 | int main(void){ 24 | string answer = get_string("What's your name? \n"); 25 | printf("Hello, %s \n", answer); 26 | } 27 | ``` 28 | 29 | The terminal (prompt, bash) provide some commands like ls (list), cd (change directory), mkdir (make directory), rm (remove), rmdir(remove dir) and [many others](https://ss64.com/bash/) 30 | 31 | Everything you can do with your mouse, you also do in command line. 32 | 33 | '=' is assign in programming, so `age = 1995` means assign `1995` to `age` 34 | 35 | > Read the documentation, and ask Google. 36 | 37 | If you want to read some code brek it in different parts. 38 | 39 | > If you have questions, try it. 40 | 41 | Link or include some library in my code is like combine somewhere code with mine code and compile into one program. 42 | 43 | Data types are some: bool, integer, string, char, float, long... 44 | 45 | > Programming is muscle memory 46 | 47 | Third code: 48 | 49 | ```c 50 | #include 51 | #include 52 | 53 | int main(void){ 54 | int age = get_int("What's your age?\n"); 55 | printf("You're %i\n", age * 365); 56 | } 57 | ``` 58 | 59 | Parity code: 60 | 61 | ```c 62 | #include 63 | #include 64 | 65 | int main(void){ 66 | int number = get_int("What number?\n"); 67 | 68 | if(number % 2 == 0){ 69 | printf("Number is even"); 70 | } else { 71 | printf("Number is odd"); 72 | } 73 | } 74 | ``` 75 | 76 | Cough with functions: 77 | 78 | ```c 79 | #include 80 | #include 81 | 82 | void cough(int n); 83 | 84 | int main(void){ 85 | cough(3); 86 | } 87 | 88 | void cough(int n){ 89 | for(int i = 0; i < n; i++){ 90 | printf("cough!\n"); 91 | } 92 | } 93 | ``` 94 | 95 | > Writing a good or a bad code is a lot about design decisions 96 | 97 | ### Data Types - Shorts 98 | 99 | `void` in C is nothing, returns nothing. 100 | 101 | Only declare a variable if you need it. 102 | 103 | - `int age;` <- Declaration 104 | - `age = 1995;` <- Assignment 105 | 106 | Initilization is when you declare and assign a variable at the same time: 107 | `int power = 9001;` 108 | 109 | #### Operators and Expressions: 110 | 111 | - Arithmetic `+ - * / %` 112 | - Syntax Sugar `*= -= += ++ --` 113 | - Boolean `true false 0 1`, any number > 0 is true 114 | - Logical `&& (AND) || (OR)` 115 | - Not `!x` 116 | - Relational `< > <= >=` 117 | - Equality `==` 118 | - Inequality `!==` 119 | 120 | #### Conditionals 121 | 122 | ```c 123 | if(boolean-expression){ 124 | // execute this 125 | } else if(another-boolean){ 126 | // execute this 127 | } else { 128 | // execute this 129 | } 130 | ``` 131 | 132 | Switch, case-break-case-case-default 133 | 134 | Ternary, `x > 4 ? true : false` 135 | 136 | #### Loops 137 | 138 | `while, do while, for` 139 | 140 | `for(start;expression;increment)` 141 | 142 | #### Basic linux commands 143 | 144 | ```bash 145 | cd - ls - mkdir - pwd - cp - mv - rm - rmdir 146 | chmod - ln - touch - rmdir - man - diff - sudo - clear - telnet 147 | ``` 148 | 149 | ## Links 150 | 151 | - [Sandbox CS50](https://sandbox.cs50.io) 152 | - [LAB CS50](https://lab.cs50.io/) 153 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/labs/inheritance/inheterance.c: -------------------------------------------------------------------------------- 1 | // Simulate genetic inheritance of blood type 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | // Each person has two parents and two alleles 9 | typedef struct person 10 | { 11 | struct person *parents[2]; 12 | char alleles[2]; 13 | } 14 | person; 15 | 16 | const int GENERATIONS = 3; 17 | const int INDENT_LENGTH = 4; 18 | 19 | person *create_family(int generations); 20 | void print_family(person *p, int generation); 21 | void free_family(person *p); 22 | char random_allele(); 23 | 24 | int main(void) 25 | { 26 | // Seed random number generator 27 | srand(time(0)); 28 | 29 | // Create a new family with three generations 30 | person *p = create_family(GENERATIONS); 31 | 32 | // Print family tree of blood types 33 | print_family(p, 0); 34 | 35 | // Free memory 36 | free_family(p); 37 | } 38 | 39 | int rand_number() 40 | { 41 | return rand() % 2; 42 | } 43 | 44 | // Create a new individual with `generations` 45 | person *create_family(int generations) 46 | { 47 | // TODO: Allocate memory for new person 48 | person *new_person = malloc(sizeof(person)); 49 | 50 | if (!new_person) 51 | { 52 | return NULL; 53 | } 54 | 55 | // Generation with parent data 56 | if (generations > 1) 57 | { 58 | // TODO: Recursively create blood type histories for parents 59 | new_person->parents[0] = create_family(generations - 1); 60 | new_person->parents[1] = create_family(generations - 1); 61 | // TODO: Randomly assign child alleles based on parents 62 | 63 | new_person->alleles[0] = new_person->parents[0]->alleles[rand_number()]; 64 | new_person->alleles[1] = new_person->parents[1]->alleles[rand_number()]; 65 | } 66 | 67 | // Generation without parent data 68 | else 69 | { 70 | // TODO: Set parent pointers to NULL 71 | new_person->parents[0] = NULL; 72 | new_person->parents[1] = NULL; 73 | 74 | // TODO: Randomly assign alleles 75 | new_person->alleles[0] = random_allele(); 76 | new_person->alleles[1] = random_allele(); 77 | } 78 | 79 | // TODO: Return newly created person 80 | return new_person; 81 | } 82 | 83 | // Free `p` and all ancestors of `p`. 84 | void free_family(person *p) 85 | { 86 | // TODO: Handle base case 87 | if (!p) 88 | { 89 | return; 90 | } 91 | // TODO: Free parents 92 | free_family(p->parents[0]); 93 | free_family(p->parents[1]); 94 | // TODO: Free child 95 | free(p); 96 | } 97 | 98 | // Print each family member and their alleles. 99 | void print_family(person *p, int generation) 100 | { 101 | // Handle base case 102 | if (p == NULL) 103 | { 104 | return; 105 | } 106 | 107 | // Print indentation 108 | for (int i = 0; i < generation * INDENT_LENGTH; i++) 109 | { 110 | printf(" "); 111 | } 112 | 113 | // Print person 114 | printf("Generation %i, blood type %c%c\n", generation, p->alleles[0], p->alleles[1]); 115 | print_family(p->parents[0], generation + 1); 116 | print_family(p->parents[1], generation + 1); 117 | } 118 | 119 | // Randomly chooses a blood type allele. 120 | char random_allele() 121 | { 122 | int r = rand() % 3; 123 | if (r == 0) 124 | { 125 | return 'A'; 126 | } 127 | else if (r == 1) 128 | { 129 | return 'B'; 130 | } 131 | else 132 | { 133 | return 'O'; 134 | } 135 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/speller/speller.c: -------------------------------------------------------------------------------- 1 | // Implements a dictionary's functionality 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "dictionary.h" 10 | 11 | // Represents a node in a hash table 12 | typedef struct node 13 | { 14 | char word[LENGTH + 1]; 15 | struct node *next; 16 | } 17 | node; 18 | 19 | // Number of buckets in hash table 20 | const unsigned int N = 65536; 21 | int wordsInDictionary = 0; 22 | // Hash table 23 | node *table[N]; 24 | // Returns true if word is in dictionary, else false 25 | bool check(const char *word) 26 | { 27 | unsigned int hashIndex = hash(word); 28 | 29 | // head 30 | node *cursor = table[hashIndex]; 31 | 32 | if (cursor == NULL) 33 | { 34 | return false; 35 | } 36 | // strcasecmp(word, cursor) 37 | 38 | while (cursor != NULL) 39 | { 40 | int compare = strcasecmp(word, cursor->word); 41 | if (compare == 0) 42 | { 43 | return true; 44 | } 45 | cursor = cursor->next; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | // Hashes word to a number 52 | /* 53 | Reference: http://www.cse.yorku.ca/%7Eoz/hash.html 54 | */ 55 | unsigned int hash(const char *str) 56 | { 57 | unsigned long hash = 5381; 58 | int c; 59 | while ((c = tolower(*str++))) 60 | { 61 | hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ 62 | } 63 | /*Limit bucket*/ 64 | return hash % N; 65 | } 66 | 67 | /* 68 | 1 - Open dictionary file - OK 69 | 2 - Read strins from file one at time - OK 70 | 3 - Create a new node for each word - OK 71 | 4 - Hash word to obtain a hash value - OK 72 | 5 - Insert node into hash table at that location - OK 73 | */ 74 | 75 | // Loads dictionary into memory, returning true if successful, else false 76 | bool load(const char *dictionary) 77 | { 78 | FILE *dictionaryFile; 79 | dictionaryFile = fopen(dictionary, "r"); 80 | char word[LENGTH]; 81 | 82 | if (dictionaryFile == NULL) 83 | { 84 | fputs("File error ", stderr); 85 | return false; 86 | } 87 | 88 | while (fscanf(dictionaryFile, "%s", word) == 1) 89 | { 90 | node *n = malloc(sizeof(node)); 91 | 92 | if (n == NULL) 93 | { 94 | return false; 95 | } 96 | 97 | // Copy word into node 98 | strcpy(n->word, word); 99 | n->next = NULL; 100 | 101 | // call hash function 102 | unsigned int hashIndex = hash(word); 103 | 104 | n->next = table[hashIndex]; 105 | 106 | table[hashIndex] = n; 107 | wordsInDictionary++; 108 | } 109 | fclose(dictionaryFile); 110 | return true; 111 | } 112 | 113 | // Returns number of words in dictionary if loaded, else 0 if not yet loaded 114 | unsigned int size(void) 115 | { 116 | return wordsInDictionary; 117 | // Count each word on load function 118 | } 119 | 120 | // Unloads dictionary from memory, returning true if successful, else false 121 | bool unload(void) 122 | { 123 | for (int count = 0; count < N; count++) 124 | { 125 | node *cursor = table[count]; 126 | 127 | while (cursor) 128 | { 129 | node *temp = cursor; 130 | cursor = cursor->next; 131 | free(temp); 132 | } 133 | 134 | if (count == N - 1 && cursor == NULL) 135 | { 136 | return true; 137 | } 138 | } 139 | 140 | 141 | return false; 142 | } 143 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/final-project/README.md: -------------------------------------------------------------------------------- 1 | # Cryfo 2 | #### Video Demo: https://youtu.be/nGyuO2F05GI 3 | 4 | #### Description: 5 | 6 | This project is based on two API's [Coin Gecko API](https://www.coingecko.com/en/api) and [Chrome Extensions API](https://developer.chrome.com/docs/extensions) 7 | 8 | **Coin Gecko API**: Is responsible for providing all data about the crypto market, I used this API because it's free and open, so this allows me to do what I need. 9 | 10 | **Chrome Extensions API**: I've used this extension API to get more powerful and fast features inside my extensions, instead of using browser default features, 11 | Chrome developed this api with more fast methods to access browser data and also interchange between anonymous and account in the browser. A lot based on [these docs](https://developer.chrome.com/docs/extensions/mv3/getstarted/) 12 | 13 | ## Looking through each file 14 | 15 | ### Globals and configurations 16 | _global.css_: Inside this file, I've created CSS to reset some browser features and also set a lot of patterns to my project, so every page maintains a consistent visual. 17 | _LICENSE_: This is just a file to tell which license I'm using, MIT by the way. 18 | _manifest.json_: This is a configuration file that follows Google pattern allowing to use of some features and also providing, names, images, and icons to extension. 19 | 20 | ### Options Screen 21 | This screen is created using three files called options with their respective extensions. And is responsible to adjust coins tracked. 22 | 23 | _options.js_: Inside this code, I created a script to make calls to Gecko Api and GET top 250 coins in market cap, so after this user can select which coin he wants to 24 | track. After the user selects the coins, I use Chrome storage to hold all these values persisting also if the browser is closed. Basically, their responsibility is to arrange data. 25 | 26 | __options.html/options.css_: Beyond the file global.css we have a css for each html separately to provide better performance. Inside this, I've organized both a form 27 | and a list to show all data in a customized UI to the final user. 28 | 29 | I had to choose between "options" inside popup or on an external page. To keep extension with a cleaner visual possible I choose to move options to a new tab, based 30 | on two things: 31 | 1 - It's rare for a user that changes their coins a lot. 32 | 2 - After the user sets some coins to track, he can take a long time to remove or add new coins. 33 | 34 | ### Popup Screen 35 | This screen is responsible to show the final user all the coins he is tracking, with real-time data like prices, name, and market float. 36 | 37 | _popup.js_: This file gets all selected coins by the user stored on chrome storage and makes a GET to api for each coin to list her info. This data is loaded every time user clicks 38 | on popup, so when he clicks we always use the last data from api. Also, this script populates the table inside popup with all data provided by api. 39 | 40 | __popup.html/popup.css_: This has the same functionality as options html, here we present the "core" of extension to the final user inside a mini popup attached to 41 | a browser extension icon. 42 | 43 | Inside this pop up I have a lot of data coming from API, so I need to choose carefully which data I want to show on popup. I use the three more important data in my vision 44 | , I also wanted to put exchanges, Github repository of coins, Reddit groups, various market cap variations, but I was concerned that over-complicate the extension. 45 | 46 | ## Final comments 47 | 48 | I provided this extension as an open-source project on my GitHub, so anyone can use this. I also know that we can increment this extension in many ways using Gecko 49 | API, because they provide a lot of endpoints to consume, but by now I take care to develop a centered functional feature. -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture5.md: -------------------------------------------------------------------------------- 1 | # Resume 2 | 3 | ## Data Structures 4 | 5 | Data structure is a way to retain information into your program "memory" and organize that you can access when calculing. Usually data structures try to balance costs to access/manipulate some block of data. 6 | 7 | malloc and array is primarly equal because both allocate chunk of memory 8 | 9 | Array: Good for indexes and fast access position, is a piece ou memory previously allocated and addressed 10 | In Arrays: 11 | 12 | - Insertions is bad - lot of shifting to fit an element in the middle 13 | - Deletion is bad - lot of shifting after removing an element 14 | - Lookup is great - random access, constant time 15 | - Relatively easy to sort 16 | - Relatively small size-wise 17 | - Stuck with a fixed size, no flexibility 18 | 19 | Linked list: Different address of memory linked by their pointer. List give dynamism but you lost index access and some type of searchs. 20 | 21 | Remember to always keep track of the head element of a linked list. It's the only way you can "navigate" into your list. 22 | 23 | Add to the beginning of a list is always easy. You dont need to go n elements until find null pointer 24 | 25 | When you need to destroy a list use a recursion coming to the end from head deleting all nodes. Remember, if you lose head you cannot access other nodes. 26 | 27 | list = null 28 | list -> next -> node 29 | 30 | node -> number = 1 31 | 32 | node -> next = null 33 | 34 | n->number 35 | n->pointer 36 | 37 | There's always a price you pay between space and time in programming, you need to choose accordingly to you problem. 38 | 39 | In Linked Lists: 40 | 41 | - Insertion is easy - just tack onto te front 42 | - Deletion is east - once you find the element 43 | - Lookup is bad - have to rely on linear search 44 | - Relatively difficult to short - unless you're willing to comprmise on super-fast insertion and instead sort as you construct 45 | - Relatively small size-wise (not as small as arrays) 46 | 47 | Tree: In a tree you have a root that is your entry point inyo the list and usually two nodes, left/right, both pointing to smaller/greather values that you can follow in some search for example. 48 | 49 | Some type of structure that you can display a array in a similar bidimensional data structure to access data in a differente way, acessing like pointers into lists. 50 | 51 | Hash table: Is a data structure that combine a linked list and a array inside of it. You need to be cautious about colisions in hash table, it's easy to mess up some data colision and crete unbalanced structure. 52 | 53 | When building hash tables is ideally you don't need the data in some of sorted order 54 | 55 | Hash can have two types of add data approachs, Chaining and Linear Probing. Most of time you use Chaining, but is good to know about another methods. 56 | 57 | In Hash tables: 58 | 59 | - Insertion is a two-steps process - hash, then add 60 | - Deletion is esay - once you find the element 61 | - Lookup is on average better than with linked lists because you have the benefit of a real world constant factor 62 | - Not an ideal data structure if sorting is the goal - just use an array 63 | - Can run the gamut of size 64 | 65 | Tries: Some data structure than sacrifice memory to gain running time, creating a array meshed with a tree linking each value in a root nodes. 66 | 67 | In Tries: 68 | 69 | - Insertion is complex - a lot of dynamic memory allocation, but gets easier as you go 70 | - Deletion is easy - just free a node 71 | - Lookup is fast - not quite fast as an array, but almost 72 | - Already sorted - sort as you build in almost all situations 73 | Rapidly bcomes huge, event with very little data present, not great if space is at a premium 74 | - A tree made by arrays 75 | 76 | Queues: First In, First Out. FIFO. 77 | 78 | Stacks: LIFO. Last in, First out. 79 | 80 | Push is add a element into a structure. Pop is remove a element. 81 | 82 | Dictionarie: Is a abstraction of a hash table. Key and values to map one thing to another. 83 | 84 | Everytime when working with data whe use a key to point where the data is and this data has a value stored. It differ on each type of data are you working 85 | -------------------------------------------------------------------------------- /resumos/livros/clean-code/resumo.md: -------------------------------------------------------------------------------- 1 | # Clean Code 2 | 3 | Ouvi muito sobre este livro e as ideias nele apresentadas, já iniciei a leitura porém irei reiniciar para poder sintetizar as informações com as minhas palavras e reter melhor o conhecimento. 4 | 5 | ## Clean Code 6 | 7 | > Programar é como andar de bicicleta, por mais que você saiba todo o conceito de como funciona, sempre cairá na primeira vez que tentar. 8 | 9 | Todos escrevemos um código ruim por algum motivo e deixamos para arrumar este código depois porque queremos entregar algo no tempo esperado, porém isso é contra intuitivo e não faz sentido a longo prazo, é uma mentira que contamos para nós mesmos. 10 | 11 | Deixar para depois = nunca 12 | 13 | Resolva o que precisa ser resolvido na hora. 14 | 15 | O código mal escrito parece "rápido" no começo do desenvolvimento, pois todos entendem o contexto do que está sendo desenvolvido, porém conforme esta base de código começa a crescer os desenvolvedores começam a entrar em "buraco negro" de implementações falhas que para o projeto quase que por completo. Após muitas versões e horas de desenvolvimento no modo "louco" o código está tão sujo que é quase impossível limpá-lo. 16 | 17 | Intuitivamente o projeto ficando mais devagar a gerência opta pelo obvio, contratar mais pessoas, porém está pode ser uma escolha equivocada pois a nova equipe precisará entender todo o projeto e este projeto já está bagunçado o que faz com que a nova equipe não entenda o que fazer e a equipe atual precise investir tempo explicando o projeto. 18 | 19 | O que todos pensam? Redesign! Esta parece uma decisão correta afinal de contas o sistema atual esta inviável, mas é preciso ter muito cuidado ao escolher este caminho, pois com esta decisão tomada será necessário manter 2 sistemas, o antigo que precisa continuar atendendo as demandas e o novo até que ele possa substituir o antigo. 20 | 21 | Não coloque a culpa da sua falta de profissionalismo em terceiros, você precisa saber o que é certo e o que precisa ser feito, e precisa dizer a verdade mesmo que ela não seja o cenário ideal esperado. Você é o profissional e deve saber as consequências de decisões erradas sendo tomadas a curto prazo. 22 | 23 | Imagine você pedir para um cirurgião não lavar as mãos e não desinfectar os equipamentos para cumprir o prazo, isso não faz sentido, correto? 24 | 25 | As vezes você pode se encontrar em um dilema: 26 | "Preciso fazer um código ruim/rápido para conseguir cumprir o prazo", porém profissionais de longa data sabem que isso é contraintuitivo, justamente esse código mal feito fará com que você não consiga entregar a tempo o que precisa ser feito. 27 | 28 | > Código limpo faz apenas uma coisa e bem feito 29 | 30 | Um código mal feito tende a ficar cada vez pior, a cada vez que uma nova pessoa tenta modificá-lo. Algum similar a teoria da janela quebrada do Programador Pragmático. 31 | 32 | > Código limpo é simples e direto, com um propósito apenas. Focado! 33 | 34 | Faça um código que seja simples de ler e se empenhe enquanto escreve, você tende a ler muito mais do que escrever, então se dedique a ter uma escrita de qualidade para facilitar a sua leitura futura. 35 | 36 | > Toda vez que passar por um código tente deixá-lo mais limpo, por mais que seja simples 37 | 38 | ## Meaningful Names 39 | 40 | Crie nomes consisos e que condizam com o que cada valor ou função está tentando expressar. Evite qualquer tipo de abreviação sem sentido ou nomes que não sejam significativos. 41 | 42 | Exemplo: 43 | 44 | Nomes sem sentido e sem contexto 45 | 46 | ```c 47 | static void copyChars(char a1[], char a2[]) { 48 | for (int i = 0; i < a1.length; i++) 49 | { 50 | a2[i] = a1[i]; 51 | } 52 | } 53 | ``` 54 | 55 | Nomes mais claros que indicam o propósito da função 56 | 57 | ```c 58 | static void copyChars(char source[], char dest[]) { 59 | for (int i = 0; i < source.length; i++) 60 | { 61 | dest[i] = source[i]; 62 | } 63 | } 64 | ``` 65 | 66 | > A diferença entre um programador esperto e um programador profissional é que o profissional entende que clareza é o rei. Programadores profissionais usam suas poderes para bom e escrevem códigos que outros podem entender. 67 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture4.md: -------------------------------------------------------------------------------- 1 | ## Resume 2 | 3 | HEX is a representation of big number in binary with potency 16. 4 | 5 | Hex is a pattern with 1-9...A-F, where F means 15(decimal) 6 | 7 | In hex forget about decimals numbers, are all binary. 8 | 9 | You can find hex by 0x representation like 1 become 0x1, to avoid interpretation errors 10 | 11 | Address of a value inside memory is represented by a pointer 12 | 13 | In C: 14 | & Whats is addressOf 15 | 16 | - Go to addressOf 17 | 18 | ```c 19 | #include 20 | 21 | int main(void) 22 | { 23 | int n = 50; 24 | int *pointerx = &n; 25 | printf("%i\n", *pointerx); 26 | } 27 | ``` 28 | 29 | Strings are just a pointer to the first character in memory until null(\0) 30 | 31 | ```c 32 | #include 33 | 34 | int main(void) 35 | { 36 | char *s = "EMMA"; 37 | // Is the same pointer! 38 | printf("%p\n", s); 39 | printf("%p\n", &s[0]); 40 | } 41 | ``` 42 | 43 | [] are just syntax sugar to pointer + value in brackets to access the next space in memory 44 | 45 | ```c 46 | #include 47 | 48 | int main(void) 49 | { 50 | char *s = "EMMA"; 51 | // [] lier! 52 | printf("%c\n", *s); 53 | printf("%c\n", *(s+1)); 54 | printf("%c\n", *(s+2)); 55 | printf("%c\n", *(s+3)); 56 | } 57 | ``` 58 | 59 | malloc are used to memory allocate, when you need some "space" in memory to store some value. 60 | 61 | ```c 62 | //Example of a copy program 63 | 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | 70 | int main(void) 71 | { 72 | char *s = get_string("s:"); 73 | 74 | char *t = malloc(strlen(s) + 1); 75 | 76 | for(int i = 0, n = strlen(s); i < n + 1; i++) 77 | { 78 | t[i] = s[i]; 79 | } 80 | 81 | t[0] = toupper(t[0]); 82 | 83 | printf("%s\n", s); 84 | printf("%s\n", t); 85 | } 86 | ``` 87 | 88 | Strings can be called like char \*varname 89 | 90 | Malloc literaly alloc a address in memory, a pointer 91 | 92 | > Remember to "free" memory when are you not using that 93 | 94 | valgrind in IDE can catch leak memory 95 | 96 | Temp variables for replaces 97 | 98 | Heap and Stack overflow is a colide in memory. 99 | 100 | HEAP -------> <------- STACK 101 | 102 | You can write files in C using FILE, fprintf, fclose 103 | 104 | ## Hexadecimal numbers 105 | 106 | A more concise way to express binary numbers. Just think, it's too hard to write code in binary, a big chain is hard to read. 107 | 108 | Each decimal digit correponds into a unique arragement of 4 binary digits 109 | 110 | Decimal first numbers are undistinguish from hexadecimal first number, because that hex number are represented with "x" 111 | 112 | | Decimal | Binary | Hexadecimal | 113 | | ------- | ------ | ----------- | 114 | | 0 | 0000 | 0x0 | 115 | | 1 | 0001 | 0x1 | 116 | | 2 | 0010 | 0x2 | 117 | | 3 | 0011 | 0x3 | 118 | | 4 | 0100 | 0x4 | 119 | | 5 | 0101 | 0x5 | 120 | | 6 | 0110 | 0x6 | 121 | 122 | ## Pointers 123 | 124 | Provides an alternative way to pass data between functions 125 | 126 | Pointers points to a address in memory to access an value 127 | 128 | Pointers address to location in memory. 129 | 130 | Sometimes pointers can be null, pointing to nothing. 131 | 132 | Pointers in C can be extracted from a existing variable using the & operator, this take address and pass to you. 133 | 134 | Be cautious when passing values between pointers, it's really easy to mess some value. 135 | 136 | ## Dynamic Memory Allocation 137 | 138 | DMA comes from a pool in heap and give you access to some space in memory with pointers. 139 | 140 | In C malloc can give you a pointer to some memory space you want. Remember to free() memory when using malloc 141 | 142 | ## Call stacks 143 | 144 | When you call something the system give you some spaces in stack that you can work with. One function wait for another to do your job. 145 | 146 | ## File Pointers 147 | 148 | C provides a way to write and read data from files using a data structure named FILE 149 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/fiftyville/log.sql: -------------------------------------------------------------------------------- 1 | -- Keep a log of any SQL queries you execute as you solve the mystery. 2 | 3 | -- Who the thief is? 4 | -- Where the thief escaped to? 5 | -- Who the thief's accompliance was, who helped him to escape the town? 6 | 7 | -- What I know: Theft took place on July 28 and Theft took place on Chamberlin Street 8 | 9 | -- Maintain a list of suspects 10 | 11 | /* 12 | Theft occur at 10:15am 13 | 14 | Suspect license plates: 15 | 5P2BI95 16 | 94KL13X 17 | 6P58WS2 18 | 4328GD8 19 | G412CB7 20 | L93JTIZ 21 | 322W7JE 22 | 0NTHK55 23 | 24 | Interviews: Eugene - Raymond - Ruth 25 | 26 | ATM Numbers and values: 27 | ammount | account 28 | 48 | 28500762 29 | 20 | 28296815 30 | 60 | 76054385 31 | 50 | 49610011 32 | 80 | 16153065 33 | 20 | 25506511 34 | 30 | 81061156 35 | 35 | 26013199 36 | 37 | Callers: 38 | 39 | caller | receiver | duration 40 | (130) 555-0289 | (996) 555-8899 | 51 41 | (499) 555-9472 | (892) 555-8872 | 36 42 | (367) 555-5533 | (375) 555-8161 | 45 43 | (499) 555-9472 | (717) 555-1342 | 50 44 | (286) 555-6063 | (676) 555-6554 | 43 45 | (770) 555-1861 | (725) 555-3243 | 49 46 | (031) 555-6622 | (910) 555-3251 | 38 47 | (826) 555-1652 | (066) 555-9701 | 55 48 | (338) 555-6650 | (704) 555-2131 | 54 49 | 50 | Doris | (066) 555-9701 | M51FA04 51 | Roger | (130) 555-0289 | G412CB7 - Thief 52 | Ernest | (367) 555-5533 | 94KL13X - Thief 53 | Evelyn | (499) 555-9472 | 0NTHK55 - Thief 54 | Danielle | (389) 555-5198 | 4328GD8 - Thief 55 | 56 | Ernest | (367) 555-5533 | 94KL13X | 49610011 - SACOU 50 - Thief 57 | Bobby | (826) 555-1652 | 30G67EN | 28296815 - sacou 20 58 | 59 | Ernest | (367) 555-5533 | 94KL13X | 49610011 - SACOU 50 - Thief 60 | Berthold | (375) 555-8161 | 4V16VO0 - ACCOMPLICE 61 | 62 | Doris | (066) 555-9701 | M51FA04 63 | 64 | Danielle | (389) 555-5198 | 4328GD8 | 28500762 - sacou 48 65 | Madison | (286) 555-6063 | 1106N58 | 76054385 66 | 67 | Flight 68 | 69 | 37 | Fiftyville Regional Airport | 7 | 37 70 | 71 | I can compare amount withdrawed with airport ticket price 72 | 73 | */ 74 | 75 | -- Get first information following first tips 76 | SELECT description FROM crime_scene_reports WHERE day = 28 AND month = 7 AND street = "Chamberlin Street"; 77 | 78 | -- Look into interviews from tribunal mention in desired day/month 79 | SELECT name, transcript FROM interviews WHERE transcript LIKE "%courthouse%" AND day = 28 AND month = 7; 80 | 81 | -- Based on interview Ruth courthouse parking ten minutes of the theft (10:25) 82 | SELECT license_plate FROM courthouse_security_logs WHERE day = 28 AND month = 7 AND hour = 10 AND minute > 10 AND minute < 30 AND activity = "exit"; 83 | 84 | -- Based on interview Eugene ATM on Fifer Street before 10:15 85 | SELECT amount, account_number FROM atm_transactions WHERE day = 28 AND month = 7 AND transaction_type = "withdraw" AND atm_location = "Fifer Street"; 86 | 87 | -- Based on interview Raymond call less than 1 minute after 10:15 88 | 89 | SELECT caller, receiver, duration FROM phone_calls WHERE day = 28 AND month = 7 AND duration < 60; 90 | 91 | -- Based on interview Raymond earliest flight out of Fiftyville tomorrow (29/7) 92 | 93 | SELECT flights.id, airports.full_name, flights.hour, flights.minute FROM airports JOIN flights ON origin_airport_id = airports.id WHERE flights.day = 29 AND flights.month = 7 AND airports.city = "Fiftyville" ORDER BY flights.hour, flights.minute ASC LIMIT 1; 94 | 95 | -- Get all passengers from flight 36 96 | SELECT * FROM passengers WHERE flight_id = 36; 97 | 98 | -- Escape Flight To 99 | 100 | SELECT airports.city FROM airports JOIN flights ON flights.id = 36 WHERE airports.id = flights.destination_airport_id; 101 | 102 | -- Get info from all passenger in that flight 103 | SELECT people.name, people.phone_number, people.license_plate, bank_accounts.account_number FROM people JOIN bank_accounts ON bank_accounts.person_id = people.id JOIN passengers ON passengers.passport_number = people.passport_number WHERE flight_id = 36; 104 | 105 | -- Found receiver caller from suspects 106 | SELECT people.name, people.phone_number, people.license_plate FROM people WHERE people.phone_number = "(375) 555-8161" OR people.phone_number = "(066) 555-9701"; 107 | 108 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/substitution/substitution.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int validateKey(string key); 7 | string makeCiphertext(string plainText, string key); 8 | 9 | int main(int argc, string argv[]) 10 | { 11 | // Check if user input too less or too many arguments in command line 12 | if (argc < 2 || argc > 2) 13 | { 14 | printf("Usage: ./substitution key \n"); 15 | return 1; 16 | } 17 | 18 | string key = argv[1]; 19 | // Store a isValid return for key 20 | int isValid = validateKey(key); 21 | 22 | // If key pass in all tests then get plaintext and encipher the text 23 | if (isValid == 0) 24 | { 25 | string plainText = get_string("plaintext:"); 26 | string enchiper = makeCiphertext(plainText, key); 27 | printf("ciphertext: %s\n", enchiper); 28 | } 29 | else 30 | { 31 | return 1; 32 | } 33 | } 34 | 35 | string makeCiphertext(string plainText, string key) 36 | { 37 | // Get length to use in compare and instance array 38 | long int lenght = strlen(plainText); 39 | 40 | // +1 is for \0 value in the end, this tell to memory it is a string 41 | char cipher[lenght + 1]; 42 | 43 | // Append \0 value in last position of array 44 | cipher[-1] = '\0'; 45 | 46 | for (int i = 0; i <= lenght; i++) 47 | { 48 | for (int j = 65; j <= 90; j++) 49 | { 50 | // If is a letter in current position based on ASCII value converting to uppercase, because plaintext can have numbers, spaces and sinals 51 | if (toupper(plainText[i]) >= 65 && toupper(plainText[i]) <= 90) 52 | { 53 | // Check if current letter in plaintext is equal the letter in alphabet I have your position 54 | if (toupper(plainText[i]) == j) 55 | { 56 | //If is upper store letter in uppercase 57 | if (isupper(plainText[i])) 58 | { 59 | // The position of letter is j - 65 (start value), then I refer the key value to cipher array 60 | cipher[i] = toupper(key[j - 65]); 61 | } 62 | // Else store letter in lower case 63 | else 64 | { 65 | cipher[i] = tolower(key[j - 65]); 66 | } 67 | } 68 | } 69 | // If is number or anything not letter just store the value 70 | else 71 | { 72 | cipher[i] = plainText[i]; 73 | } 74 | 75 | } 76 | } 77 | string result = cipher; 78 | return result; 79 | } 80 | 81 | int validateKey(string key) 82 | { 83 | 84 | //Check if has 26 characters 85 | long int lenght = strlen(key); 86 | if (lenght < 26 || lenght > 26) 87 | { 88 | printf("Key must contain 26 characters. \n"); 89 | return 1; 90 | } 91 | else 92 | { 93 | //Check if all characters are letters 94 | int count = 0; 95 | while (count < strlen(key)) 96 | { 97 | 98 | //Check blank space/tab key 99 | if (isblank(key[count])) 100 | { 101 | printf("Usage: ./substitution key \n"); 102 | return 1; 103 | } 104 | 105 | if (!isalpha(key[count])) 106 | { 107 | printf("Key accept only letters \n"); 108 | return 1; 109 | } 110 | count++; 111 | } 112 | 113 | // Check if any character is repeated 114 | 115 | for (int i = 0; i < lenght; i++) 116 | { 117 | for (int j = i + 1; j < lenght; j++) 118 | { 119 | if (toupper(key[i]) == toupper(key[j])) 120 | { 121 | printf("Repeated value in key \n"); 122 | return 1; 123 | } 124 | } 125 | } 126 | } 127 | 128 | return 0; 129 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/credit/credit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* 6 | 1 - Prompt number with get_long: OK 7 | 2 - Count number in user input: OK 8 | 3 - Valid card number with < 13 items or > 16 items: OK 9 | 4 - Validate based on two first numbers: 10 | */ 11 | 12 | int validateCard(long cardNumber); 13 | 14 | int main(void) 15 | { 16 | long cardNumber; 17 | cardNumber = get_long("Digit your credit card number:"); 18 | validateCard(cardNumber); 19 | } 20 | 21 | int checkNumberLength(long number) 22 | { 23 | int count = 0; 24 | long holder = number; 25 | 26 | while (holder != 0) 27 | { 28 | holder = holder / 10; 29 | count++; 30 | } 31 | return count; 32 | } 33 | 34 | int checkFirstTwoDigits(long number) 35 | { 36 | while (number >= 100) 37 | { 38 | number /= 10; 39 | } 40 | 41 | return number; 42 | } 43 | 44 | string checkCardFlag(long cardNumber) 45 | { 46 | 47 | int length = checkNumberLength(cardNumber); 48 | int firstDigits = checkFirstTwoDigits(cardNumber); 49 | // Validate cards based on length and first numbers 50 | if (length < 13 || length > 16) 51 | { 52 | return ("INVALID\n"); 53 | } 54 | 55 | if (length == 15) 56 | { 57 | if (firstDigits == 37 || firstDigits == 34) 58 | { 59 | return ("AMEX\n"); 60 | } 61 | return ("INVALID\n"); 62 | } 63 | 64 | if (length == 16 && firstDigits > 50) 65 | { 66 | if (firstDigits > 50 && firstDigits <= 55) 67 | { 68 | return ("MASTERCARD\n"); 69 | } 70 | return ("INVALID\n"); 71 | } 72 | 73 | if (length == 13 || length == 16) 74 | { 75 | if (firstDigits >= 40 && firstDigits <= 49) 76 | { 77 | return ("VISA\n"); 78 | } 79 | return ("INVALID\n"); 80 | } 81 | 82 | return ("INVALID\n"); 83 | } 84 | 85 | bool validateCardNumber(long cardNumber) 86 | { 87 | // I check the length of card number, then I can use "length" for operations 88 | int length = checkNumberLength(cardNumber); 89 | 90 | // Declare an array based on card number length 91 | int arrayNumbers[length]; 92 | int count = 0; 93 | 94 | // Split card numbers and add each number in one position of array (back to front 123 became [3,2,1]) 95 | while (cardNumber) 96 | { 97 | arrayNumbers[count] = cardNumber % 10; 98 | count++; 99 | cardNumber /= 10; 100 | } 101 | 102 | // Store interations 103 | int countOdd = 0; 104 | int countEven = 0; 105 | 106 | // Sum for validation 107 | int sumOdds = 0; 108 | int sumEvens = 0; 109 | 110 | // Iterate over arrayNumbers 111 | for (int i = 0; i <= length - 1; i++) 112 | { 113 | if (i % 2 == 0) 114 | { 115 | sumEvens += arrayNumbers[i]; 116 | countEven++; 117 | } 118 | else 119 | { 120 | // Split one number in two, example: 10 become 1 0 121 | if (arrayNumbers[i] * 2 >= 10) 122 | { 123 | // Catch last number 124 | sumOdds += (arrayNumbers[i] * 2) % 10; 125 | // Catch first number 126 | sumOdds += (arrayNumbers[i] * 2 / 10) % 10; 127 | } 128 | else 129 | { 130 | sumOdds += arrayNumbers[i] * 2; 131 | } 132 | countOdd++; 133 | } 134 | } 135 | 136 | int sumEvenWithOdd = sumOdds + sumEvens; 137 | 138 | // If the total’s last digit is 0 the number is valid! 139 | if (sumEvenWithOdd % 10 == 0) 140 | { 141 | return (true); 142 | } 143 | else 144 | { 145 | return (false); 146 | } 147 | 148 | return (false); 149 | } 150 | 151 | int validateCard(long cardNumber) 152 | { 153 | string cardFlag = checkCardFlag(cardNumber); 154 | 155 | if (!validateCardNumber(cardNumber)) 156 | { 157 | printf("INVALID\n"); 158 | } 159 | else 160 | { 161 | printf("%s", cardFlag); 162 | } 163 | return 0; 164 | } -------------------------------------------------------------------------------- /resumos/livros/the-pragmatic-programmer/resumo-the-pragmatic-programmer.md: -------------------------------------------------------------------------------- 1 | # The Pragmatic Programmer 2 | 3 | ## Porque escolhi este livro? 4 | Inicialmente devido a diversas recomendações de profissionais da área, sempre indicando e falando muito bem do conteúdo abordado. Outro ponto que me deixou muito curioso foi a questão de que este livro não é sobre uma linguagem X e como utilizar esta linguagem, itens que normalmente uma documentação online resolve muito bem (reconheço o valor de livros técnicos), mas o grande foco neste material é abordar uma forma de programar e de visualizar projetos/problemas como um todo, desde processos de identificação, análise, equipe, comunicação até o código e padrões de desenvolvimento, o que me parece um cinto de utilidades excelente. Como dito no prefácio: "This book is aimed at people who want to become more effective and more productive programmers.", resumidante virar um mestre da programação. 5 | 6 | ## Para que este repositório/post? 7 | 8 | Estou lendo a versão em inglês, para pegar o conhecimento direto da fonte. Farei os resumos em português para que possa ajudar preferencialmente quem está iniciando. Eu gostaria de ter um conteúdo assim então vou criá-lo. O que colocarei aqui são lembretes, exercícios e minha compreensão de cada capítulo para que eu possa fixar o conhecimento. Se ajudar alguém legal 👍 9 | 10 | Existem algumas dicas no livro que pretendo manter na tradução mais próxima do apresentado pelos autores, listarei elas no formato de citação: 11 | 12 | > Dica x: Hello World 13 | 14 | ## A filosofia de programador pragmático é resumida em 5 princípios: 15 | 16 | - *Descobridor / Adaptável*: Possui um instinto para novas tecnologias e técnicas, busca sempre testar algo novo que descobre. Quando descobre algo novo consegue se adaptar rapidamente e mesclar ao resto do conhecimento que possui. Sua confiança é criada com experiência. 17 | - *Curioso*: Faz perguntas com muita frequência. Isso é legal -- Como você fez isso? Você já teve problemas com essa biblioteca? O que é este BeOS que comentaram? Como links simbólicos são implementados? Você busca por pequenos fatos e conhecimentos que podem ser úteis futuramente. 18 | - *Pensador crítico*: Raramente aceita as coisas sem entender os fatos e porquês. Quando um colega diz "porque é assim que deve ser feito", sem nenhuma explicação ou um vendedor promete a solução para todos os seus problemas, você identifica um desafio e tenta entender o porquê. 19 | - *Realista*: Tenta entender toda a natureza dos problemas que enfrenta. Esse realismo lhe fornece um bom entendimento de quão difíceis as coisas são e quanto tempo podem demorar. Entender por você mesmo que um processo pode ser díficil e demorar para ser finalizado lhe dá a confiança e vontade de se manter no desafio. Você conhece seu "inimigo" e consegue imaginar o quanto precisa para vencê-lo. 20 | - *Jack of all trades (pau para toda obra)*: Se dedica ao máximo para entender diversas tecnologias e formas de trabalhar para se manter atualizado, nunca fica estagnado. Talvez o seu emprego atual exija que você foque em uma linguagem apenas, mas nada lhe impede de estudar e mudar de área ou encontrar novos desafios. 21 | 22 | > Dica 1: Preocupe-se com o que você faz 23 | 24 | > Dica 2: Pense! Sobre o trabalho que você executa 25 | 26 | ### 1 - O gato comeu meu código 27 | 28 | - Responsabilidade. 29 | 30 | Seja uma pessoa responsável sobre tudo que você faz, certo ou errado. Devemos ser resposáveis em todos os aspectos, desenvolvimento de testes, boas práticas, código bem produzido, mas além disso assumirmos nossa ignorância em diversos assuntos, erros cometidos e dificuldades enfrentadas. 31 | 32 | Evite dar desculpas. Caso tenha feito algo errado (todos erramos), admita honestamente e tente dar opções de solução. Tentar criar desculpas ou esconder o problema será pior para todo mundo. 33 | 34 | A responsabilidade se extende em ações com terceiros e com você mesmo. Se seu HD parar de funcionar e você perder todo o código de seu sistema é responsabilidade sua. Por que você não tinha isso em repositórios online? Talvez um backup em outro HD? Esteja a frente de tudo que ocorrer. 35 | 36 | Creio que além da programação essa pode ser uma dica para a vida. Seja responsável por suas ações, tudo que acontece no seu dia-a-dia é responsabilidade totalmente sua e de mais ninguém. 37 | 38 | > Dica 3: Ofereça soluções, não dê desculpas esfarrapadas. 39 | 40 | #### Exercício 1.Cap1: 41 | - Como você se sente quando um mecânico, gerente de banco ou balconista vem até você com uma desculpa descarada? O que você pensa sobre ele e a empresa em que ele trabalha? 42 | 43 | **Observação** 44 | Se viu algo errado, pode melhorar algum conceito ou deseja me mostrar outra forma de compreensão abre uma [issue](/issues) ou da um commit com a correção. Será muito bem vindo. -------------------------------------------------------------------------------- /resumos/cursos/cs50/lecture8.md: -------------------------------------------------------------------------------- 1 | # Resume 2 | 3 | ## HTML, CSS, JavaScript 4 | 5 | Internet is network of networks 6 | 7 | Simple explanation: 8 | Internet -> Routers -> Computer 9 | 10 | Internet data can take many "paths" to find the server 11 | 12 | Protocol = convention 13 | 14 | TCP/IP = Protocol to get data from point A to B 15 | 16 | Packets are like a envelope to send information from a computer to another 17 | 18 | Package(Build Data Create Packages) -> Router(Resolve DNS, IP...) -> Server (Read TCP, HTTP...) 19 | 20 | TCP Allows server to do multiple things based on ports 21 | 22 | IP = Internet Protocol 23 | 24 | DNS = Domain Name System (Convert names to IP) 25 | 26 | ISP = Internet Service Provider 27 | 28 | TCP = Transfer Control Protocol 29 | 30 | PORT = Wich Port each service can use 31 | 32 | HTTP = Hyper Text Transfer Protocol (GET, POST...) 33 | 34 | URL = Uniform Resource Locator 35 | 36 | TCP is outside of "envelop" and HTTP it's own content. TCP define addresses and where envelope needs to go, HTTP is thei information. 37 | 38 | DOM is a Tree structure interpreted by browsers. 39 | 40 | HTML are absed with open/close tags with many responsabilites. 41 | 42 | CSS is a Cascading Style Sheets is used to style your page using properties 43 | 44 | JavaScript allow page to be more flexible. And allow you to run code on client computer. 45 | 46 | With JavaScript we have a programming language that allows us to change DOM Tree 47 | 48 | ## Extra Class 49 | 50 | ### Internet Primer 51 | 52 | Internet works like a big chunks of cable connecting peoples 53 | 54 | IP is a unical address provided for each device, actually world is changing to IPV6 that is a 8 cluster in hexadecimal that give a number for a device. 55 | 56 | DHCP server gives you a unique IP address comming from internet 57 | 58 | DNS translate IPs to readable words for humans, so that humans can use it. DNS holders administrate a bunch of DNS like a library of yellow pages. 59 | 60 | Access points, instead of each device has a IP, how hold my IP is a router (access point), that manage this IP for me. Usually today home networks consists of access points that combine a router, a modem, a switch, and other technologis together into a single device. 61 | 62 | ### IP 63 | 64 | The Internet Protocol has the responsibility to know how to communicate with each device in that interconnected network. 65 | 66 | Connections are handled by routers to reduce cost, each router sends your connection to another router until you get the point you want. 67 | 68 | IP is responsible to get information from point A to point B and breaking this information into small to send small packages via the internet. 69 | 70 | 71 | ### TCP 72 | 73 | Transmition Control Protocol direct all the packets to right place in the receiving machine. It is important to be able to identify both where the receiver is and what the packet is for, so TCP and IP are almost inseparable TCP/IP. 74 | 75 | TCP organize to each port package needs to go and which order theses packets need to be read, also counts how many packets this data has. 76 | 77 | ### HTTP 78 | 79 | Is a protocol to interpret data coming from a network, called application layer protocol, this protocol dictate the format that is requested by client and return information 80 | 81 | It's like a human interaction, ou aks for something and get a answer back 82 | 83 | HTTP usually return data and a status code for you to know 84 | 85 | ### HTML 86 | 87 | Translate to the browser some words to be interpreted in another way. Used to organize elements into the web page. 88 | 89 | ### CSS 90 | 91 | Used to stylize elements into a web page. 92 | 93 | ### JavaScript 94 | 95 | Is derived from C syntax 96 | 97 | JavaScript runs client side 98 | 99 | JavaScript are used to add interaction into webpages 100 | 101 | ```js 102 | let variable = "This is a variable" 103 | const variableToo = "This is a variable too" 104 | 105 | function newFunc(){ 106 | 107 | } 108 | 109 | const example = { 110 | name: "Object" 111 | } 112 | 113 | const usefullObecjt = { 114 | sayHi: (x) => console.log("Hiii", x) 115 | } 116 | 117 | const week = ["segunda", "terça", "quarta"] 118 | 119 | usefullObecjt.sayHi("DAvid") 120 | 121 | //Show indices 122 | for(let day in week){ 123 | console.log(day) 124 | } 125 | 126 | //Show values 127 | for(let day of week){ 128 | console.log(day) 129 | } 130 | ``` 131 | ### DOM 132 | 133 | Document Object Model, this obejct organizes the entire contents of a web page. By organizing an entire page into a JavaScript object, we can manipulate the page's elements programmatically. 134 | 135 | 136 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/filter/filter-less.c: -------------------------------------------------------------------------------- 1 | #include "helpers.h" 2 | #include 3 | 4 | // Convert image to grayscale 5 | void grayscale(int height, int width, RGBTRIPLE image[height][width]) 6 | { 7 | //normalize values into a grayscale, calculate the average of that values 8 | for (int i = 0; i < height; i++) 9 | { 10 | for (int j = 0; j < width; j++) 11 | { 12 | int averageColor = round((image[i][j].rgbtRed + image[i][j].rgbtBlue + image[i][j].rgbtGreen) / 3.0); 13 | image[i][j].rgbtRed = averageColor; 14 | image[i][j].rgbtBlue = averageColor; 15 | image[i][j].rgbtGreen = averageColor; 16 | } 17 | } 18 | return; 19 | } 20 | 21 | // Convert image to sepia 22 | void sepia(int height, int width, RGBTRIPLE image[height][width]) 23 | { 24 | for (int i = 0; i < height; i++) 25 | { 26 | for (int j = 0; j < width; j++) 27 | { 28 | 29 | int originalRed = image[i][j].rgbtRed; 30 | int originalBlue = image[i][j].rgbtBlue; 31 | int originalGreen = image[i][j].rgbtGreen; 32 | 33 | int sepiaRed = round(.393 * originalRed + .769 * originalGreen + .189 * originalBlue); 34 | int sepiaGreen = round(.349 * originalRed + .686 * originalGreen + .168 * originalBlue); 35 | int sepiaBlue = round(.272 * originalRed + .534 * originalGreen + .131 * originalBlue); 36 | 37 | if (sepiaRed > 255) 38 | { 39 | sepiaRed = 255; 40 | } 41 | if (sepiaGreen > 255) 42 | { 43 | sepiaGreen = 255; 44 | } 45 | if (sepiaBlue > 255) 46 | { 47 | sepiaBlue = 255; 48 | } 49 | 50 | image[i][j].rgbtRed = sepiaRed; 51 | image[i][j].rgbtBlue = sepiaBlue; 52 | image[i][j].rgbtGreen = sepiaGreen; 53 | } 54 | } 55 | return; 56 | } 57 | 58 | // Reflect image horizontally 59 | void reflect(int height, int width, RGBTRIPLE image[height][width]) 60 | { 61 | //take individuals pixels and replace the position to oposite 62 | RGBTRIPLE holdImage[height][width]; 63 | for (int i = 0; i < height; i++) 64 | { 65 | for (int j = 0; j < width; j++) 66 | { 67 | holdImage[i][j] = image[i][(width - 1) - j]; 68 | } 69 | } 70 | 71 | for (int i = 0; i < height; i++) 72 | { 73 | for (int j = 0; j < width; j++) 74 | { 75 | image[i][j] = holdImage[i][j]; 76 | } 77 | } 78 | return; 79 | } 80 | 81 | // Blur image 82 | void blur(int height, int width, RGBTRIPLE image[height][width]) 83 | { 84 | //take and image and blur creating blur effect 85 | // Blur = sum all corners / number of corners 86 | // if height = 0 || height = height - 1 || width = 0 || width = width - 1 we got corners 87 | // topLeft = [0][0] 88 | // topRight = [0][width - 1] 89 | // bottomLeft = [height - 0][0] 90 | // bottomRight = [height - 1][width - 1] 91 | RGBTRIPLE holdImage[height][width]; 92 | 93 | // ROW 94 | for (int row = 0; row < height; row++) 95 | { 96 | // COLUMN 97 | for (int column = 0; column < width; column++) 98 | { 99 | 100 | int counter = 0; //Count neighbours 101 | float sumColorRed = 0; 102 | float sumColorGreen = 0; 103 | float sumColorBlue = 0; 104 | 105 | int mapRow[] = {row - 1, row, row + 1}; 106 | int mapColumn[] = {column - 1, column, column + 1}; 107 | 108 | for (int x = 0; x < 3; x++) 109 | { 110 | for (int y = 0; y < 3; y++) 111 | { 112 | int columnIndex = mapRow[x]; 113 | int rowIndex = mapColumn[y]; 114 | 115 | if (columnIndex >= 0 && columnIndex < width && rowIndex >= 0 && rowIndex < height) 116 | { 117 | RGBTRIPLE actualPixel = image[columnIndex][rowIndex]; 118 | sumColorRed += actualPixel.rgbtRed; 119 | sumColorGreen += actualPixel.rgbtGreen; 120 | sumColorBlue += actualPixel.rgbtBlue; 121 | counter++; 122 | } 123 | } 124 | } 125 | 126 | holdImage[row][column].rgbtRed = round(sumColorRed / counter); 127 | holdImage[row][column].rgbtGreen = round(sumColorGreen / counter); 128 | holdImage[row][column].rgbtBlue = round(sumColorBlue / counter); 129 | } 130 | } 131 | 132 | for (int i = 0; i < height; i++) 133 | { 134 | for (int j = 0; j < width; j++) 135 | { 136 | image[i][j] = holdImage[i][j]; 137 | } 138 | } 139 | return; 140 | } -------------------------------------------------------------------------------- /resumos/livros/getting-real/resumo-getting-real.md: -------------------------------------------------------------------------------- 1 | # Getting Real Summary 2 | 3 | ## A maneira mais rápida, fácil e esperta de escrever softwares de sucesso 4 | 5 | Resumo e entendimento do livro para que eu (ou alguém) possa consultar. 6 | 7 | Versão em inglês do livro: [Download](https://basecamp.com/books/getting-real) 8 | 9 | Versão em português do livro:[Download](./book/Caindo-na-Real.pdf) 10 | 11 | A ideia do livro em geral é trazer a tona novas formas de pensar durante o desenvolvimento de um software, passando por planejamento, testes, ideias, bugs, erros, investidores... Quebrando alguns paradigmas e tradições do mercado e introduzindo conceitos para lhe guiar durante a criação de seu software milionário 🤑. Construa e lance, rápido! 12 | 13 | O "mantra" mais citado no livro é "lance rápido!" e isso quer dizer que você precisa parar de polir seu software pefeito para algo que talvez nem exista. Lance e deixe que os usuários digam o que querem e como querem. Obviamente você não irá lançar um software mal feito e muito menos adicionar tudo que os usuários pedirem, mas esse ponto serve para você iniciar logo e experimentar. 14 | 15 | Durante o livro o autor cita diversos posts (muitos offline :c) e indicações de livros que deixarei linkados no fim deste artigo: 16 | 17 | ## Linha de largada 18 | 19 | Desenvolva softwares que resolvam algum problema no seu cotidiano, comece simples e vá evoluindo. Talvez 1 pessoa ou 10 tenham o mesmo problema e você possa ajudá-los e quem sabe 10.000 pessoas tenham o mesmo problema que você achou que era apenas seu. Assim nascem as "ideias do milênio", soluções para problemas diários. 20 | 21 | Faça um software menor que todos os do mercado, comece com menos funcionalidades mas faça-as de maneira excelente. Assim você terá um software conciso e robusto atendendo exatamente o que você precisa. Deixe de lado a ideia de antigos softwares que parecem cabines de avião cheios de funções e botões que na maioria das vezes nem são utilizados. 22 | 23 | Inicialmente evite ao máximo captar dinheiro de terceiros, isso irá gerar uma responsabilidade grande, aumentar as burocracias e diluir o fluxo de desenvolvimento. Se o seu software conseguir "se pagar" então você está no caminho certo, caso contrário... O dinheiro injetado irá esconder essa visão. Você poderá recomeçar sem a pressão dos investidores. 24 | 25 | Foque em entregar seu software dentro do prazo e orçamento combinado, caso analise que algo precisa ser ajustado, ajuste, mas nunca altere o prazo e orçamento. Esses limites irão cortar os itens "supérfluos" por hora em seu sistema. Restrições e limites vão forçar você a pensar e encontrar maneiras criativas de resolver seus problemas e desafios. 26 | 27 | Caso o software que tenha escolhido desenvolver resolva um problema de seu cotidiano encontre nele uma "paixão" para que desenvolva ele com um motivo além do dinheiro. Se a sua aplicação não o excita, algo está errado. As pessoas irão perceber isso em sua versão final. 28 | 29 | ## Permaneça Enxuto 30 | 31 | Mantenha-se pequeno o máximo de tempo que puder. Equipes menores resultam em simplicidade, fácil adaptação, mudanças rápidas, comunicação concisa, soluções instatâneas. Mover um objeto com massa grande da muito mas trabalho do que mover um objeto com massa pequena. Então se precisar mudar algo em seu projeto ou ajustar a direção de seu negócio será muito mais fácil com uma equipe enxuta. 32 | 33 | A mudança é onde pequenas equipes se diferenciam de grandes corporações, utilize essa vantagem ao seu favor. Adicionar um novo recurso com uma equipe pequena pode pode levar 1 dia, enquanto em uma grande corporação a mesma funcionalidade pode levar meses para ser implementada. 34 | 35 | Uma outra vantagem muito boa de equipes pequenas é a proximidade que você consegue ter com o seu usuário, pode tratá-los como se fossem amigos (e são) enquanto evolui o software para eles. 36 | 37 | ## Prioridades 38 | 39 | Defina e faça os pontos importantes de sua aplicação, detalhes são importantes mas no começo aquele botão pixel perfect não será o divisor de águas de seu sucesso. O sucesso pode estar nos detalhes, mas além do sucesso você encontrará reuniões, desacordos, atrasos e neste momento inicial o ideal é evitá-los. Há tempo suficiente para ser perfeccionista, apenas faça isso mais tarde. 40 | 41 | Outro ponto que muitos acabam se prendendo no começo é com problemas que ainda não tem. Realmente é a hora de pensar como sustentar um servidor com 10.000 usuários simultâneos? Precisa realmente de uma equipe com 12 programadores? Deixe esses problemas para quando eles forem reais e talvez eles nem se tornem realidade. Apenas faça. 42 | 43 | Encontre seu nicho de mercado e foque nele, se tentar agradar todo mundo não irá agradar ninguém. 44 | 45 | E por fim faça o seu software ter opinião, coloque e tire funcionalidades com determinação e princípios, assim você mantém uma constância e não tende a fazer qualquer coisa que lhe pedem. Aprenda a dizer "não", e caso algo seja solicitado várias vezes analise. 46 | 47 | ## Seleção de funcionalidades 48 | Continua... 49 | 50 | ### Livros citados pelo autor: 51 | The Pragmatic Programmer -------------------------------------------------------------------------------- /resumos/posts/good-code-checklist.md: -------------------------------------------------------------------------------- 1 | ## Interview Cheat Sheet 2 | 3 | From Andrei Neagoie's Master The Coding Interview: Data Structures + Algorithms 4 | The 3 pillars of good code: 5 | 6 | **📖 1. Readable** 7 | **🕒 2. Time Complexity** 8 | **🚀 3. Space Complexity** 9 | 10 | ### What skills interviewer is looking for: 11 | 12 | Analytic Skills - How can you think through problems and analyze things? 13 | Coding Skills - Do you code well, by writing clean, simple, organized, readable code? 14 | Technical knowledge - Do you know the fundamentals of the job you're applying for? 15 | Communication skills: Does your personality match the companies’ culture? 16 | Step By Step through a problem: 17 | 18 | 1. When the interviewer says the question, write down the key points at the top (i.e. sorted 19 | array). Make sure you have all the details. Show how organized you are. 20 | 21 | 2. Make sure you double check: What are the inputs? What are the outputs? 22 | 23 | 3. What is the most important value of the problem? Do you have time, and space and memory, 24 | etc.. What is the main goal? 25 | 26 | 4. Don't be annoying and ask too many questions. 27 | 28 | 5. Start with the naive/brute force approach. First thing that comes into mind. It shows that 29 | you’re able to think well and critically (you don't need to write this code, just speak about it). 30 | 31 | 6. Tell them why this approach is not the best (i.e. O(n^2) or higher, not readable, etc...) 32 | 33 | 7. Walk through your approach, comment things and see where you may be able to break things. 34 | Any repetition, bottlenecks like O(N^2), or unnecessary work? Did you use all the information 35 | the interviewer gave you? Bottleneck is the part of the code with the biggest Big O. Focus on 36 | that. Sometimes this occurs with repeated work as well. 37 | 38 | 8. Before you start coding, walk through your code and write down the steps you are going to 39 | follow. 40 | 41 | 9. Modularize your code from the very beginning. Break up your code into beautiful small pieces 42 | and add just comments if you need to. 43 | 44 | 10. Start actually writing your code now. Keep in mind that the more you prepare and understand 45 | what you need to code, the better the whiteboard will go. So never start a whiteboard 46 | interview not being sure of how things are going to work out. That is a recipe for disaster. 47 | Keep in mind: A lot of interviews ask questions that you won’t be able to fully answer on time. 48 | So think: What can I show in order to show that I can do this and I am better than other 49 | coders. Break things up in Functions (if you can’t remember a method, just make up a function 50 | and you will at least have it there. Write something, and start with the easy part. 51 | 52 | 11. Think about error checks and how you can break this code. Never make assumptions about the 53 | input. Assume people are trying to break your code and that Darth Vader is using your 54 | function. How will you safeguard it? Always check for false inputs that you don’t want. Here is 55 | a trick: Comment in the code, the checks that you want to do... write the function, then tell the 56 | interviewer that you would write tests now to make your function fail (but you won't need to 57 | actually write the tests). 58 | 12. Don’t use bad/confusing names like i and j. Write code that reads well. 59 | 60 | 13. Test your code: Check for no params, 0, undefined, null, massive arrays, async code, etc... Ask 61 | the interviewer if we can make assumption about the code. Can you make the answer return 62 | an error? Poke holes into your solution. Are you repeating yourself? 63 | 64 | 14. Finally talk to the interviewer where you would improve the code. Does it work? Are there 65 | different approaches? Is it readable? What would you google to improve? How can 66 | performance be improved? Possibly: Ask the interviewer what was the most interesting 67 | solution you have seen to this problem 68 | 69 | 15. If your interviewer is happy with the solution, the interview usually ends here. It is also 70 | common that the interviewer asks you extension questions, such as how you would handle the 71 | problem if the whole input is too large to fit into memory, or if the input arrives as a stream. 72 | This is a common follow-up question at Google, where they care a lot about scale. The answer 73 | is usually a divide-and-conquer approach — perform distributed processing of the data and only 74 | read certain chunks of the input from disk into memory, write the output back to disk and 75 | combine them later. 76 | 77 | Good code checklist: 78 | - [✅]It works 79 | - [✅]Good use of data structures 80 | - [✅]Code Re-use/ Do Not Repeat Yourself 81 | - [✅]Modular - makes code more readable, maintainable and testable 82 | - [✅]Less than O(N^2). We want to avoid nested loops if we can since they are expensive. Two 83 | separate loops are better than 2 nested loops 84 | - [✅]Low Space Complexity --> Recursion can cause stack overflow, copying of large arrays may 85 | exceed memory of machine 86 | Heurestics to ace the question: 87 | - [✅]Hash Maps are usually the answer to improve Time Complexity 88 | - [✅]If it's a sorted array, use Binary tree to achieve O(log N). Divide and Conquer - Divide a data set 89 | into smaller chunks and then repeating a process with a subset of data. Binary search is a great 90 | example of this 91 | - [✅]Try Sorting your input 92 | - [✅]Hash tables and precomputed information (i.e. sorted) are some of the best ways to optimize your 93 | code 94 | - [✅]Look at the Time vs Space tradeoff. Sometimes storing extra state in memory can help the time. 95 | (Runtime) 96 | - [✅]If the interviewer is giving you advice/tips/hints. Follow them 97 | - [✅]Space time tradeoffs: Hastables usually solve this a lot of the times. You use more space, but you 98 | can get a time optimization to the process. In programming, you often times can use up a little bit 99 | more space to get faster time 100 | 101 | And always remember: Communicate your thought process as much as possible. Don’t worry about 102 | finishing it fast. Every part of the interview matters. 103 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/runoff/runoff.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | // Max voters and candidates 7 | #define MAX_VOTERS 100 8 | #define MAX_CANDIDATES 9 9 | 10 | // preferences[i][j] is jth preference for voter i 11 | int preferences[MAX_VOTERS][MAX_CANDIDATES]; 12 | 13 | // Candidates have name, vote count, eliminated status 14 | typedef struct 15 | { 16 | string name; 17 | int votes; 18 | bool eliminated; 19 | } 20 | candidate; 21 | 22 | // Array of candidates 23 | candidate candidates[MAX_CANDIDATES]; 24 | 25 | // Numbers of voters and candidates 26 | int voter_count; 27 | int candidate_count; 28 | 29 | // Function prototypes 30 | bool vote(int voter, int rank, string name); 31 | void tabulate(void); 32 | bool print_winner(void); 33 | int find_min(void); 34 | bool is_tie(int min); 35 | void eliminate(int min); 36 | 37 | int main(int argc, string argv[]) 38 | { 39 | // Check for invalid usage 40 | if (argc < 2) 41 | { 42 | printf("Usage: runoff [candidate ...]\n"); 43 | return 1; 44 | } 45 | 46 | // Populate array of candidates 47 | candidate_count = argc - 1; 48 | if (candidate_count > MAX_CANDIDATES) 49 | { 50 | printf("Maximum number of candidates is %i\n", MAX_CANDIDATES); 51 | return 2; 52 | } 53 | for (int i = 0; i < candidate_count; i++) 54 | { 55 | candidates[i].name = argv[i + 1]; 56 | candidates[i].votes = 0; 57 | candidates[i].eliminated = false; 58 | } 59 | 60 | voter_count = get_int("Number of voters: "); 61 | if (voter_count > MAX_VOTERS) 62 | { 63 | printf("Maximum number of voters is %i\n", MAX_VOTERS); 64 | return 3; 65 | } 66 | 67 | // Keep querying for votes 68 | for (int i = 0; i < voter_count; i++) 69 | { 70 | 71 | // Query for each rank 72 | for (int j = 0; j < candidate_count; j++) 73 | { 74 | string name = get_string("Rank %i: ", j + 1); 75 | 76 | // Record vote, unless it's invalid 77 | if (!vote(i, j, name)) 78 | { 79 | printf("Invalid vote.\n"); 80 | return 4; 81 | } 82 | } 83 | 84 | printf("\n"); 85 | } 86 | 87 | // Keep holding runoffs until winner exists 88 | while (true) 89 | { 90 | // Calculate votes given remaining candidates 91 | tabulate(); 92 | 93 | // Check if election has been won 94 | bool won = print_winner(); 95 | if (won) 96 | { 97 | break; 98 | } 99 | 100 | // Eliminate last-place candidates 101 | int min = find_min(); 102 | bool tie = is_tie(min); 103 | 104 | // If tie, everyone wins 105 | if (tie) 106 | { 107 | for (int i = 0; i < candidate_count; i++) 108 | { 109 | if (!candidates[i].eliminated) 110 | { 111 | printf("%s\n", candidates[i].name); 112 | } 113 | } 114 | break; 115 | } 116 | 117 | // Eliminate anyone with minimum number of votes 118 | eliminate(min); 119 | 120 | // Reset vote counts back to zero 121 | for (int i = 0; i < candidate_count; i++) 122 | { 123 | candidates[i].votes = 0; 124 | } 125 | } 126 | return 0; 127 | } 128 | 129 | // Record preference if vote is valid 130 | bool vote(int voter, int rank, string name) 131 | { 132 | bool validCandidate = false; 133 | for (int i = 0; i < candidate_count; i++) 134 | { 135 | if (strcmp(name, candidates[i].name) == 0) 136 | { 137 | preferences[voter][rank] = i; 138 | validCandidate = true; 139 | break; 140 | } 141 | } 142 | return validCandidate; 143 | } 144 | 145 | // Tabulate votes for non-eliminated candidates 146 | void tabulate(void) 147 | { 148 | //int count = 0; 149 | for (int i = 0; i < voter_count; i++) 150 | { 151 | for (int j = 0; j < candidate_count; j++) 152 | { 153 | if (!candidates[preferences[i][j]].eliminated) 154 | { 155 | //printf("XX %s", candidates[preferences[i][j]].name); 156 | candidates[preferences[i][j]].votes += 1; 157 | break; 158 | } 159 | } 160 | 161 | } 162 | return; 163 | } 164 | 165 | // Print the winner of the election, if there is one 166 | bool print_winner(void) 167 | { 168 | bool hasWinner = false; 169 | int value_to_win = voter_count / 2; 170 | for (int i = 0; i < candidate_count; i++) 171 | { 172 | if (candidates[i].votes > value_to_win) 173 | { 174 | printf("%s\n", candidates[i].name); 175 | hasWinner = true; 176 | break; 177 | } 178 | } 179 | return hasWinner; 180 | } 181 | 182 | // Return the minimum number of votes any remaining candidate has 183 | int find_min(void) 184 | { 185 | int actualLess = voter_count; 186 | 187 | for (int i = 0; i < candidate_count; i++) 188 | { 189 | if (candidates[i].votes < actualLess && !candidates[i].eliminated) 190 | { 191 | actualLess = candidates[i].votes; 192 | } 193 | } 194 | 195 | return actualLess; 196 | } 197 | 198 | // Return true if the election is tied between all candidates, false otherwise 199 | bool is_tie(int min) 200 | { 201 | bool isTie = true; 202 | for (int i = 0; i < candidate_count; i++) 203 | { 204 | if (!candidates[i].eliminated && candidates[i].votes != min) 205 | { 206 | isTie = false; 207 | break; 208 | } 209 | } 210 | return isTie; 211 | } 212 | 213 | // Eliminate the candidate (or candidiates) in last place 214 | void eliminate(int min) 215 | { 216 | for (int i = 0; i < candidate_count; i++) 217 | { 218 | if (candidates[i].votes == min) 219 | { 220 | candidates[i].eliminated = true; 221 | } 222 | } 223 | return; 224 | } -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/currency.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | BTCS50 - Hold on! 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 | 47 |
48 |
49 |
50 |
51 |
52 |

Bitcoin rocks!

53 |

54 | Bitcoin is a digital currency that was created in January 2009. It follows the ideas set out in a whitepaper by the mysterious and pseudonymous Satoshi Nakamoto 55 |

56 |
57 |
58 | 59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |

Look market in real time

68 | 69 |
70 |
71 | 72 | 73 | 90 |
91 | 92 | 93 |
94 |
95 |
96 |
97 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | BTCS50 - Hold on! 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 | 47 |
48 | 73 |
74 |
75 |
76 |
77 | 78 |

Bank Transfers

79 |

80 | Buy Bitcoin by transferring money from your bank account to a Bitcoin vendor. 81 |

82 |
83 | 84 |
85 | 86 |

Online Wallets

87 |

88 | Don’t want to leave the house? You can use a number of popular payment apps. 89 |

90 |
91 | 92 |
93 | 94 |

Gift Cards

95 |

96 | Have a gift card you don't need? Trade it here for Bitcoin instantly. 97 |

98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |

Become a Bitcoin vendor on BTCS50

107 |

108 | Become a vendor on BTCS50 and empower millions around the world with financial freedom. Offer multiple payment methods that buyers like, eliminate middlemen, and we will help you with all the resources and guidance needed to succeed. 109 |

110 | 111 |
112 |
113 |
114 |
115 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/exchanges.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | BTCS50 - Hold on! 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 | 47 |
48 |
49 |
50 |
51 | 61 | 62 | 72 | 73 | 83 | 84 | 94 | 95 | 105 | 106 | 116 |
117 |
118 |
119 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /resumos/cursos/cs50/all-challenges/problems/homepage/satoshi.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | BTCS50 - Hold on! 12 | 13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 | 47 |
48 |
49 |
50 |
51 |
52 |

Satoshi Original Letter

53 |

A purely peer-to-peer version of electronic cash would allow onlinepayments to be sent directly from one party to another without going through afinancial institution.

54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | 64 |
65 |

Bitcoin

66 |

67 | Commerce on the Internet has come to rely almost exclusively on financial institutions serving astrusted third parties to process electronic payments. While the system works well enough formost transactions, it still suffers from the inherent weaknesses of the trust based model.Completely non-reversible transactions are not really possible, since financial institutions cannotavoid mediating disputes. The cost of mediation increases transaction costs, limiting theminimum practical transaction size and cutting off the possibility for small casual transactions,and there is a broader cost in the loss of ability to make non-reversible payments for non-reversible services. With the possibility of reversal, the need for trust spreads. Merchants mustbe wary of their customers, hassling them for more information than they would otherwise need.A certain percentage of fraud is accepted as unavoidable. 68 |

69 |

70 | These costs and payment uncertaintiescan be avoided in person by using physical currency, but no mechanism exists to make paymentsover a communications channel without a trusted party.What is needed is an electronic payment system based on cryptographic proof instead of trust,allowing any two willing parties to transact directly with each other without the need for a trustedthird party. Transactions that are computationally impractical to reverse would protect sellersfrom fraud, and routine escrow mechanisms could easily be implemented to protect buyers. Inthis paper, we propose a solution to the double-spending problem using a peer-to-peer distributedtimestamp server to generate computational proof of the chronological order of transactions. 71 |

72 |

73 | The system is secure as long as honest nodes collectively control more CPU power than anycooperating group of attacker nodes.1 2.TransactionsWe define an electronic coin as a chain of digital signatures. Each owner transfers the coin to thenext by digitally signing a hash of the previous transaction and the public key of the next ownerand adding these to the end of the coin. A payee can verify the signatures to verify the chain ofownership.The problem of course is the payee can't verify that one of the owners did not double-spendthe coin. 74 |

75 |

76 | A common solution is to introduce a trusted central authority, or mint, that checks everytransaction for double spending. After each transaction, the coin must be returned to the mint toissue a new coin, and only coins issued directly from the mint are trusted not to be double-spent.The problem with this solution is that the fate of the entire money system depends on thecompany running the mint, with every transaction having to go through them, just like a bank. 77 |

78 |

79 | We need a way for the payee to know that the previous owners did not sign any earliertransactions. For our purposes, the earliest transaction is the one that counts, so we don't careabout later attempts to double-spend. The only way to confirm the absence of a transaction is tobe aware of all transactions. In the mint based model, the mint was aware of all transactions anddecided which arrived first. To accomplish this without a trusted party, transactions must bepublicly announced [1], and we need a system for participants to agree on a single history of theorder in which they were received. The payee needs proof that at the time of each transaction, themajority of nodes agreed it was the first received 80 |

81 |
82 |
83 |
84 |
85 | 103 | 104 | 105 | 106 | --------------------------------------------------------------------------------