Skip to content

Instantly share code, notes, and snippets.

@jhead
jhead / cleanup.php
Last active December 28, 2015 20:38
<?php
require_once("_api/init.php");
global $MCApi, $DB;
$result = $MCApi->listServers();
if ($result['success'] != 1) die('Unable to fetch server list.');
$servers = $result['data']['Servers'];
foreach ($servers as $id => $serverName) {
if (strpos($serverName, "InstantMC - ") !== 0) {
@jhead
jhead / gist:6057224
Last active December 20, 2015 02:29
<?php
function pingNetwork($hostname, $port = 25565) {
$packet = "\xFE\x01";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
try {
$sConnectStatus = @socket_connect($socket, $hostname, $port);
if (!$sConnectStatus) return false;
$sWriteStatus = @socket_write($socket, $packet, strlen($packet));
/**
* Multi-threaded matrix multiplication.
* @param a a matrix
* @param b another matrix
* @return The resulting matrix-multiplied matrix
*/
public static int[][] multiplyMatrix(final int[][] a, final int[][] b) {
ExecutorService exec = Executors.newFixedThreadPool(9);
List<Callable<Object>> tasks = new LinkedList<>();
final int[][] result = new int[3][3];
package echo.client.gl;
import echo.core.geom.Vector;
import lombok.Getter;
import lombok.Setter;
public class VertexVector extends Vector implements VertexAttribute {
public static final int ELEMENT_SIZE = 4;