Instantly share code, notes, and snippets.

View addflags.md

Code

Here are two simple CMake functions that take a list of compiler flags, and append those that do not result in an error when used to the supplied variable.

Depending on which version of CMake you need to support, you might want to look into the COMPILE_FLAGS property and target_compile_options().

View keybase.md

Keybase proof

I hereby claim:

  • I am jibsen on github.
  • I am jibsen (https://keybase.io/jibsen) on keybase.
  • I have a public key ASBJFqcNi9bAVw4V_73447FOIVgYGFntsTMQGHvjIAKKkgo

To claim this, I am signing this object:

View buildtime.md

About

These are timings for cloning the [squash][] repository including submodules, running [CMake][] to generate makefiles, and building the project in debug mode.

All toolsets run on the same machine (Core i5, 8 GB, Win10 64):

View bytes.md

Introduction

The C standard only specifies minimum limits for the values of character types and standard integer types. This makes it possible to generate efficient code on diverse architectures, but can pose problematic if your code expects the limits to match your development platform, or if you have to do low-level things.

Before C99, the usual way to solve this was to use typedef to declare synonyms

View bsort32.asm
;;
;; The "worlds smallest" bubble sort (16 bytes)
;;
;; Copyright (c) 1998 by Joergen Ibsen / Jibz
;; All Rights Reserved
;;
bits 32
section .text
View srgbtogenericrgb.py
#!/usr/bin/env python3
# Copyright (c) 2014 Joergen Ibsen
#
# 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:
View pastry.py
#!/usr/bin/env python3
# Copyright (c) 2014 Joergen Ibsen
#
# 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:
View concol.c
/*
* Console Color
*
* Copyright (c) 2005 Joergen Ibsen
*
* 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
View coordsort.c
#include <stdlib.h>
#include <stdio.h>
#include "scv.h"
struct point {
int x;
int y;
};