Skip to content

Instantly share code, notes, and snippets.

View vittodevit's full-sized avatar
🥁
:)

Vittorio Lo Mele vittodevit

🥁
:)
View GitHub Profile
@vittodevit
vittodevit / convert.java
Created October 6, 2020 19:09
Converts int into little-endian 4 byte array
/**
* Converts an int to a byte[]
* @param i Integer to convert
* @return byte[]
*/
public static byte[] intToByteArray (int i) {
ByteBuffer buf = ByteBuffer.allocate(4);
buf.order(ByteOrder.LITTLE_ENDIAN);
buf.putInt(i);
return buf.array();
@vittodevit
vittodevit / CsmcrcExample.cs
Last active October 7, 2020 18:11
Example usage for Csmcrc library
/*THIS EXAMPLE CONNECTS TO A SERVER, SENDS A COMMAND AND DISCONNECTS*/
using System;
using csmcrc;
namespace CsmcrcExample
{
class CsmcrcExample
{
static void Main(string[] args)
{
@vittodevit
vittodevit / restful_empirefactions.php
Created October 13, 2020 21:11
Verifica player per EmpireFactions.tk
<?php
//RESTful Player Verification API for 'empirefactions.tk'
//AUTHOR: mrBackSlash
//player verification section
//include config
require 'config.php';
//get params from request
$playername = $link->real_escape_string($_GET['ign']);
/*
AUTORE: Vittorio Lo Mele
DATA: 19/11/2020
DESCRIZIONE: Programma per l'apertura automatica dei link delle videolezioni
in base all'orario del computer.
FORMATO CSV ORARIO PER RIGA: Giorno Settimana,Ora Inizio in secondi,Ora fine in secondi,link
ESEMPIO RIGA: LUN,29100,32100,https://example.com
*/
#include <iostream>
#include <fstream>
@vittodevit
vittodevit / pompe.ino
Created November 27, 2020 10:39
Gruppo di pompe, alterna la partenza tra pompa n1 e pompa n2 alla chiusura dei contatti del pressostato.
#define PULSANTE 2 //pin del pressostato
#define POMPAUNO 7
#define POMPADUE 6
bool crun = false;
bool controlloauto = true;
int latest = 1;
void setup() {
pinMode(PULSANTE, INPUT);
@vittodevit
vittodevit / contacaratteri.cpp
Created December 3, 2020 08:41
Conta tutte le lettere maiuscole, minuscole ed altro in un file di testo
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
using namespace std;
//nessun menù, solo funzione di contatore, si presuppone che il menù salvi le righe di testo in un file
int main(){
ifstream ifs ("testo.txt", ifstream::in); //apertura file di testo
@vittodevit
vittodevit / config.yaml
Created January 25, 2021 18:34
Prende i dati di un sensore e li inserisce in un database
#File di configurazione, inserisci intervallo in secondi
db_address: localhost
db_port: 3306
db_user: root
db_pass: root
db_name: database
db_table: meteo
read_interval: 30
sensor_endpoint: http://sample.com/
<?php
$enableDebug = false;
header('Content-Type: text/plain; charset=utf-8');
function indirizzoIpReale(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip=$_SERVER['HTTP_CLIENT_IP'];
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
@vittodevit
vittodevit / nomi.txt
Created March 4, 2021 08:55
Fuck scammers, fuck everyone of them
abaco
abbondanza
abbondanzia
abbondanzio
abbondazio
abbondia
abbondina
abbondio
abdelkrim
abdellah
@vittodevit
vittodevit / num.c
Created March 27, 2021 22:32
Conta tutti i numeri positivi e negativi dato l'input dell'utente.
#include <stdio.h>
int main(){
int quantita;
printf("Inserisci quantità valori: ");
scanf("%d", &quantita);
int valori[quantita];
int i = 1;
do{
printf("Inserisci valore n%d:", i);