Skip to content

Instantly share code, notes, and snippets.

View vitormeriat's full-sized avatar

Vitor Meriat vitormeriat

View GitHub Profile
import os
import random
import numpy as np
from sklearn.model_selection import train_test_split
dir_src = "{Diretório de origem}"
dir_test = "{Diretório destino das imagens de teste}"
dir_train = "{Diretório destino das imagens de traino}"
# Quantidade de imagens a serem selecionadas no dataset
@vitormeriat
vitormeriat / mqtt-sample.html
Created May 22, 2017 19:22
Demo MQTT, JS, HTML and HighCharts
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example of plotting live data with websockets and highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="mqttws31.js" type="text/javascript"></script>
<script type="text/javascript">
var MQTTbroker = 'test.mosquitto.org';
var MQTTport = 8080;
var MQTTsubTopic = 'meriat/sala1/#'; //works with wildcard # and + topics dynamically now
@vitormeriat
vitormeriat / tipos_anonimos.cs
Created March 26, 2017 03:15
POST: Como retornar um tipo anônimo por método
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TiposAnonimos
{
class Program
{
static void Main(string[] args)
@vitormeriat
vitormeriat / stream_twitter.py
Created October 11, 2016 19:19
Simple reader Twitter streaming data
# Importing modules Tweepy, Datetime and Json
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import json
# Replace following access keys of your api twitter. Consumer Key, Consumer Secret, Access Token and Access Token Secret
consumer_key = "{your_consumer_key}"
consumer_secret = "{your_consumer_secret}"
access_token = "{your_access_token}"
@vitormeriat
vitormeriat / list_tables_ats.cs
Created August 29, 2016 14:16
List Tables Azure Storage Service
class Program
{
static void Main(string[] args)
{
Console.Title = "Listar Tabelas do Azure Storage Service";
//"DefaultEndpointsProtocol=https;AccountName=MinhaConta;AccountKey=MinhaSenha";
string connectionString = "UseDevelopmentStorage=true";
var TablesName = ListaNomesTabelas(connectionString);
@vitormeriat
vitormeriat / entity_exists.cs
Last active May 16, 2022 15:33
Check if an entity exists in a Azure Table Storage
public async Task<bool> EntityExists(string partitionKey, string rowKey)
{
var tableQuery = new TableQuery<DynamicTableEntity>();
tableQuery.FilterString = TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey),
TableOperators.And,
TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, rowKey));
var dynamicTableEntities = await CloudTable.ExecuteQuerySegmentedAsync(tableQuery, null, TableRequestOptions, OperationContext);
return dynamicTableEntities.Results.Any();
@vitormeriat
vitormeriat / dynamic_table_entity.cs
Last active August 29, 2016 17:27
DynamicTableEntity to Azure Storage Table - Search between dates
void Main()
{
var account = "";
var key = "";
var tableName = "";
var storageAccount = CloudStorageAccount.Parse($"DefaultEndpointsProtocol=https;AccountName={account};AccountKey={key}");
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference(tableName);