This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function torrent_scrape($torrent_id) { | |
$times['start'] = microtime(1); | |
$times['last'] = microtime(1); | |
$torrents = torrent_get(get_str_build(array('extended' => '', 'torrent_id' => $torrent_id))); | |
$times['query'] = microtime(1) - $times['last']; | |
$times['last'] = microtime(1); | |
// Return if the torrent_id doesn't exist | |
if (!isset($torrents) || !is_array($torrents) || !count($torrents)) { return; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcj@mini:~/mineserver/config$ cat default.cfg | |
# Network options | |
core.net.host = "192.168.0.1"; | |
core.net.port = "25565"; | |
core.name = "My test server!"; | |
# Plugins | |
core.plugins += ("kit", "admin", "chat"); | |
# Kits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/trxlogger.cpp b/src/trxlogger.cpp | |
index 956d01b..ef352d6 100644 | |
--- a/src/trxlogger.cpp | |
+++ b/src/trxlogger.cpp | |
@@ -34,6 +34,7 @@ | |
#include <string> | |
#include <time.h> | |
#include <vector> | |
+#include <cstring> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class R> struct functor0 { typedef R (*type)(); }; | |
template <class R, class A0> struct functor1 { typedef R (*type)(A0 a0); }; | |
template <class R, class A0, class A1> struct functor2 { typedef R (*type)(A0 a0, A1 a1); }; | |
template <class R, class A0, class A1, class A2> struct functor3 { typedef R (*type)(A0 a0, A1 a1, A2 a2); }; | |
template <class R, class A0, class A1, class A2, class A3> struct functor4 { typedef R (*type)(A0 a0, A1 a1, A2 a2, A3 a3); }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------- | |
What I've got | |
-------- | |
Hook< functor2<int,int,int> >* hook = new Hook< functor2<int,int,int> >; | |
hook->addCallback((functor2<int,int,int>::ftype)&multiply); | |
hook->addCallback((functor2<int,int,int>::ftype)&add); | |
printf("We have %d callback(s)\n\n", hook->numCallbacks()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int load_plugin(char* location) | |
{ | |
void *lhandle = NULL; | |
void (*fhandle)() = NULL; | |
std::cout << "Loading plugin " << location << "\n"; | |
lhandle = dlopen(location, RTLD_LAZY); | |
if (lhandle == NULL) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MC_COLOR_BLACK std::string("§0") | |
#define MC_COLOR_DARK_BLUE std::string("§1") | |
#define MC_COLOR_DARK_GREEN std::string("§2") | |
#define MC_COLOR_DARK_CYAN std::string("§3") | |
#define MC_COLOR_DARK_RED std::string("§4") | |
#define MC_COLOR_DARK_MAGENTA std::string("§5") | |
#define MC_COLOR_DARK_ORANGE std::string("§6") | |
#define MC_COLOR_GREY std::string("§7") | |
#define MC_COLOR_DARK_GREY std::string("§8") | |
#define MC_COLOR_BLUE std::string("§9") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <iostream> | |
#include <cstdio> | |
#include <cstring> | |
#include <htmlcxx/html/ParserDom.h> | |
#include <htmlcxx/html/utils.h> | |
int main(int argc, char** argv) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling mineserver.cpp | |
hook.h: In member function ‘bool Hook9<R, A1, A2, A3, A4, A5, A6, A7, A8, A9>::doUntilTrue(char*) [with R = void, A1 = User*, A2 = int, A3 = signed char, A4 = int, A5 = int, A6 = signed char, A7 = int, A8 = short int, A9 = short int]’: | |
mineserver.cpp:446: instantiated from here | |
hook.h:1315: warning: ‘signed char’ is promoted to ‘int’ when passed through ‘...’ | |
hook.h:1315: note: (so you should pass ‘int’ not ‘signed char’ to ‘va_arg’) | |
hook.h:1315: note: if this code is reached, the program will abort | |
hook.h:1318: warning: ‘signed char’ is promoted to ‘int’ when passed through ‘...’ | |
hook.h:1318: note: if this code is reached, the program will abort | |
hook.h:1320: warning: ‘short int’ is promoted to ‘int’ when passed through ‘...’ | |
hook.h:1320: note: if this code is reached, the program will abort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from mineserver.cpp:55: | |
In file included from ./mineserver.h:43: | |
In file included from ./plugin.h:49: | |
./hook.h:1032:11: error: invalid argument type 'void' to unary expression | |
if (!((ftype)*ia)(a1, a2, a3, a4, a5, a6, a7)) | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
./hook.h:1051:12: note: in instantiation of member function 'Hook7<void, User *, int, signed char, int, int, signed char, int>::doUntilFalse' requested here | |
return doUntilFalse(a1, a2, a3, a4, a5, a6, a7); | |
^ |
OlderNewer