Skip to content

Instantly share code, notes, and snippets.

@petermuller71
petermuller71 / cryptor.php
Last active November 8, 2024 09:25
cryptor : PHP Encryption and decryption based on libsodium (standard lib >php7.2)
<?php
print "<h1>PHP Encryption with libsodium</h1>";
$message = "This text is secret";
$ciphertext = cryptor::encrypt("password", $message);
$plaintext = cryptor::decrypt("password", $ciphertext);
print "Message:<br />$message <br /><br />Ciphertext:<br />$ciphertext<br /><br />Plaintext:<br />$plaintext";
@duanehutchins
duanehutchins / split-string-into-rows.sql
Last active October 22, 2024 17:03
MySQL split comma-separated string into rows
-- split-string-into-rows.sql
-- Duane Hutchins
-- https://www.github.com/duanehutchins
-- Split a string into a mysql resultset of rows
-- This is designed to work with a comma-separated string (csv, SET, array)
-- To use a delimiter other than a comma:
-- Just change all the occurrences of ',' to the new delimiter
-- (four occurrences in SET_EXTRACT and one occurrence in SET_COUNT)
@mloberg
mloberg / gist:2852153
Created June 1, 2012 13:28
MySQL Slow Query Log Analyzer
#!/usr/bin/php
<?php
/**
* The Analyzer class.
*/
class Analyzer {
private $fp;