This file contains 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
import csv | |
import random | |
class Dataset: | |
def remove_stop_words(self, text): | |
return text.replace(',', '').replace('.', '') | |
def get_portuguese_text(self, row, dataset): | |
portuguese_text = self.remove_stop_words(row[2].lower()).split() |
This file contains 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
import requests | |
from requests.auth import HTTPBasicAuth | |
import json | |
import math | |
from enum import Enum | |
from datetime import datetime | |
class Mnemonic(Enum): | |
TORQUE = 'TORQUE_AVG' | |
SURF_RPM = 'SURF_RPM' |
This file contains 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
import requests | |
r = requests.post( | |
'http://veiculos.fipe.org.br/api/veiculos/ConsultarMarcas', | |
json=payload, | |
headers={ | |
'Host': 'veiculos.fipe.org.br', | |
'Referer': 'http://veiculos.fipe.org.br/' | |
} | |
) |
This file contains 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
#include <iostream> | |
using namespace std; | |
void printall(char *xpto){ | |
for(int i=0; i < 3; i++){ | |
cout << *(xpto+i); | |
} | |
cout << "\n"; | |
} |
This file contains 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
/* Callback example with c++ */ | |
#include <iostream> | |
int add(int a, int b, const char *caller_name) | |
{ | |
std::cout << __FUNCTION__ << " was called by " << caller_name << "\n"; | |
return a + b; | |
} | |
int subtraction(int a, int b, const char *caller_name) |
This file contains 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
function visit_top_10_order_estimated_visits(){ | |
var ctx = document.getElementById("visit_top_10_order_estimated_visits"); | |
var names_top_10_order_estimated_visits = JSON.parse('{{ names_top_10_order_estimated_visits|safe }}'); | |
var visits_top_10_order_estimated_visits = JSON.parse('{{ visits_top_10_order_estimated_visits|safe }}'); | |
var visit_top_10_order_estimated_visits = new Chart(ctx, { | |
type: 'bar', | |
data: { | |
labels: names_top_10_order_estimated_visits, | |
datasets: [{ | |
data: visits_top_10_order_estimated_visits, |
This file contains 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
[{ | |
"beeg.com": { | |
"global_rank": "384", | |
"daily_time_on_site": "3:51", | |
"daily_pageviews_per_visitor": "2.57", | |
"percent_of_traffic_from_search": "13.80%", | |
"total_site_linking_in": "1,447", | |
"audience_geography": [ | |
{ | |
"country": " United States", |
This file contains 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
class GetTopSitesListAditionalInformation(LogIntoAlexa): | |
def __init__(self): | |
super().__init__() | |
self.top_list = json.load(open('../data/data.json')) | |
self.url = 'https://www.alexa.com/siteinfo/' | |
def get_additional_informations(self): | |
self.log_into_alexa() | |
i = 0 | |
for key, value in self.top_list.items(): |
This file contains 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
from django.test import TestCase | |
# Is necessary import <class 'django.db.models.query.QuerySet'> to make this validation | |
from django.db.models.query import QuerySet | |
class UserTestCase(TestCase): | |
def setUp(self) | |
# (your setUp code here...) | |
self.create_models() | |
def create_models(self): |
This file contains 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
# It is just a example and not completed code | |
from django.http import JsonResponse | |
def ix_detail_pix(request, *args): | |
""" Ajax PIX info if clicked on PIX """ | |
pix_uuid = request.GET['pix'] | |
data = {} | |
pix_infos = get_pix_amounts_info(pix_uuid) |
NewerOlder