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
#include "base.h"
#include "application.h"
MainApplication app;
MainApplication::MainApplication(const char* caption)
: Fl_Double_Window(640, 480, caption)
, menubar( 0, 0, 480, menuHeight)
, workspace( 0, 0, 280, 60, "")
{
@lighth7015
lighth7015 / test.c
Last active February 11, 2020 10:43
FindWindow()
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <xcb/xcb.h>
const char hPropName[] = "HWND";
@lighth7015
lighth7015 / mditest.cpp
Created February 10, 2020 04:10
MDI Test
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/scrolwin.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/frame.h>
#include <wx/aui/aui.h>
import re, os.path as path
class Makefile(object):
def __init__(self, filename):
if path.exists(filename):
self.handle = open(filename)
def get(self, name, default = None):
value = default
@lighth7015
lighth7015 / ProcessorInfo.py
Last active February 7, 2020 17:16
ProcessorInfo.py
import os.path, re
from typing import List
""" Query processor info (UNIX/win32)"""
isfloat = lambda value: len(tuple(it for it in str(value.strip()).partition('.') if len(it) > 0)) == 3
tofloat = lambda value: float(str(value).strip()) if isfloat(value) else None
tofloatif = lambda value: tofloat(value) or value
class LogicalProcessor(object):
def __init__(self, args) -> None:
self.processor = args.get('processor', '')
@lighth7015
lighth7015 / Makefile
Created February 5, 2020 18:38
Help target
help: ## Display usage and built-in help information.
$(shell printf "echo \"\"")
$(shell printf "echo \" %-20s %s\"" "Giza SDK Help" "Displays usage and built-in help information.")
$(shell printf "echo \"\"")
$(shell printf "echo \" ┌──────────────────────────────────────────────────────────────────────────────┐\"")
$(shell printf "echo \" │ %-76s │\"" "Available Targets:" )
$(shell printf "echo \" ├──────────────────────────────────────────────────────────────────────────────┤\"")
for target in $(MAKE_TARGETS); do \
echo "$${target}"; \
@lighth7015
lighth7015 / Makefile
Created February 4, 2020 16:52
write-col
EQT:="
# function?
define write-col
$(shell printf $(EQT) printf \"%-$(1)s\"\n$(EQT) $(EQT)$(2)$(EQT)
endef
test:
$(info $(EQT)A $(write-col 12 "foo") B $(EQT))
@lighth7015
lighth7015 / loader.c
Last active February 1, 2020 22:13
ELF loader
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <libelf.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <fcntl.h>
@lighth7015
lighth7015 / elf-module-i386.c
Last active January 30, 2020 00:51
ELF loader
/**
* ELF loadable modules
*
* Architecture-dependend functions for x86.
*
* 12 Feb 2011, Yury Ossadchy
**/
#include "elf-module-private.h"
int elf_module_check_machine(elf_module_t *elf)
@lighth7015
lighth7015 / newvfs.ec
Created January 19, 2020 07:20
WIP: VFS
#define DEFAULT_DIR_MODE S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH // 0755
#define BLOCKSIZE 512
#define BLOCKING_FACTOR 20
#define RECORDSIZE 10240
// file type values (1 octet)
#define REGULAR 0
#define NORMAL '0'
#define HARDLINK '1'