A metatable can be defined like
local t = setmetatable({}, {
__tostring = function() return 'custom tostring behavior!' end
})Here are the metamethods that you can define, and their behavior
| // [src] https://www.scs.stanford.edu/~dm/blog/va-opt.html | |
| // | |
| // gcc enum.c | |
| // clang enum.c | |
| // cl enum.c /Zc:preprocessor | |
| #define PARENS () | |
| // Rescan macro tokens 256 times | |
| #define EXPAND(arg) EXPAND1(EXPAND1(EXPAND1(EXPAND1(arg)))) |
| // [src] https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/toosimple.html | |
| #include <stdio.h> | |
| int main() { | |
| double sum = 0.0, flip = -1.0; | |
| for (long i = 1; i <= 10000000; ++i) { | |
| sum += (flip *= -1.0) / (2*i - 1); | |
| } | |
| printf("%.24f\n", sum*4.0); | |
| } |
| // generic A* pathfinding | |
| // | |
| // INTERFACE | |
| // | |
| // mandatory macros | |
| #ifndef ASTAR_POS_TYPE | |
| #error ASTAR_POS_TYPE should specify position type |
| dumpbin /exports any.dll > any.def | |
| lib /def:any.def /out:any.lib /machine:x64 |
| // useful code snippets gathered from the network (via phillip trudeau) | |
| static float euclidean_mod(float x, float y) { return x - floorf(x / y) * y; } | |
| static bool rect_is_onscreen(RECT rect) { return (MonitorFromRect(&rect, MONITOR_DEFAULTTONULL) != NULL); } | |
| static bool window_is_onscreen(HWND hwnd) { return (MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL) != NULL); } | |
| // Win32: Set the window icon for every window in your app (including MessageBox() calls and assertion failures) instead of just your primary window. | |
| static LRESULT set_window_icon_callback(int type, WPARAM wparam, LPARAM lparam) { | |
| if (type == HCBT_CREATEWND) { | |
| HANDLE instance_hdl = GetModuleHandleA(NULL); |
| /* This file defines all 2136 Japanese Jōyō kanji (常用漢字) | |
| with the unicode codespoints formatted to fit Nuklear's font config. | |
| #include it as part of the nk_runes definition as shown below. | |
| Don't forget the 0 at the end of the array, as this file doesn't define it. | |
| */ | |
| /* Usage example, incased in #if 0 to allow comments inside comments */ | |
| #if 0 | |
| static |
| import numpy as np | |
| def sigmoid(x): | |
| return 1 / (1 + np.exp(-x)) | |
| def neural_network(X, y): | |
| learning_rate = 0.1 | |
| W1 = np.random.rand(2, 4) | |
| W2 = np.random.rand(4, 1) |
cd /your-folder && chmod a+x ./your-binarygdb --args ./your-binary [args...]. Or gdb -tui --args ./your-binary [args...] for terminal UI.gdb -ex r --args ./your-binary [args...] to run it automatically.b function or b file:line or b class:function to set breakpointsr to run or restart executions to step in executionn to step out executionc to continue execution| # source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list | |
| # A list of available STUN server. | |
| stun.l.google.com:19302 | |
| stun1.l.google.com:19302 | |
| stun2.l.google.com:19302 | |
| stun3.l.google.com:19302 | |
| stun4.l.google.com:19302 | |
| stun01.sipphone.com | |
| stun.ekiga.net |