Skip to content

Instantly share code, notes, and snippets.

View alvin0319's full-sized avatar

alvin0319

View GitHub Profile
@alvin0319
alvin0319 / specifications.md
Created February 7, 2022 14:05
Specifications and explanations for implementing custom items on the server
@Muqsit
Muqsit / WeightedRandom.php
Last active May 16, 2024 22:39
Weighted random in PHP with O(1) runtime complexity (Alias Method)
<?php
declare(strict_types=1);
use pocketmine\utils\Binary; // https://github.com/pmmp/BinaryUtils
use pocketmine\utils\Random; // https://github.com/pmmp/PocketMine-MP/blob/60938c8c9df4bf21d096f142c6579dfad92eb8c2/src/utils/Random.php
/**
* @phpstan-template T
*/
@nchaigne
nchaigne / build-gcc-9.2.0-on-centos7.md
Last active June 23, 2024 08:47
Building GCC 9.2.0 on CentOS 7

Building GCC 9.2.0 on CentOS 7

Introduction

CentOS 7 distribution (as well as RHEL 7) ships with a somewhat outdated version of the GCC compiler (4.8.5 on CentOS 7.5), which may not be suitable to your compilation requirements. For example, C11 - which supersedes C99 - is fully supported only starting from GCC 4.9).

Additionally, recent versions of GCC (GCC6, GCC7, GCC8, GCC9) come with improvements which help detect issues at build time and offer suggestions on how to fix them. Sometimes, these are even actually helpful!

This note describes how to build the latest GCC (9.2.0 as of October 2019) from sources on CentOS 7. This should be applicable as is on RHEL 7. For other Linux distributions, adapt as needed.

@gskema
gskema / noinspection.php
Last active July 2, 2024 14:06
PhpStorm @noinspection list of all tags
<?php
/** @noinspection ? */
// PhpUndefinedGotoLabelInspection Undefined goto label
// PhpUndefinedVariableInspection Undefined variable
// PhpUndefinedMethodInspection Undefined method
// PhpUndefinedNamespaceInspection Undefined namespace
// PhpUndefinedClassInspection Undefined class
// PhpUndefinedFunctionInspection Undefined function