Skip to content

Instantly share code, notes, and snippets.

View lucasaba's full-sized avatar

Luca Saba lucasaba

View GitHub Profile
@lucasaba
lucasaba / esrcizio.cpp
Created November 8, 2021 21:30
Esercizio test
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
@lucasaba
lucasaba / scarica_pec.php
Last active November 10, 2020 18:07
Scaricamento PEC
<?php
/*
use PhpPec\PecMessage;
use PhpPec\PecServer;
use Fetch\Attachment;
*/
$server = new PecServer('aruba.server.pec.it', 445);
$server->setAuthentication('nome-utente', 'password');
/**
<?php
/**
* @param Mailbox $mailbox
* @return PecServer
*/
private function getServer(Mailbox $mailbox)
{
$server = new PecServer($mailbox->getHost(), $mailbox->getPort());
$server->setAuthentication($mailbox->getUsername(), $mailbox->getPassword());
@lucasaba
lucasaba / update-reboot-check.sh
Created August 28, 2019 08:57
A script that sends a telegram message when an ubuntu server needs update or reboot
#!/bin/bash
IFS=';' read updates security_updates < <(/usr/lib/update-notifier/apt-check 2>&1)
HOSTNAME=`hostname`
BOT_TOKEN='THISTOKENISFROMBOTFATHER'
# Numeric id of the chat to publish messages to
CHAT_ID=1234567890
if [ ! -f ".update-check-status" ] ; then
echo "0:0" > .update-check-status
fi
@lucasaba
lucasaba / gist:abe0fd3ea8b9cefed5ca0445afaf47cb
Created December 29, 2018 14:28
Uso della libreria PHPPec
/**
* @param Mailbox $mailbox
* @return PecServer
*/
private function getServer(Mailbox $mailbox)
{
$server = new PecServer($mailbox->getHost(), $mailbox->getPort());
$server->setAuthentication($mailbox->getUsername(), $mailbox->getPassword());
return $server;
}
<?php
namespace Epod4\Moduli\ProtocolloBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class ProtocolloExtension extends Extension
{
/**
* {@inheritDoc}
<?php
namespace Epod4\Moduli\ProtocolloBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
@lucasaba
lucasaba / remote-upgrade
Created December 10, 2016 14:57
Gestisce l'aggiornamento dei server tramite ssh e apt
#!/bin/bash
show_help() {
cat << EOF
Usage: ${0##*/} [-hal] [SERVER]...
Invoca l'apt-get su uno o più server remoti.
-h mostra questa help ed esce
-a modifica il comando di apt-get in autoremove
-l effettua l'upgrade dei server virtuali interni
EOF
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Marco Trevisan
#
# Authors:
# Marco Trevisan <marco@trevisan.xyz>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
@lucasaba
lucasaba / vtiger_test_traduzioni.php
Created November 10, 2015 11:07
Controllo coerenza dei file originali e traduzione
#!/usr/bin/php
<?php
if(count($argv) != 3) {
echo "Utilizzo: vtiger_test_traduzioni.php <cartella traduzioni italiane> <cartella traduzioni originali>\n";
echo "Esempio: vtiger_test_traduzioni.php /home/utente/traduzioni/Vtiger-6.X-lingua-ITA/modules/ /var/www/vtiger/languages/en_us/\n";
return 0;
}
$folder_traduzioni = realpath($argv[1]);