Skip to content

Instantly share code, notes, and snippets.

View niepiekm's full-sized avatar

Marek Niepiekło niepiekm

View GitHub Profile

Copy of commit message to mpv repo:

stream_libarchive: workaround various types of locale braindeath

Fix that libarchive fails to return filenames for UTF-8/UTF-16 entries. The reason is that it uses locales and all that garbage, and mpv does not set a locale.

Both C locales and wchar_t are shitfucked retarded legacy braindeath. If the C/POSIX standard committee had actually competent members, these

What is some existing documentation on Linux memory management?
Ulrich Drepper (the glibc maintainer) wrote an article series called
"What every programmer should know about memory":
Part 1: http://lwn.net/Articles/250967/
Part 2: http://lwn.net/Articles/252125/
Part 3: http://lwn.net/Articles/253361/
Part 4: http://lwn.net/Articles/254445/
Part 5: http://lwn.net/Articles/255364/
@niepiekm
niepiekm / _gitconfig
Last active September 15, 2023 09:29
[user]
name = Marek Niepieklo
email = xxx@yyy.zzz
[alias]
alias = "!f() {[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1}; f"
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
amend = commit --amend -m

Extract from POSA 4

The specific partitioning criteria can be defined along various dimensions, such as abstraction, granularity, hardware distance, and rate of change.

The abstraction dimension

For example, a layering that partitions an architecture into presentation, application logic, and persistent data follows the abstraction dimension.

The granularity dimension

1. Separation of immutable and mutable logic

Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a "functional core, imperative shell" seems to be the most voiced.

"Boundaries" - Gary Bernhardt

"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests

https://www.youtube.com/watch?v=yTkzNHF6rMs

@niepiekm
niepiekm / LetsDestroyC.md
Last active February 20, 2020 22:28 — forked from shakna-israel/LetsDestroyC.md
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@niepiekm
niepiekm / LRU cache
Created May 10, 2019 11:00 — forked from harshil93/LRU cache
LRU cache implementation in C++11.
#include <iostream>
#include <unordered_map>
#include <list>
#include <stdexcept>
template <typename K, typename V>
class lru_cache {
private:
typedef std::pair<K, V> cache_entry;
typedef std::list<cache_entry> cache_list;
@niepiekm
niepiekm / Makefile
Created November 16, 2018 13:00 — forked from skeeto/Makefile
C Object Oriented Programming Example
CFLAGS = -std=c99 -Wall
main : main.o
.PHONY : test clean
test : main
./$^ "*regex*" "*vtable*" < main.c
clean :
@niepiekm
niepiekm / systemd_services.md
Created May 28, 2018 13:05 — forked from leommoore/systemd_services.md
Systemd Services 101

Check that your system supports systemd

pidof systemd
2733

If this return a number then your system supports systemd. Most Linux distributions in 2017 support systemd.

Check out the proceses currently running.

Since systemd starts the process then all processes will be children of systemd