Skip to content

Instantly share code, notes, and snippets.

Jørgen Ibsen jibsen

Block or report user

Report or block jibsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jibsen
jibsen / coordsort.c
Last active Dec 25, 2015
A simple example that reads integer coordinates in the form x,y into a scv_vector and prints them in lexicographical order.
View coordsort.c
#include <stdlib.h>
#include <stdio.h>
#include "scv.h"
struct point {
int x;
int y;
};
@jibsen
jibsen / concol.c
Created Dec 2, 2013
Simple example of printing text in color to a Windows console window. Most interesting bit is probably con_wait_key, which works for most keys including Esc.
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
@jibsen
jibsen / pastry.py
Created Sep 17, 2014
Copy lines to clipboard one at a time
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:
@jibsen
jibsen / srgbtogenericrgb.py
Created Oct 22, 2014
Example of converting RGB colors from sRGB to Generic RGB
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:
@jibsen
jibsen / bsort32.asm
Created Nov 15, 2015
Bubble sort in 16 bytes of x86 assembly language
View bsort32.asm
;;
;; The "worlds smallest" bubble sort (16 bytes)
;;
;; Copyright (c) 1998 by Joergen Ibsen / Jibz
;; All Rights Reserved
;;
bits 32
section .text
@jibsen
jibsen / bytes.md
Last active Dec 30, 2018
Ramblings about uint8_t and undefined behavior
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

@jibsen
jibsen / buildtime.md
Created Apr 6, 2016
Comparing clone and build time between native Windows and Linux VM
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 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:

@jibsen
jibsen / addflags.md
Created Jun 10, 2016
CMake functions to add compiler flags
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().

You can’t perform that action at this time.