Skip to content

Instantly share code, notes, and snippets.

View Gsantomaggio's full-sized avatar
:shipit:
Working from home

Gabriele Santomaggio Gsantomaggio

:shipit:
Working from home
View GitHub Profile
import pika
import time
import sys
## Execute the script and then send a message (using the ui) to the queue called myqueue
class PyPikaTest:
def callback(self, ch, method, properties, body):
print("[Message Received] %s" % (body))
time.sleep(2.5 * 60)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
BOX_IMAGE = "ubuntu/xenial64"
#!/bin/sh
sudo apt-get install curl gnupg debian-keyring debian-archive-keyring apt-transport-https -y
## Team RabbitMQ's main signing key
sudo apt-key adv --keyserver "hkps://keys.openpgp.org" --recv-keys "0x0A9AF2115F4687BD29803A206B73A36E6026DFCA"
## Launchpad PPA that provides modern Erlang releases
sudo apt-key adv --keyserver "keyserver.ubuntu.com" --recv-keys "F77F1EDA57EBB1CC"
## PackageCloud RabbitMQ repository
curl -1sLf 'https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey' | sudo apt-key add -
@Gsantomaggio
Gsantomaggio / consumer.go
Created July 16, 2021 08:46
consumer.go
package main
import (
"fmt"
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/amqp"
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/stream"
"os"
"time"
)
# -*- 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 -
@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
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;
  • 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
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