Bootstrap script to quickly test anything

File: pub/script.php

<?php
use Magento\Framework\App\Area;
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/../app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
/** @var \Magento\Framework\App\State $state */
$state = $obj->get(\Magento\Framework\App\State::class);
$state->setAreaCode(Area::AREA_FRONTEND);

// do something

Execute it via browser by navigating to localhost/script.php