Skip to content

Instantly share code, notes, and snippets.

View matteosavio's full-sized avatar

Matteo Savio matteosavio

View GitHub Profile
@matteosavio
matteosavio / testEmailServer.php
Created June 16, 2025 15:20 — forked from froemken/testEmailServer.php
Very simple PHP Script to test SMTP email server
<?php
// For port 24 host without scheme is just fine
// Add scheme, if using secure connection. Port 465 or 587
$host = 'ssl://smtp.strato.de';
//$host = 'tls://smtp.strato.de';
$port = 465;
//$port = 25;
$errorNumber;
$error;
$timeout = 10;
<?php
//example for a GET request
//init variable for request authentification
$username = 'arbeitPlus';
$userkey = 'xxx';
$stamp = gmDate("Y-m-d H:i:s O");
$signature = hash('sha256', $stamp . '::' . $userkey);
//set header for request
$authHeader = array('prosol-date:' . $stamp, 'Authorization:' . $username . ':' . $signature);
// Initializing the curl
@matteosavio
matteosavio / transfer.sql
Last active October 20, 2022 18:12
Transfering information from audio_file to url_mp3_hoster
DELETE FROM wp_postmeta
WHERE meta_key="url_mp3_hoster";
INSERT INTO wp_postmeta ( post_id, meta_value, meta_key )
SELECT
post_id,
SUBSTRING(meta_value,1,POSITION(".mp3" IN meta_value)+4),
"url_mp3_hoster"
FROM wp_postmeta
WHERE
@matteosavio
matteosavio / DeletedFilter.php
Last active December 26, 2018 13:25 — forked from baptistedonaux/DeletedFilter.php
Soft Delete Symfony/Doctrine
<?php
namespace App\Repository\Filters;
use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\ORM\Query\Filter\SQLFilter;
class DeletedFilter extends SQLFilter
{
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
<?php
$testEmail = 'test-' . rand(100000,999999) . '@ditrk.com';
// wrong form, will return 404 not found
$response = subscribeToAjabizForm(
'https://app.ajabiz.com/',
'wrongFormId',
$testEmail,
'First Name',
@matteosavio
matteosavio / .htaccess
Created April 15, 2018 13:02 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@matteosavio
matteosavio / inupdate.sh
Last active September 8, 2017 20:26
Invoice Ninja Update Script
#!/bin/bash -ue
#Invoice Ninja Self-Hosted Automatic Update
#This version will check https://invoiceninja.org for an updated version and install if found.
#Tested and works with cron. Lines 51, 54, & 79 output timestamps so you can pipe to a logfile.
#USE AT YOUR OWN RISK
#Replace </path/to/ninja> (line 13) and </download/path> (line 57) with your specifics, obviously.
#!!IMPORTANT!! Be sure to edit lines 16 & 17 if www-data is not the owner/group for /ninja/storage!
#SET INITIAL VARIABLES