November 22, 2020

DK30 October 2020 - Towers

I participated in the DayKnights 30-day projects, Oct 15th to Nov 15th. One week after the deadline, I am done with everything I wanted to do. The game is by no means complete, but it’s playable and challegning (sometimes). I enjoyed making something new, and will probably continue working on this. Maybe I’ll post another update in a while. The game is playable at: https://towers.oleherman.com/ Here is the project page: Read more

August 28, 2020

Using cf-remote to download and install CFEngine nightlies

This is a work related post. Nightly packages are very useful for testing new features of CFEngine. Right now, nightly packages can be used to test out these new features: Compliance Reports. Mission Portal Dark Mode. New host info page with variable pinning and copy buttons. Note that these features are in development, some parts may be unfinished or buggy. Nightly packages are not supported and should not be used in production environments. Read more

July 15, 2019

Generating markdown changelogs using git

Sometimes I want to create changelogs for my personal projects and add them to blog posts. It’s extra neat to have all changelog entries link to individual commits on GitHub. git log allows you to specify a custom format, and is perfect for the task: $ git log --pretty=format:"* [%s](https://github.com/olehermanse/mrpg/commit/%H)" 09facd30..HEAD Update the GitHub URL with your project, and the commit SHA with the last commit from the previous changelog. The log will have newest changes first, and won’t include the commit which the SHA references, only commits since then. This fits well if you want to maintain a changelog file with the most recent version first. (Use the --reverse option if you prefer older changes first). You can also use a tag: Read more

June 19, 2019

MRPG #1 - Turn based RPG combat and GUI improvements

Recently, I’ve done a lot of work on my unnamed game project, MRPG, so I thought I’d share some of it. The game is turn based, open source, written in python, with a focus on the combat system, and inspired by famous JRPGs such as Final Fantasy and Pokémon. It’s been a while since I posted about it. GUI A lot of improvements were made to the GUI version of the game. Following what is happening in battle is a lot more intuitive, as you have to click through the battle events one by one. Sprites and animated health and mana bars were also added. Read more

April 10, 2019

Running cf-runagent as non-root

I work at Northern.tech, developing CFEngine, a configuration management system. This is a work (CFEngine) related post. cf-runagent is a component for triggering remote agent runs using the CFEngine network protocol. It does not allow for arbitrary commands to be executed, but rather asks the remote host to run the policy it already has. To trigger cf-runagent from other systems or web interfaces, you want to be able to run it as non-root. Read more

March 18, 2019

Editing windows registry using PowerShell

CFEngine Enterprise supports Windows and Windows Registry manipulation. In CFEngine policy you can both read from and write to the registry. I needed a way to test these features, and I prefer ssh access over GUI, so I made this short reference. View See keys (folders) at a path: Get-ChildItem -Path "HKLM:\SOFTWARE\" See all properties (values) in key: Get-Item -Path "HKLM:\SOFTWARE\CFEngine\" See specific property in key: Get-ItemProperty -Path "HKLM:\SOFTWARE\CFEngine\" -Name "VERSION" Create Create a new key (folder) at a path: Read more

March 12, 2019

Fixing your mac keyboard in X11 (RHEL 7)

Alternatively: How xkb works, and how to change keys which are wrong. On OS X, there is no alt+gr. Combinations of shift and alt are used instead. Both alt keys behave the same. You can make your Apple internal or external keyboard behave like this on Linux. This blog post shows how, but please note that it changes the behavior of your alt keys. So keyboard shortcuts which rely on alt might not work any more. Read more

March 11, 2019

Introducing cf-remote: Tooling to deploy CFEngine

I work at Northern.tech, developing CFEngine, a configuration management system. This is a work (CFEngine) related post. About a year ago, I wrote a small python script to automate installing and bootstrapping CFEngine on virtual machines in AWS. It had some hard coded IP addresses that I needed to update when I spawned new hosts, but other than that, it worked well. During manual testing, it saved me a lot of time instead of having to do things manually. Read more

November 11, 2018

Scanning unsigned types in C

printf and scanf are the C standard library functions for printing out and reading in data. They have string counterparts, prefixed with s, which work on strings (sprintf and sscanf). All these functions use a format string to match parts of the string with C variables. As an example, %lu in the format string corresponds to an unsigned long, a positive integer type in C. Scanning unsigned types What happens if you try to sscanf a negative number using %lu? printf will never print a negative number for %lu so sscanf should not scan one, right? Unfortunately, sscanf does match negative numbers for unsigned format strings. As an example, we can scan "-10" with format "%lu": Read more

October 20, 2018

Unknown type name 'u_int'

I ran across the error message (Unknown type name 'u_int', 'u_long', 'u_char' etc.) when trying to incorporate some old C code into a more modern project. It shows up in system headers, like sys/attr.h, and I was confused. After quite some time I figured out what the problem was, so I thought I’d share. Simplified example The source code, when simplified, looked something like this (test.c): #define _XOPEN_SOURCE 500 #include <sys/attr.h> #include <stdio.h> int main(void) { printf("Hello, world!"); } Compiler output When compiled in GCC, on OS X, you get errors from the included file sys/attr.h: Read more

October 6, 2018

AddressSanitizer (ASAN) examples

AddressSanitizer is a great tool for finding bugs in C or C++ projects. It consists of some instrumentation added to code at compile time, as well as a dynamically linked runtime. Good test coverage is required, as it detects problems at runtime, while running your test-suite. To use it, supply -fsanitize=address to both the compiler and linker when building for tests (works in newer versions of clang and gcc). There are great resources for understanding how it works, but when I started, I was missing a few simple examples. Read more

July 27, 2018

Using Systemd to ensure unit(s) run on one CPU core

This post is based on an excellent article from Red Hat: https://access.redhat.com/solutions/1445073 I’m a CFEngine developer, so this is a more work related post. CFEngine and Systemd In some performance critical situations, it makes sense to limit management software to a single CPU (core). We can do this using systemd and cgroups. CFEngine already provides systemd units on relevant platforms, we just need to tweak them. Tested using CFEngine 3.12 on CentOS 7. Read more

June 6, 2018

The DayKnight 30-day project - Week 4 / Final update

DK30 has been over for quite some time. I wanted to post a final update about my progress, for my “fake week 4”. Work and other things have kept me busy, so I’m not done with everything I wanted to do, but still enjoy working on the game. Enemies I’ve added a few enemies, with skills and the basics needed for AI. Currently the AI is completely random. Ogre - Only knows how to attack Slime - Uses a few basic physical moves, like Attack and Slash Wizard - Can use both healing and damaging magic skills. Cultist - Uses evil magic, like Blood pact and Life drain Sprites Enemies and players will have 16x16 sprites in combat. Some basic sprites are done, here is a sneak peak: Read more

May 18, 2018

The DayKnight 30-day project - Week 3

DK30 has officially ended. As I’ve been busy with work, progress has been slow. I’ve done some changes to pave the way for better GUI, but nothing to show there. This post is mainly about the new skills. Skills I’ve added 8 active skills, I think this is enough for the demo, and shows the potential of the combat system. For simplicity, all the explanations below assume that you have equal stats as your opponent. Skill damage scales with your stats (Strength, Dexterity or Intelligence) and mitigation reduces damage based on enemy stats. Read more

April 24, 2018

The DayKnight 30-day project - Week 2

Following the initial plan, I worked on effects this week. Effects (buffs/debuffs) can have positive or negative consequences, like stat boosts, damage over time and so on. Skills can apply effects, and effects can also apply other effects. I made a few improvements in other places as well. A gif should say way more than a thousand words; Notice that text is more animated now? I’ve also made changes to existing skills and started adding new ones, I’ll talk more about this next week. Read more

© Ole Herman Schumacher Elgesem 2025

Powered by Hugo & Kiss.