Skip to content

Instantly share code, notes, and snippets.

View milesrout's full-sized avatar

Miles Rout milesrout

View GitHub Profile
#include <wchar.h>
int main()
{
mbstate_t mbstate;
wchar_t const wcs[] = "\U00000055\U0000006E\U00000069\U00000063\U0000006F\U00000064\U00000065";
wchar_t const* wcsptr = wcs;
char mbs[256];
memset(&mbstate, 0, sizeof mbstate);
namespace trillek {
namespace util {
namespace logging {
namespace detail {
std::unique_ptr<logger> global_logger;
}
}
}
}
int wcsArrayAdd(wchar_t ***array, int *cur_size, wchar_t *item)
{
int new_size = (*cur_size) + 1;
size_t len = wcslen(item);
wchar_t *tmp1 = NULL;
wchar_t **tmp2 = NULL;
/* alloc memory for item */
tmp1 = malloc((len + 1) * sizeof(wchar_t));
if (tmp1 == NULL) {
return ERROR_MEMORY;
The built in firmware of the Trillek computer could:
1) Do a quick check of how much RAM the computer has.
2) Search for devices and store their info in RAM.
3) Set up a monitor and keyboard, getting by default the monitor and keyboard with the lowest slot number.
In future, it could try to get from NVRAM which monitor and keyboard to use.
4) Print basic information about the computer such as total RAM, CPU speed, number of devices found and
hardware info.
5) If there is a floppy drive with a floppy disk, try to boot from it. It there are many, it would use the
floppy drive with the lowest slot.
set nocompatible
set number
set tildeop
" Windows GUI options
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guifont=Source_Code_Pro_Bold:h11b
@milesrout
milesrout / mroutbot.js
Created January 28, 2015 02:29
mroutbot. Written in node.js
var irc = require('irc');
var readline = require('readline');
var util = require('util');
var config = {
channels: ['#project-trillek'],
server: 'irc.freenode.net',
botName: 'mroutbot'
};
@milesrout
milesrout / tinyleaders.py
Last active August 29, 2015 14:15
Find all legendary creatures with a particular colour identity
from itertools import *
colours = 'WUR'
def f(c):
return 'o:{' + str(c) + '}'
def g(c):
return c.lower()
@milesrout
milesrout / gist:c705e1502907358ea856
Created March 23, 2015 12:09
BIS: the Better Instruction Set
BIS: the Better Instruction Set
REGISTERS
---------
sixteen 32-bit general-purpose registers, numbered 0-15
one 16-bit status register
four 16-bit arithmetic condition registers, numbered 0-3
INSTRUCTION FORMAT LEGEND
BIS: the Better Instruction Set
REGISTERS
---------
sixteen 32-bit general-purpose registers, numbered 0-15
one 16-bit status register
four 16-bit arithmetic condition registers, numbered 0-3
INSTRUCTION FORMAT LEGEND
class renderer {
public:
enum class action {
view_add, view_remove, view_activate,
model_matrix_add, model_matrix_remove,
vb_add, vb_remove,
};
private:
static std::atomic<std::queue<std::pair<action, entity_id>>*> global_queue;