Skip to content

Instantly share code, notes, and snippets.

@anton-vlasenko
anton-vlasenko / melody.php
Last active December 13, 2022 14:02
Creating music with PHP; more info here: 24daysindecember.net/2022/12/12/creating-music-with-php/
<?php
declare( strict_types=1 );
class WaveFile {
private const RIFF = 'RIFF';
private const WAVE = 'WAVE';
private const FMT_CHUNK_MARKER = 'fmt ';
private const FMT_CHUNK_SIZE = 16;
private const FORMAT_TYPE = 1; // PCM
private const CHANNELS = 1;
== Test Report
Testing Environment:
* Browser: Safari 15.4
* Theme: Twenty Twenty-Two
* Server: macOS 12.3, PHP 8.0.18 (native), Apache 2.4.53 (native)
* WordPress: 6.0-alpha-52448-src
@anton-vlasenko
anton-vlasenko / mysqlgzip.sh
Last active May 29, 2019 11:21
Compressing Mysqldump Output
mysqldump <mysqldump options> --skip-lock-tables --set-gtid-purged=OFF | gzip > outputfile.sql.gz
gunzip < outputfile.sql.gz | mysql <mysql options>