Skip to content

Instantly share code, notes, and snippets.

View osvein's full-sized avatar

Oskar Sveinsen osvein

  • Norway
View GitHub Profile
;/ DrinkFromWaterFountainScript for Finite Water
/ Copyright (c) 2017 Oskar Sveinsen
/
/ Permission is hereby granted, free of charge, to any person obtaining a copy
/ of this software and associated documentation files (the "Software"), to deal
/ in the Software without restriction, including without limitation the rights
/ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/ copies of the Software, and to permit persons to whom the Software is
/ furnished to do so, subject to the following conditions:
/
export PROJECTFILE ?= $(realpath Project)
CHILDREN ?= $(sort $(dir $(wildcard */Makefile.custom) $(wildcard */Makefile)))
CHILDCARD ::= $(addsuffix %,$(CHILDREN))
%: $(CHILDCARD)
$(CHILDCARD):
dir = ${$@%%/*}
cd $dir
reltarget = ${$@#*/}
( test -f Makefile.custom\
#include "parser.h"
/* general */
Nonterminal n_doc_string = {
PROD_LEAF(t_bracket_curly_closing),
PROD(NULL, n_doc_string),
};
Nonterminal n_doc = {
/* pas - papyrus assembler
* Copyright (C) 2017 Oskar Sveinsen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define FORDICE(n) for (dice[n] = 1; dice[n] <= 6; dice[n]++)
typedef uint_least8_t Score;
typedef uint_fast8_t Die;
Die dice[5];
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "arg.h"
static void
usage(void)
{
printf(stderr, "usage: %s [-b base] [-l length]", argv0);
@osvein
osvein / table.awk
Last active May 13, 2022 23:40
Render delimiter-separated values (e.g. CSV, TSV)
#!/usr/bin/awk -f
# table.awk - render [delimiter-separated values](https://en.wikipedia.org/wiki/Delimiter-separated_values)
# Example usage:
# awk -F , table.awk input.csv
# awk -F "\t" table.awk input.tsv
# ./table.awk FS=, input.csv
# ./table.awk FS="\t" input.tsv
NR == 1 && ARGV[ARGC - 1] == FILENAME { ARGV[ARGC++] = FILENAME; }
@osvein
osvein / isa2
Last active October 15, 2017 15:50
*RobCore*
+-------------------------------+-----+---+---+---+
| MSB LSB | ASM |arg|pop|psh|
+---+---+---+---+---+---+---+---+-----+---+---+---+
| | | | 0 | 0 | 0 | 0 | 0 | ADD | 0 | 2 | 1 |
| | | | | | | | 1 | INC | 0 | 1 | 1 |
| | | | | | | 1 | 0 | SUB | 0 | 2 | 1 |
| | | | | | | | 1 | DEC | 0 | 1 | 1 |
| | | | | +---+---+---+-----+---+---+---+
| | | | | | 1 | 0 | 0 | MUL | 0 | 2 | 1 |
| | | | | | | | 1 | MUL | 0 | 2 | 1 |
@osvein
osvein / posix-linker.user.js
Created October 1, 2017 12:53
GreaseMonkey userscript to add some missing links from XBD header pages to XSU function pages in the online POSIX standard viewer
// ==UserScript==
// @name posix-linker
// @namespace https://github.com/osvein
// @description adds some missing links from XBD header pages to XSU function pages in the online POSIX standard viewer
// @include http://pubs.opengroup.org/onlinepubs/9699919799/
// @version 1
// @grant none
// ==/UserScript==
var frame = document.getElementById('main');
@osvein
osvein / gist-init.sh
Last active September 25, 2017 18:40
#!/bin/sh
public="true"
desc=
host="api.github.com"
port="443"
endpoint="/gists"
repourl="https://gist.github.com"
creds="url=$repourl
"