Skip to content

Instantly share code, notes, and snippets.

View Gsantomaggio's full-sized avatar
🐒
Working from home

Gabriele Santomaggio Gsantomaggio

🐒
Working from home
View GitHub Profile

E se fossi stato un Virus?

Smettere di credere a chi vi dice che si può diventare bravi programmatori in sei mesi.

Smettere di credere ad ogni post su linkedin.

let stream = TcpStream::connect((broker.host.as_str(), broker.port)).await?;
let mut tls_builder: tokio_native_tls::native_tls::TlsConnectorBuilder = tokio_native_tls::native_tls::TlsConnector::builder();
let cert_bytes = include_bytes!("result/ca_certificate.pem");
let cert = Certificate::from_pem(cert_bytes).unwrap();
let s = tls_builder.add_root_certificate(cert)
.danger_accept_invalid_hostnames(false)
// .danger_accept_invalid_certs(true)
.min_protocol_version(Some(tokio_native_tls::native_tls::Protocol::Tlsv12));
let conn = tokio_native_tls::TlsConnector::from(s.build()?).connect(broker.host.as_str(), stream).await?;
import json
import time
from json import JSONEncoder
class Foo:
def __init__(self, string_1, string_2, int_1):
self.string_1 = string_1
self.string_1 = string_2
self.int_1 = int_1
  • L'applicatione gira su Azure
  • Una app mobile manda dei dati tramite rest API ad una App Service
  • L'app service poi salva su rabbitmq ( ma questo non e importante)

Problema:

  • Gestire l'autenticazione dato che l'end poit HTTP è pubblico
  • Solo l'app puo fare upload
  • l'app NON deve fare nessuna registrazione di username e password da nessuna parte ( se interessati vi spiego il perche)
  • Non conosco Azure e non sono un esperto di mobile
using System.Text;
using RabbitMQ.Stream.Client;
using RabbitMQ.Stream.Client.Reliable;
namespace example;
public class Batch
{
private const int TotalMessages = 20_000_000;
private const int MessageSize = 100;
private const int AggregateBatchSize = 300;
@Gsantomaggio
Gsantomaggio / calculator
Last active December 6, 2021 19:29
Calculator Project
TODO:
- Move it to github
- Create unit tests
- Create a CI to execute the tests with github action
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
echo "Installing Docker..."
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -