Skip to content

Instantly share code, notes, and snippets.

@JackNoordhuis
JackNoordhuis / ListLatestMcVersions.php
Created March 4, 2018 04:31
A PHP script for fetching the latest Minecraft: Bedrock Edition releases from the app store.
<?php
$result = json_decode(getURL("https://itunes.apple.com/au/app/minecraft/id479516143?dataOnly=true"), true);
for($i = 0, $count = count($result["pageData"]) - 1; $i < $count; ++$i) {
$info = $result["pageData"]["versionHistory"][$i];
$releaseTime = new \DateTime($info["releaseDate"], new \DateTimeZone("Australia/Sydney"));
printf("Minecraft: PE version %s, released on %s" . PHP_EOL . PHP_EOL, $info["versionString"], $releaseTime->format("l\\, jS \\o\\f F Y"));
}
@JackNoordhuis
JackNoordhuis / script.js
Last active March 3, 2018 05:32
script for automatically playing http://game.notch.net/drowning/
let lastStuffTime = 0;
let lastMoveOnTime = 0;
let lastProjectTime = 0;
let lastWorkTime = 0;
let lastJobChangeTime = 0;
setInterval(function() {
let equipment = document.getElementById("equipment");
let equipmentList = equipment.innerHTML.split("<br>");
let equipmentContents = {};
@JackNoordhuis
JackNoordhuis / extract.php
Created February 26, 2018 03:17
PHP script to convert a phar archive to a zip
<?php
$opts = getopt("", ["file:"]);
if(!isset($opts["file"])) {
echo "Please specify a path with --path" . PHP_EOL;
exit(0);
}
$filename = rtrim($opts["file"], ".phar");
@JackNoordhuis
JackNoordhuis / GenerateAliases.php
Created October 8, 2017 09:50
Script to quickly generate an aliases.php stub file for the Laravel Framework
<?php
/*
* Script to quickly generate the aliases.php stub file
*/
$root_path = realpath(__DIR__ . "/../../.."); // path to the project root directory
$config = preg_replace("/\s+/", "", file_get_contents($root_path . "/config/app.php")); // get the app config and strip all white space
@JackNoordhuis
JackNoordhuis / data_flag-debug.php
Created September 26, 2017 14:41
PHP script to help debug MCPE data flag values
<?php
$flagsTypes = [ // MCPE protocol 120 data flag types
0 => "on fire",
1 => "sneaking",
2 => "riding",
3 => "sprinting",
4 => "action",
5 => "invisible",
6 => "tempted",
@JackNoordhuis
JackNoordhuis / garry.php
Created August 10, 2017 08:42
hold this L boi
<?php
Class Gary extends YouTuber {
private $isSnail = false;
private $hasClickbaitContent = false;
public function setIsSnail(bool $value = true) {
$this->isSnail = $value;
}
<?php
/*
* Data in the form of: x y z\nx y z
*/
$data =
'384 1 -71
383 1 -26
384 1 25
383 1 70
480 1 -71
@JackNoordhuis
JackNoordhuis / packets.json
Last active April 26, 2017 07:41
Extropy packet definitions
{
"Login": {
"protocols": {
"107": {
"pid": "0x01",
"canBatch": false,
"canSendBeforeLogin": true,
"minecraft-versions": [
"1.0.7.0"
],
@JackNoordhuis
JackNoordhuis / gist:fe75b6f008531c785642bffc7dd9666b
Created March 24, 2017 14:06
Fri_Mar_24-17.54.37-EDT_2017.log
PocketMine-MP Crash Dump Fri Mar 24 17:54:37 EDT 2017
Error: Call to a member function addEntityMovement() on null
File: /src/pocketmine/Player
Line: 1468
Type: notice
Code:
[1459] if(!$isFirst){
[1460] $ev = new PlayerMoveEvent($this, $from, $to);
@JackNoordhuis
JackNoordhuis / Usage.txt
Last active February 8, 2018 12:28
Simple bash script to install PocketMine straight from GitHub
Usage:
Install source: ./github-installer.sh
Install compiled server Phar without source: ./github-installer.sh --compile --no-source
Install DevTools and compiled server Phar with source: ./githubinstaller.sh --devtools --compile
Install DevTools and compiled server Phar without source: ./github-installer.sh --devtools --compile --no-source