Skip to content

Instantly share code, notes, and snippets.

@fami-com
fami-com / oop.c
Last active May 2, 2023 02:22
C OOP proof of concept (very bad, don't actually use in real life)
// All of this is licensed under the CC0 licence btw
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#define S_(class, func, ...) _##class##_##func(__VA_ARGS__)
#define S(class, func, ...) S_(class, func __VA_OPT__(,) __VA_ARGS__)
#define new(class, ...) S(class, new, __VA_ARGS__)
@fami-com
fami-com / eca.asm
Created May 2, 2020 21:38
An implementation of an elementary cellular automaton (Rule 30/90/110/arbitrary) in fasm for windows.
format PE64 CONSOLE
entry start
include 'win64a.inc'
section '.data' data readable writeable
State dq 0x0000000100000000
String db 65 dup(0)
Rule db 30
@fami-com
fami-com / genlist.h
Last active January 22, 2020 21:37
Generic linked list in C
#ifndef LIST_H
#define LIST_H
#ifndef ALLOC
#define ALLOC malloc
#endif
#define _CREATE_LIST_TYPE(type, name, prefix)\
typedef struct List_##name List_##name;\
struct List_##name {\

Keybase proof

I hereby claim:

  • I am fami-com on github.
  • I am famicom (https://keybase.io/famicom) on keybase.
  • I have a public key whose fingerprint is B082 D8BD 1A98 9905 40A2 3DDE 9C40 FFAD CD1C 5690

To claim this, I am signing this object:

@fami-com
fami-com / uchar.c
Last active May 22, 2021 13:49
A simple UTF-8/16/32 encoder/decoder
/* Licensed under the CC0 license */
#include <stdint.h>
#include <string.h>
#define INVALID_CODEPOINT -1
#define UNPAIRED_SURROGATE -2
int utf32_to_utf8(uint32_t ch, uint8_t **out)
{
int len = 0;
@fami-com
fami-com / koi
Last active May 17, 2016 18:09
#!/usr/bin/env bash
# enkoi - encode a text from cp1251 to koi8-r
# options: -e switch to encode mode
# -d switch to decode mode
# licensed under the terms of MIT license
#
version="0.1"
function helpexit ()
{

####IEEE Std 1003.1-2008 utilities

Name Category Description First appeared
admin SCCS Create and administer SCCS files PWB UNIX
alias Misc Define or display aliases
ar Misc Create and maintain library archives Version 1 AT&T UNIX
asa Text processing Interpret carriage-control characters System V
at Process management Execute commands at a later time Version 7 AT&T UNIX
awk Text processing Pattern scanning and processing language Version 7 AT&T UNIX
basename Filesystem Return non-directory portion of a pathname; see also dirname Version 7 AT&T UNIX