Skip to content

Instantly share code, notes, and snippets.

View jacobsebek's full-sized avatar

Jakub Šebek jacobsebek

View GitHub Profile
@Henje
Henje / papers_please_fix.cpp
Last active February 28, 2023 23:10
Simple hack to disable joystick scanning and remove stutters from Papers Please.
#include <string>
#include <dlfcn.h>
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
using namespace std::literals;
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 8, 2024 17:59
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@lynn
lynn / lojban-thesaurus.md
Last active March 1, 2024 15:34
A semantically sorted list of Lojban root words

Lojban Thesaurus

Translated to Markdown from this ancient TeX file. I’m not sure who made the original.

Hover over a link to see the place structure. Click it to view gismu info on Wiktionary.

1 Structures

1.1 Set, group, mass

@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 23, 2024 13:59
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@bodokaiser
bodokaiser / pool.c
Last active July 3, 2023 13:42
Simplistic thread pool implementation with pthread and libuv QUEUE
#include "queue.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#define THREADS 3
/**
* Task queue.