Skip to content

Instantly share code, notes, and snippets.

View msjyoo's full-sized avatar

Michael Yoo msjyoo

View GitHub Profile
@msjyoo
msjyoo / spec.md
Last active August 29, 2015 14:21
The public specification of pocketmine-config.

pocketmine-config

This document describes the public specification of pocketmine-config, a YAML defined file to allow for a state based initialisation of a PocketMine server.

File Format

A pocketmine-config file must be in a YAML format, with a file extension of either .yml or .yaml. The first line of a pocketmine-config file must start with a declaration of #pocketmine-config, followed by the YAML standard trible hyphen to denote the start of a YAML file.

Example:

#pocketmine-config
@msjyoo
msjyoo / README.md
Created July 24, 2015 12:55
A quick gist because this wasn't documented anywher else. How to render and make sense of the MCPE / PocketMine Skin Data

How to use

Basically, this file will take in a binary file of skin.dat and export 3 files: image.png is the skin file, face.png is the face in original size, faceLarge.png is the face in 512x512.

Only supports 64x64 skins for now. If you want 32x64 make appropriate checks.

The PocketMine's (MCPE's) Skin Data Format is in RGBA format, when represented as hex strings they are a stream of 8 characters. Each two characters represent the R, G, B A, and this continues until you have enough data for either a 32x64 image or a 64x64 image. You can also check whether 32x or 64x with the isSlimSkin() flag on the Player object.

Note that A only has 2 values: 0 and 255. They are inverted in the script because PHP.

@msjyoo
msjyoo / gist:437c40e3ad4ec279e79a
Created September 7, 2015 14:36
Ubuntu GNOME 15.04 search domain
It appears the ability to do this has been removed from NetworkManager gui but not from NetworkManager itself. The possible ways to fix this are by using the nm-connection-editor gui, or nmcli.
https://ask.fedoraproject.org/en/question/67752/how-do-i-add-a-search-domain-using-networkmanager/
How to make ODAC sound good on Linux:
Stop messing with ALSA, just use PulseAudio. Turning off PulseAudio is a huge pain, and it's just not worth the effort.
Set sampling format to 24 bit, set sampling quality to maximum. No need to mess with ALSA direct hardware bypass, it's a huge waste of time.
There's nothing that can be done with the current mess that is the Linux audio - set PulseAudio to 24 bits and just listen to music normally.
Seriously, any more configuration is a HUGE waste of bloody time. Stick with PulseAudio, set those two options and get on with your life.
# Block Reddit!
127.0.0.1 reddit.com
127.0.0.1 www.reddit.com
127.0.0.1 pay.reddit.com
127.0.0.1 a.reddit.com
127.0.0.1 b.reddit.com
127.0.0.1 c.reddit.com
127.0.0.1 d.reddit.com
127.0.0.1 e.reddit.com
127.0.0.1 f.reddit.com
@msjyoo
msjyoo / list-of-things-php-static-analyser-inspector.md
Last active November 5, 2015 14:14
List of things a PHP Static Analyser / Inspector must accomplish to truly understand the code.
  • Parse all return types of functions through PHPDoc
  • Parse all return types of functions implicitly through return statements. PHPDocs take precedence.
  • Type polymorphism through if, foreach etc. statements

Object Oriented Programming

  • Inheritance constraints verification
  • Inheritance type check
switch(get_class($node))
{
    case Assign::class:
        /** @var Assign $node */
        $var['name'] = $node->var;
        break;
    case Property::class:
        /** @var Property $node */
 $var['name'] = first($node->props);
<?php
namespace test {
$a = 1;
}
namespace test2 {
var_dump($a++);
}
<?php
namespace test {
$a = 1;
}
namespace test2 {
var_dump($a++);
}
Radar - static indexer - basic inference and parses PHPDocs
Sonar - abstract analyser - deep inference, runs code like an interpreter
Radar does the initial pass, passes the data off to Sonar which interprets the data with information from Radar.
All of this only works in 1 file. After all the indexing is done, a separate process should link the resulting "graphs" together
and report any type errors / non existing functions or class errors?