Skip to content

Instantly share code, notes, and snippets.

@vncsna
vncsna / beautiful.rest.api.docs.in.markdown.md
Created April 30, 2021 23:09 — forked from azagniotov/beautiful.rest.api.docs.in.markdown.md
Example to create beautiful REST API docs in Markdown, inspired by Swagger API docs.
# 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))
vectorizer = TfidfVectorizer(analyzer='word')
x = vectorizer.fit_transform(corpus)
'Corpus: ' + ' '.join(vectorizer.get_feature_names())
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
]
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
}
function post_tweet(tweet){
twitter.post(
'statuses/update',
{'status': tweet}
)
}
function post_phrase(){
let phrases = require('./scraping/pensador-phrases-2020-12-28.json')
let keys = Object.keys(phrases)
function follow_protocol(number=0){
let query = coin_toss ? 'protocolo' : 'protocol'
twitter
.get(
'users/search',
{q: query,
page: number,
count: 20,
include_entities: false}
function follow_user(user_id){
twitter
.post(
'friendships/create',
{user_id: user_id,
follow: false}
)
.then(result => {
let tweet_pt = `Seguindo @${result.data.screen_name}!?`
let tweet_en = `Following @${result.data.screen_name}!!`
twitter
.get(
'statuses/user_timeline',
{screen_name: 'vncsna',
count: 200,
exclude_replies: true}
)
.then(result => {
tweets = result.data
for (let tweet of tweets) {
function rogerio_skylab(id_str){
twitter
.post(
'statuses/destroy/:id',
{id: id_str}
)
.then(result => {
console.log(result.data)
})
.catch(error => {