Skip to content

Instantly share code, notes, and snippets.

View gubi's full-sized avatar

Alessandro Gubitosi gubi

View GitHub Profile
@gubi
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 http://davidwalsh.name/create-html-elements-php-htmlelement-class
<?php
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
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 http://www.tienhuis.nl/php-email-address-validation-with-verify-probe and improved by me ;)
<?php
header("Content-type: text/plain");
require_once("email_verify_source.php");
$email_to_verify = (!isset($_GET["smtp_host"]) ? "mail_to_check@test_domain.com" : $_GET["smtp_host"]);
$static_mail_address_for_test = "[email protected]";
$static_host_for_test = "example.com";
// Example from http://www.tienhuis.nl/files/email_verify_example.php
print validateEmail($email_to_verify, true, true, $static_mail_address_for_test, $static_host_for_test);
@gubi
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…
[database]
host = "YOUR DATABASE HOST"
name = "YOUR DATABASE USERNAME"
username = "YOUR DATABASE USERNAME"
password = "YOUR DATABASE PASSWORD"
@gubi
gubi / PICOL Categories.md
Last active December 26, 2015 00:29
PICOL icons categories

Instructions

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
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.
<?php
$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"]);
exit();
}
} else {
$searching_page = $pdo->query("select * from `TABLE` where `COLUMN` sounds like '%" . $page . "%'");
@gubi
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
<?php
if(!isset($_POST["submit"])) {
?>
<h3>Importante</h3>
<p>
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="https://gist.github.com/gubi/7296053" target="_blank">https://gist.github.com/gubi/7296053</a>

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

##Keypairs

###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;
<?php
/**
* 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
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 {