Skip to content

Instantly share code, notes, and snippets.

View ranisalt's full-sized avatar
🦊

Ranieri Althoff ranisalt

🦊
View GitHub Profile
include('otinfo.php');
$server = new Otinfo('shadowcores.twifysoft.net'); // a porta é opcional: se omitida, o padrão é 7171
if ($server->execute()) {
echo 'Players online: ', $server->players['online'], '<br />',
'Server location: ', $server->serverinfo['location'], '<br />',
'Client version: ', $server->serverinfo['client'] , '<br />';
//apenas alguns exemplos de dados
} else {
echo 'Server offline';
//se execute() returnar false, o servidor esta offline
}
<?php
include('otinfo.php');
$server = new Otinfo('shadowcores.twifysoft.net');
if ($server->execute()) {
echo 'Players online: ', $server->players['online'], '<br />',
'Server location: ', $server->serverinfo['location'], '<br />',
'Client version: ', $server->serverinfo['client'] , '<br />';
} else {
echo 'Server offline';
}
private static $cache = 180; // tempo em segundos
<?php
if (!defined('IN_IPB')) {
print '<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.';
exit();
}
class Otinfo {
//class that works
}
@ranisalt
ranisalt / gnuplot.cpp
Created June 24, 2014 03:40
Arquivo que não foi
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <sys/time.h>
#include "avl_tree.h"
#include "red_black_tree.h"
class logradouro {
@ranisalt
ranisalt / indenter.lua
Created October 23, 2014 02:45
Lua stuff
function cleanPreviousIndentation(line)
return line:gsub("^%s+", ""):gsub("%s+$", "")
end
function escapeString(str)
return str:gsub("[()]", "%%%1")
end
function string:split(delimiter)
local array = {}
@ranisalt
ranisalt / quicksort.py
Created November 3, 2014 17:03
Quicksort funcional
def quicksort(l):
if len(l) == 0:
return l
pivot = l.pop()
return quicksort([x for x in l if x < pivot]) + [pivot] + quicksort([x for x in l if x >= pivot])
from builtins import KeyError
import string
class Steckerbrett:
def __init__(self, *args):
self.map = {}
for arg in args:
if arg[0] in self.map or arg[1] in self.map: