Skip to content

Instantly share code, notes, and snippets.

View cleuton's full-sized avatar
💭
preparing quantum deep learning projects

Cleuton Sampaio cleuton

💭
preparing quantum deep learning projects
View GitHub Profile
@cleuton
cleuton / menor_custo.py
Created November 21, 2021 10:15
Exemplo do algoritmo de Dijkstra em Python
# a->b,a->c,b->c,b->f,c->d,c->e,d->e,f->e
# Início: a, fim: e
#
# (d)
# | \
# (c)-(e)
# / | |
# (a)-(b)-(f) (j)-(k)
#
# Cada caminho tem um custo associado:
@cleuton
cleuton / histogram.go
Created November 26, 2019 18:58
Histogram using Golang
// Cleuton Sampaio
package main
import (
"fmt"
"math"
"math/rand"
"github.com/emirpasic/gods/utils"
"gonum.org/v1/plot"
@cleuton
cleuton / StreamDemo2.java
Created November 12, 2019 16:38
New stream API samples
package com.obomprogramador.stream;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class StreamDemo2 {
static class Order {
@cleuton
cleuton / StreamDemo.java
Created September 23, 2019 17:39
Java Stream API demo
package com.obomprogramador.stream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class StreamDemo {
@cleuton
cleuton / promise.sample
Created May 21, 2014 12:36
promise sample
/*
* GET home page.
*/
var Promise = require('promise');
var Request = require('request');
exports.index = function(req, res){
var aprovada = function(httpresponse) {
@cleuton
cleuton / async.waterfall.sample
Created May 21, 2014 12:33
Async waterfall sample
async.waterfall([
function(callback){
// ***** Task 1: Apaga o banco de dados
db.once('open', function () {
db.db.dropDatabase(function(err) {
if(err != null) {
console.log('Erro ao apagar o banco: ' + err);
}
else {
@cleuton
cleuton / async route
Created May 9, 2014 21:15
Demo async route
/*
* Página default:
*/
var Worker = require('webworker-threads').Worker;
var redis = require("redis");
var uuid = require('node-uuid');
exports.index = function(req, res){
res.render('index', { title: 'Operação assíncrona', botao: 'Iniciar' });
@cleuton
cleuton / async app js
Created May 9, 2014 21:13
Demo async app
/*
Copyright 2014 Cleuton Sampaio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@cleuton
cleuton / indexjquery
Created May 9, 2014 21:09
Demo jQuery
/*
* Script de eventos da página index.html
*/
var chave = null;
var calculando = false;
var original = '';
$(document).ready(function(){
$("#btn").click(function(){
if (!calculando) {
@cleuton
cleuton / nonblocker.js
Last active January 24, 2018 13:13
Non blocker cpu intensive node script
// nonblocker.js
var restify = require('restify');
var fs = require('fs');
var Worker = require('webworker-threads').Worker;
var server = restify.createServer();
// Home page: