This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The script will keep its place based on a file called min_id, which should contain | |
// the ID of the post after which we should start boosting. If we don't specify an ID, | |
// we'll grab the latest 40 posts and boost them, writing the min_id file as we go | |
// through the list. So if you don't want to potentially duplicate boosts, make sure | |
// a status ID is in that file. | |
// To run this script, you'll need to install PHP. You can do that on an Ubuntu 22.04 box by running | |
// sudo apt install php-cli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ian@fiora:~/Desktop/platform-tools$ telnet 192.168.1.1 5510 | |
Trying 192.168.1.1... | |
Connected to 192.168.1.1. | |
Escape character is '^]'. | |
AT!GSTATUS? | |
AT!GSTATUS? | |
!GSTATUS: | |
Current Time: 1035 Mode: ONLINE | |
System mode: LTE PS state: Attached | |
EMM state: Registered Normal Service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Compares the performance of a trivial typehinted setter with a public typed property | |
define('ITERATIONS', 1_000_000); | |
ini_set('memory_limit', '384M'); | |
$arrays = []; | |
echo "Building data..."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Container implements Psr\Container\ContainerInterface | |
{ | |
protected $s = []; | |
function __set($k, $c) { $this->s[$k]=$c; } | |
function __get($k) { return $this->s[$k]($this); } | |
function get($k) { return $this->s[$k]($this); } | |
function has($k) { return isset($s[$k]); } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
use Ramsey\Uuid\Uuid; | |
// Abstract class using inheritance rather than composition to avoid trait override errors | |
abstract class UuidModel extends Model | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class ModifyExistingEnum extends Migration | |
{ | |
public function up() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/\ |‾‾| /‾‾/ /‾/ | |
/\ / \ | |_/ / / / | |
/ \/ \ | | / ‾‾\ | |
/ \ | |‾\ \ | (_) | | |
/ __________ \ |__| \__\ \___/ .io | |
execution: local | |
output: influxdb=http://influxdb:8086/k6 (http://influxdb:8086) | |
script: /scripts/base.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // works on single-file non-ZIp64 zip files compressed with deflate (AKA a common case), licensed MIT | |
function getLinesFromZippedCSVfromURL(string $url) : \Generator | |
{ | |
$stream = fopen($url, 'rb'); | |
fread($stream, 4 + 2 + 2 + 2 + 2 + 2 + 4); // skip up to compressed size | |
// bindec() was doing weird things, hence converting through hex first | |
// sttrev() to match endian-ness to expectations; zip file values are little-endian |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$eventId = 7021; | |
#$eventId = 7045; #Yorkshire, for testing | |
$comments = json_decode(file_get_contents('https://api.joind.in/v2.1/events/'.$eventId.'/talk_comments?resultsperpage=9999'), true)['comments']; | |
$users = []; | |
foreach ($comments as $comment) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Pretty sure this doesn't clean up on exceptions, so keep that in mind | |
trait With | |
{ | |
abstract protected function enter(...$args); | |
protected function exit($built, ...$initArgs) | |
{ | |
// override this if needed | |
} |
NewerOlder