Skip to content

Instantly share code, notes, and snippets.

View forflo's full-sized avatar

Florian Mayer forflo

  • Erlangen, Germany
View GitHub Profile
##
## 1) Offset is displayed in Hex. 4 Bytes are interpreted at
## once plus each byte is displayed in ASCII with the char "."
## representing every non-printing character. Since my current
## computer runs an intel processor (little endian) the byte order
## is reverse to the hex depiction.
##
hexdump -e '1/4 "[offset:%_ax]) "' -e '1/4 "%08X <-> "' -e '4/1 "%_p "' -e '"\n"'
# example of 1:
@forflo
forflo / gist:9ba502493c2c5772c7d0
Last active August 29, 2015 14:20
Inheritance, Encapsulation, and Classes in LUA
--[[
Multi level inheritance implemented using only
tables and meta tables in lua
The implementation follows the very simple scheme:
class_inheritancelevel_n = {
new = function(self, inh)
new = {}
for k, v in pairs(self) do
#include <stdio.h>
int main(int argc, char **argv){
printf("%0+10.*2$d\n", 2, 5);
printf("%0+10.*2$f\n", 0.32, 3);
printf("%0+10.*2$hhd\n", 127, 5);
printf("%0+10.*2$hhd\n", 129, 5);
printf("%0+10.*2$hhu\n", 255, 5);
printf("%0+20.*2$li\n", 1230010023001203L, 30);
return 0;
#include "dstru_test_types.h"
#include "dstru_types.h"
#include "dstru_defines.h"
#include "dstru_funcs.h"
#include <ffi.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define unlink_large_chunk(M, X) {\
tchunkptr XP = X->parent;\
tchunkptr R;\
if (X->bk != X) {\
tchunkptr F = X->fd;\
R = X->bk;\
if (RTCHECK(ok_address(M, F))) {\
F->bk = R;\
R->fd = F;\
}\
#include "ffi_util.h"
#include "ffi_generate_ops.h"
#include "ffi_node_defines.h"
#include "ffi_generate_ops.h"
#include "ffi_parser_util.h"
#include <stdio.h>
#define DEBUG
const char *TYPE_STRING_TAB[] = { LIST_TYPE(GENERATE_STRING) };
struct * = {
cchar = [5],
cdouble = [255.255],
struct * = {
struct * = {
cdouble = [7431.123],
cchar = [?],
cint = [-123]
},
struct * = {
#include "ffi_parser.h"
#include "ffi_nary_tree.h"
#include "ffi_node_defines.h"
#include "ffi_generate_dot.h"
#include "ffi_generate_ops.h"
#include "ffi_storage.h"
#include "ffi_util.h"
#include <stdlib.h>
#include <stdio.h>
struct * = { // @
cchar = [5], // @->[0]
cdouble = [255.255], // @->[1]
struct * = { // @->[2]
struct * = { // @->[2]->[0]
cdouble = [7431.123], // @->[2]->[0]->[0]
cchar = [?], // @->[2]->[0]->[1]
cint = [-123] // @->[2]->[0]->[2]
}, // --
struct * = { // @->[2]->[1]
#include <stdio.h>
#include <stdlib.h>
struct named {
int dummy1;
char dummy2;
};
struct foo { int a; int b;};