Skip to content

Instantly share code, notes, and snippets.

View gubi's full-sized avatar

Alessandro Gubitosi gubi

View GitHub Profile
gubi / class.element.php
Last active December 22, 2015 03:58
Creates a very user-friendly html element, just create new element and echo it. Based on a work from from
class Element{
private $tag; // the html element to create
private $uni; // the remaining (ten) non-deprecated w3c recognized self-closing unitags
private $atts; // attributes are entered into an associative array
private $obj; // the object to be nested
public function __construct($tag, $atts=array(), $uni=array("meta", "base", "link", "img", "br", "hr", "param", "input", "option", "col")){
$this->tag = strtolower($tag);
$this->atts = $atts;
gubi / check_email_settings.php
Last active December 23, 2015 17:19
This function tries to verify an email address using several techniques, depending on the configuration, and returns its smtp host. Based on a work from and improved by me ;)
header("Content-type: text/plain");
$email_to_verify = (!isset($_GET["smtp_host"]) ? "" : $_GET["smtp_host"]);
$static_mail_address_for_test = "";
$static_host_for_test = "";
// Example from
print validateEmail($email_to_verify, true, true, $static_mail_address_for_test, $static_host_for_test);
gubi / .config.conf
Last active December 25, 2015 05:59
If you want to remove all subscriber of a Mailing List and re-subscribe them with a new email address, these scripts help you to massive inform them. My provider (OVH) do not allow to automate this operation, so follow these steps: 1. Create a new table "site_users" in a database, with "name", "last_name", "email", "email2" and "user_type" colum…
gubi / PICOL
Last active December 26, 2015 00:29
PICOL icons categories


Execute database.sql as a SQL query in a MySQL database, then configure the file params.ini with database data.
Populate the database as you like and load the page table.php: you will see a simple table with all ordered... ;)

This is the list of all 10 categories of PICOL icons

  • Technology
  • Finance
  • Culture
  • Education and Science
gubi / redirect_to_correct_page.php
Last active December 26, 2015 06:59
This script finds searched pages to similar existing and redirect users to correct page if the result is 1. Use PDO connection.
$page = addslashes($_GET["p"]);
$searching_page = $pdo->query("select * from `TABLE` where `COLUMN` sounds like '%" . $page . "%'");
if($searching_page->rowCount() == 1) {
while($dato_searching_pages = $searching_page->fetch()) {
header("Location: " . $dato_searching_pages["COLUMN"]);
} else {
$searching_page = $pdo->query("select * from `TABLE` where `COLUMN` sounds like '%" . $page . "%'");
gubi / index.php
Last active December 27, 2015 08:28
Connect via SSH to remote Server, search and find a SAMBA conf file (smb.conf) and then parse it to php array
if(!isset($_POST["submit"])) {
Compilando questo form uno script effettuer&agrave; una connessione SSH con la tua macchina, cercher&agrave; il file di configurazione SAMBA (smb.conf) e ne far&agrave; un parser.<br />
Lo script esegue operazioni in sola lettura, e ha valore esemplificativo della possibilit&agrave; di automatizzare un'installazione via remoto tramite interfaccia web.<br />
Il comando che verr&agrave; eseguito sulla macchina da te indicata &egrave;:<br /><tt>$ cat $(find / -type f -name "smb.conf" -print 2>/dev/null -quit)</tt>.<br />
<br />
In ogni caso, puoi consultare i files sorgenti qui: <a href="" target="_blank"></a>

#RSA File De- and Encryption Docu for encrypt and decrypt a large file with AES and RSA


###Generate RSA Keypairs

//generates a private Key with 8196 Bit
openssl genrsa -out private.pem 8196
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
* Explode any single-dimensional array into a full blown tree structure,
* based on the delimiters found in it's keys.
* The following code block can be utilized by PEAR's Testing_DocTest
* <code>
* // Input //
* $key_files = array(
* "/etc/php5" => "/etc/php5",
gubi / fa-bounce.css
Last active September 14, 2023 17:58
Pulse animation for FontAwesome icons
.fa-bounce {
display: inline-block;
position: relative;
-moz-animation: bounce 1s infinite linear;
-o-animation: bounce 1s infinite linear;
-webkit-animation: bounce 1s infinite linear;
animation: bounce 1s infinite linear;
@-webkit-keyframes bounce {