Skip to content

Instantly share code, notes, and snippets.

View lighth7015's full-sized avatar
Perpetually exhausted.

Robert Butler lighth7015

Perpetually exhausted.
View GitHub Profile
@lighth7015
lighth7015 / queue-listener.c
Created February 13, 2019 17:14
System V Message Queue Listener
/*
* Copyright (c) 2009-2012 Niels Provos, Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@lighth7015
lighth7015 / Console
Created February 13, 2019 19:53
Attempting to write my own gruntfile
[robert_@mc01 laranuxt]$ npx grunt -vvvvv -d=3 test
Initializing
Command-line options: --verbose, --debug=3
Reading "gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
@lighth7015
lighth7015 / xcb.cpp
Created February 26, 2019 01:47
Basic XCB UI utilizing C++ and CRTP
#include <iostream>
#include <string.h>
#include <xcb/xcb.h>
template <typename Child>
class Window
{
protected:
xcb_drawable_t handle;
xcb_gcontext_t context;
This file has been truncated, but you can view the full file.
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB28AAAdqCAYAAABelCTeAAAgAElEQVR4nOzd53tTZ77we0mrSnKj907anPM3nL2nBEgjIYGEGgjNvQHGBts0Y2wDtqlJyEwqNSQkk55Jn0zqTDKTSSaFajruNphmS2t9z4t7aalYMnaG7NnP9fDic2lpSca2ArKjr3737djmgBtuuOGGG2644YYbbrjhhhtuuOGGG2644YYbbrjhhhtuuOGGG/6zHNsc8Nw4rduevV2NKtb9d43Tu2X3eLdFu6Y9E/SgOzT23KGy907F9vydKs/fpbD/bpUX71J58S6FA3cLL9+j8MeJwisTZV67V+K1eyXeuE/izUku3pzk4q1JLt6a5OCtSQ7enuTknfukTt6dJPPu/TLv3q/w7iSZdyZJvDNJ5r37XHwwyRnVh5OcfHi/i48ekPjwfhcf3u/i/UkO3r9feG+Sg/fuC3p/ksO+/YMQH0528NEUBx8/6OQvD0p8OtXFpw+5+GSKg08fEj6f6uTLaS7+Ot3FVzOcXZvu6ORv04S/T3PwjxlOvpnh4ttZMt/NkvnuYYV/zVb5YbbKj7NVfpoj89McmYNzJQ7Nkzk0T+HwfJXD8xUOz5eFBRKHF0gcWSBxbH5QzQKZ4wsVTiSrHF8gU2M5Nl/iyFwnh+c4OThb4seHXXw/w8G30x18O8PBP2c6+GaWg28edvDNbAffzHbyzRwn38xx8e0cF989IvH9IxI/PKLw41yZg/NkjizUOZKscTRZ5dhCjWPJGjXJGieSdU6kaJxIVjmxUOX4QoXjCxWOzZdDvtbg8fFkiZoUF8dTJU6myZxKlzmVrnA6Ve7kTKrE6TSZU+ni8nSazKk0mVOpCqdSZE4kyxxfKHF8gUTNQtl6DBRqkmVqkmWOW06kiPufTpU5k6ZwLkOlNlOlIUujZZHO+SUq55dotOXpXMoXLue7uZKvhbmar9FeoHI1X6XdcjVf4epShSt5MpeWSFwOyJO4ul
@lighth7015
lighth7015 / factory.cpp
Created March 16, 2019 23:26
Auto-registration factory
#include <cassert>
#include <functional>
#include <iostream>
#include <memory>
#include <unordered_map>
#include <utility>
/**
* Portions of this code adapted from https://stackoverflow.com/a/42191109/201787
*/
@lighth7015
lighth7015 / packet.c
Created March 21, 2019 20:14
AOL packet parser
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
const uint8_t* packet = (const uint8_t *)
"5A413800347F7FA3036B0100F5000000050F00002152CBCA070A1000080400000000035F0000010004000300080000000000000000000000020D";
@lighth7015
lighth7015 / type.c
Created March 22, 2019 20:02
Object type system
#define _GNU_SOURCE
#define STATIC_DECLARE_INIT(sym, name, id, ...) \
sym __attribute__ ((section (id))) name = { __VA_ARGS__ };
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
$ clang -nostdlib -fno-{stack-protector,jump-tables,addrsig,builtin} -ffreestanding -I../include -oexample.com -Wall \
-Wextra -pedantic -mregparm=3 -std=c99 -Oz -m16 -march=i386 -Wl,--omagic,--script=../lib/doscom.ld -fuse-ld=bfd main.c \
../lib/libdos.a
/usr/bin/ld.bfd: /tmp/main-de9979.o: in function `main':
main.c:(.text+0x20): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(doscrt0.o): in function `argstart':
doscrt0.c:(.text+0x1b): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `_getcinfo':
conio.c:(.text+0xf): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `setpage':
@lighth7015
lighth7015 / stdin
Created March 29, 2019 20:17
stdin
/usr/bin/ld.bfd: /tmp/main-12cd4f.o: in function `main':
main.c:(.text+0x20): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(doscrt0.o): in function `argstart':
doscrt0.c:(.text+0x1b): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `_getcinfo':
conio.c:(.text+0xf): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `setpage':
conio.c:(.text+0x56): undefined reference to `_GLOBAL_OFFSET_TABLE_'
/usr/bin/ld.bfd: ../lib/libdos.a(conio.o): in function `getpage':
conio.c:(.text+0xa6): undefined reference to `_GLOBAL_OFFSET_TABLE_'
const MyComponent = {
PostOffice: {
PaymentAuthorization: {
fromEcho: true,
isPublic: false
},
"Foo": "Bar",
},