- Adopted from: https://github.com/azagniotov/stubby4j/blob/master/docs/ADMIN_PORTAL.md
- Inspired by Swagger API docs style & structure: https://petstore.swagger.io/#/pet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| consumer_key:process.env.CONSUMER_KEY, | |
| consumer_secret:process.env.CONSUMER_SECRET, | |
| access_token:process.env.ACESS_TOKEN, | |
| access_token_secret:process.env.ACESS_TOKEN_SECRET | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| corpus = [ | |
| "Food Trucks em Manaus", # Consulta | |
| "Conheça alguns dos principais food parks espalhados por toda a cidade de Manaus", # Página 1 do Google | |
| "O melhor food truck de Manaus (Em novo endereço)", # Página 1 do Google | |
| "Como chegar a Bambina Food Truck em Manaus de Ônibus?", # Página 4 do Google | |
| "Projeto de Lei regulamenta Food Trucks em Manaus" # Página 4 do Google | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vectorizer = TfidfVectorizer(analyzer='word') | |
| x = vectorizer.fit_transform(corpus) | |
| 'Corpus: ' + ' '.join(vectorizer.get_feature_names()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Distancia Euclidiana | |
| for i in range(1, 5): | |
| dist = norm((x[0, :] - x[i, :]).A) | |
| print(f"Distância(Consulta, Documento {i}) = {dist:.2f}") | |
| # Função Auxiliar | |
| def cosine_similarity(x, y): | |
| x = x.A.ravel() | |
| y = y.A.ravel() | |
| return np.dot(x, y) / (norm(x) * norm(y)) |
The set lines
- These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
- With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
set -euxo pipefailis short for:
set -e
set -u
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| date; | |
| docker ps -q --filter "status=exited" | xargs --no-run-if-empty docker rm; | |
| docker volume ls -qf dangling=true | xargs -r docker volume rm; | |
| # CRON | |
| # */5 * * * * /home/ec2-user/ecs-docker-cleanup.sh >> /home/ec2-user/docker-cleanup.log | |
| # Reference | |
| # https://medium.com/@_ifnull/aws-ecs-no-space-left-on-device-ce00461bb3cb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Usage `python create_ts_index.py <folder-name>` | |
| # TODO: Convert to bash script | |
| import sys | |
| from pathlib import Path | |
| def create_index(rootpath): | |
| rootpath = Path(rootpath) | |
| indexpath = rootpath / "index.ts" |
Once upon a time there was a user that wanted to install firefox.
The user tried to do pacman -S firefox but it didn't work. The all
mighty pacman reported that firefox-3.2.4-1.i686.pkg.tar.gz could not
be found on his mirror. So the user tried pacman -Sy firefox. It
worked and the user rejoiced since he could once again go and troll /h/.
But all was not good. The user had made a grave error!
See, when the user told the almighty pacman to -Sy firefox, pacman did
Comprehensions are a really useful feature of Python that aren't available in JavaScript (or many languages).
These concepts of course can be tranlsated into using map instead. But especially the dictionaries are a bit
trickier.
>>> foobar = range(5)
>>> [x + 1 for x in foobar]
[1, 2, 3, 4, 5]