Skip to content

Instantly share code, notes, and snippets.

View Chak10's full-sized avatar
🏠
Working from home

Chak10

🏠
Working from home
View GitHub Profile
@Chak10
Chak10 / combine_hashes.py
Last active October 27, 2024 10:59
La funzione `combine_hashes_mode` è progettata per combinare hash di immagini utilizzando la modalità per ciascun bit. Questa funzione consente di gestire diversi hash generati da immagini simili, identificando anche immagini completamente nere o bianche.
import imagehash
from PIL import Image
import numpy as np
def combine_hashes_mode(*hashes):
"""
Combina più hash di immagini utilizzando la modalità per ciascun bit.
Controlla anche se un'immagine è completamente nera o bianca.
Parameters:
@Chak10
Chak10 / led.txt
Created September 5, 2020 10:19
LED RESISTOR
GIALLO -> 2.2K
VERDE -> 20K
ROSSO -> 3.3K
from decimal import *
n = 1e4
def factorial(n):
fact = 1
for i in range(1, int(n) + 1):
fact = fact * i
return fact
@Chak10
Chak10 / sodium_encrypt.php
Created June 13, 2019 17:41
Encrypt-decrypt string with Sodium
<?php
function encrypt($message, $pass)
{
$alg = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT;
$opslimit = SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE;
$memlimit = SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE;
$final = $salt = openssl_random_pseudo_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);
$secret_key = sodium_crypto_pwhash(SODIUM_CRYPTO_SECRETBOX_KEYBYTES, $pass, $salt, $opslimit, $memlimit, $alg);
$final .= hash_hmac('sha3-256', $message, $secret_key, true);
@Chak10
Chak10 / openweatherapi.php
Last active August 17, 2018 13:37
Current condition
<?php
class OpenWeatherMap
{
var $api;
/**
* OpenWeatherMap constructor.
* @param $a
*/
@Chak10
Chak10 / altitude.py
Last active June 27, 2018 13:55
BMP280 + example
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import requests
from bmp280 import *
geo = "" #coordin sea
d_api = "" #api darksky
@Chak10
Chak10 / rapidgator_api.php
Last active October 26, 2023 11:39
Class based on Rapidgator Api
<?php
class Rg {
/*
Based on Rapidgator Api
https://support.rapidgator.net/index.php?/Knowledgebase/Article/View/89/9/do-you-have-api
*/
@Chak10
Chak10 / bme280.py
Last active June 21, 2017 07:49
Weather Python
#!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# bme280.py
#
@Chak10
Chak10 / curl.php
Last active June 9, 2017 21:04
CURL MEGA CLASS PHP
<?php
namespace Curl;
class Curl {
const VERSION = '7.3.0';
const DEFAULT_TIMEOUT = 30;
public $curl;
public $id = null;
@Chak10
Chak10 / cookie.js
Last active June 5, 2017 19:07
Gestione Cookie Javascript