Skip to content

Instantly share code, notes, and snippets.

@vrana
vrana / musicbrainz_bot.py
Last active October 8, 2026 15:36
vrana_bot: adds IMDb links to MusicBrainz release groups whose tracklist matches a ČSFD soundtrack
"""Adds IMDb links to MusicBrainz release groups as vrana_bot.
Input: musicbrainz-imdb.tsv next to this script, one row per release group, in the order of submission.
It pairs MusicBrainz releases with soundtracks in ČSFD, the Czech film database, by matching tracklists.
Columns used: MB release group, IMDb, CSFD film, soundtrack name, tracks, titles (share of matching titles),
s/track (average duration difference in seconds), matching MB release, skip (reason not to submit the row).
musicbrainz.org logs in through MetaBrainz OAuth2, so the script uses a browser session:
log in as vrana_bot at https://musicbrainz.org and copy the `musicbrainz_server_session` cookie.
@vrana
vrana / login-cross-origin.php
Last active September 11, 2026 10:01
Adminer plugin: Accept the login form posted from the listed websites
<?php
/** Accept the login form posted from the listed websites
* The form of another website doesn't have Adminer's CSRF token, e.g. <form action="https://example.com/adminer.php" method="post"> with the fields auth[driver], auth[server], auth[username], auth[password] and auth[db].
* Any page of the listed websites can log the visitor in to a server of its choice, so list only the websites you trust.
* Requires Adminer 6.1.0.
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
@vrana
vrana / adminer-plugins.php
Created August 12, 2026 13:11
Adminer plugin linking the plugins usable in each part of the interface
<?php
/** Link the plugins usable in each part of the interface
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerPlugins extends Adminer\Plugin {
/** @var string[][] plugins printing in the same place, in the name of the hook they print in */
@vrana
vrana / phpdoc-ini-sort.php
Last active April 25, 2025 14:01
Sort ini.xml in phpdoc
<?php
foreach (array_merge(["appendices/ini.core.xml"], glob("reference/*/ini.xml")) as $filename) {
$file = file_get_contents($filename);
$file = preg_replace_callback('~(&Changelog;</entry>\s*</row>\s*</thead>\s*<tbody[^>]*>)(.*</row>)(\s*</tbody>)~sU', function ($match) {
preg_match_all('~.+</row>~sU', $match[2], $matches);
$rows = $matches[0];
usort($rows, function ($a, $b) {
return ltrim(strip_tags($a)) <=> ltrim(strip_tags($b));
});
return $match[1] . implode($rows) . $match[3];
<?php
/**
* Adminer plugin that display the first CHAR/VARCHAR column of the foreign key
*
* @category Plugin
* @link http://www.adminer.org/plugins/#use
* @author Bruno VIBERT <http://www.netapsys.fr>
* @modified by Peter Hostačný <hostacny.peter AT gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
@vrana
vrana / readable-dates.php
Last active March 16, 2025 06:40 — forked from scr4bble/readable-dates.php
Adminer plugin that replaces UNIX timestamps with human-readable dates.
<?php
/** This plugin replaces UNIX timestamps with human-readable dates in your local format.
* Mouse click on the date field reveals timestamp back.
*
* @link https://www.adminer.org/plugins/#use
* @author Anonymous
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
@vrana
vrana / import-from-dir.php
Last active March 16, 2025 06:40 — forked from Roy-Orbison/import-from-dir.php
Import any .sql[.gz] file, from a specifiable directory, rather than only the default adminer.sql[.gz], with Adminer.
<?php
/**
* Import SQL files from a directory
*
* @author joshcangit, https://github.com/joshcangit
* @author Roy-Orbison, https://github.com/Roy-Orbison
*/
class AdminerImportFromDir {
@vrana
vrana / restore-menu-scroll.php
Last active March 16, 2025 06:40 — forked from NoxArt/restore-menu-scroll.php
AdminerRestoreMenuScroll plugin for Adminer
<?php
/** Remembers and restores scollbar position of side menu
* @author Jiří @NoxArt Petruželka, www.noxart.cz
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerRestoreMenuScroll {
protected $script;
<?php
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
/**
* Uses symfony's var-dumper for pretty treeview of decoded json in table and edit view.
* needs symfony/var-dumper, install with:
@vrana
vrana / php-serialized-column.php
Last active July 30, 2025 15:41 — forked from donwilson/php-serialized-column.php
PHP Serialized Data previewer in Adminer Editor
<?php
/** Display PHP serialized values as table in edit. Using Jakub Vrana and Martin Zeman's JSON Adminer plugin (https://raw.githubusercontent.com/vrana/adminer/master/plugins/json-column.php) as a skeleton for this plugin.
* @link https://www.adminer.org/plugins/#use
* @author Don Wilson, https://pyxol.com/
* @author Jakub Vrana, https://www.vrana.cz/
* @author Martin Zeman (Zemistr), http://www.zemistr.eu/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerPHPSerializedColumn {