Skip to content

Instantly share code, notes, and snippets.


Daniel Jour musteresel

View GitHub Profile
musteresel /
Created Mar 15, 2021 — forked from ultrafunkamsterdam/
PySimpleGui Window loops as tasks in asyncio
import asyncio
import PySimpleGUI as sg
loop = asyncio.new_event_loop()
form = sg.FlexForm(
"Everything bagel", auto_size_text=True, default_element_size=(40, 1)
musteresel /
Created Mar 15, 2021 — forked from dpanda/
Using python-lzf module, decompress a whole LZF file
import argparse
import lzf
import os
import struct
def decompress(lzf_file, out_file):
while True:
musteresel / Coop-Scheduler README
Last active Sep 30, 2019
Cooperative multitasking / green threads in C; MIT licence and let me know with a comment if you're using this
View Coop-Scheduler README
How to build on an x86-64 linux system:
nasm -f elf64 hal.s
gcc -Wall -Wextra -c coop-sched.c
gcc -o tryit *.o
There's still one bug, more in the comments of the source file(s)!
musteresel /
Last active Apr 3, 2017
Get the last N items of a list with make
# Copyright 2017 Daniel Jour <>
# 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:
musteresel / promote.h
Created Mar 14, 2017
Promote some value to an unsigned integer type
View promote.h
uint32_t a = (...);
uint32_t b = a << 31;
When uint32_t is defined as a short type, then both operands of the
shift will get promoted to int. Thus above code is then equivalent to:
unsigned short a = (...);
unsigned short b = (unsigned short)((int)a << 31);
musteresel / enum-class-indent.el
Last active Oct 24, 2016 — forked from nschum/gist:2626303
better "enum class" indent in Emacs
View enum-class-indent.el
;;; enum-class-indent.el --- Fixing enum class indentation -*- lexical-binding: t; -*-
;; Keywords: c++
;; Version: 0.0.1
;;; Commentary:
;; This hack fixes indentation for C++11's "enum class" in Emacs.
musteresel / Makefile
Created Aug 25, 2016
WIP libmagic module for CLISP
View Makefile
#CLISP_LINKKIT = $$($(CLISP) -b)/linkkit
srcdir = .
CC = gcc
CFLAGS = -Wall -O2
CLISP = clisp -q -norc
CLISP_LINKKIT = $(shell $(CLISP) -b)/linkkit
musteresel / wip-autotools-export
Created Aug 25, 2016
WIP changes for autotoolizing CLISP
View wip-autotools-export
# HG changeset patch
# User Daniel Jour <>
# Date 1472150146 -7200
# Thu Aug 25 20:35:46 2016 +0200
# Node ID 62249532accb9fb9f7df2687cb86532193d953e0
# Parent f51a5bd170dcff8977bfb55af7f1e39a6d5a3d2f
WIP: autotoolizing the build system and configuration
diff -r f51a5bd170dc -r 62249532accb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
musteresel /
Created Jun 16, 2015
stackoverflow - cities and states
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <limits>
using std::string;
using std::vector;
using std::map;