RSSAmplifier

Blog

Posts on CyberShadow's blog

Recent content in Posts on CyberShadow's blog

blog.cy.mdRSS feed ↗59 posts

Latest posts

company-llama: llama.cpp backend for company-mode

I need to get back into the habit of announcing my projects, otherwise they just go into the void. Anyway, company-llama is some glue between between company-mode and llama.cpp. I created it mainly because I wanted to replace the proprietary TabNine, which modern models running on a GPU outperform anyway. The implementation would be trivial, if not for details such as: We want to use the streaming…

Modding for Godot

I spent some time working on modding support for ΔV: Rings of Saturn. This hard-science-fiction physics-based asteroid mining sim is made in Godot, an open-source game engine not too unlike the proprietary but more popular Unity. Although the game had some rudimentary modding support, as well as two mods published, the previous approach was fragile and did not allow mod interoperability. There is…

Solving XKCD 1683

xkcd 1683 - “Digital Data” Let’s say you are building an archive of the Internet, including all of the cat pictures and funny memes. You only have a limited amount of space, so you really want to use that space in the best way you can. As illustrated, one way that digital data can “degrade” is through reposts and re-uploads: sharing images and videos often involves a…

btdu - sampling disk usage profiler for btrfs

Here is a tool I’ve been dreaming about ever since I got really into btrfs snapshots for home and server backups: a sampling disk usage profiler! Unlike classical disk usage profilers, btdu doesn’t attempt to scan the directory tree starting from the top, but just picks random points on the disk and sees what’s on them. One nice thing about btdu is that it starts showing results…

Datamining Bandersnatch

You may have heard about Bandersnatch, an interactive film released on Netflix as part of the Black Mirror series. I’ve heard about it when it was released, but didn’t get around to watch it until recently, and I was surprised at how deep and thorough the implementation is. The film consists of: 250 segments 62 variables (mostly boolean, some having 3 or 4 possible values) 174 choices…

D compilation is too slow and I am forking the compiler

While working on my current project, the constant creep of increasing compilation times was becoming more and more noticeable. Even after throwing my usual tools at the problem, the total time was still over 7 seconds. Seven. Seconds. Unacceptable‼ Compile time profiling showed that the blame lay with my liberal use of metaprogramming and std.regex, which I wasn’t willing to give up on. The…

New Blog

In case you’ve been wondering why I haven’t posted anything here for the past 3½ years - well, it’s certainly not due to there being nothing to post. The true reason is that, simply put, my dislike for WordPress has surpassed the desire to document what I’ve been doing. And so, as my backlog of things to document grew, the priority of having a way to do it that…

dscripten-tools

I was playing a bit with targeting JavaScript / WebAssembly from D. Sebastien Alaiwan already did a great job of putting together a working toolchain, however it was aiming for a very narrow purpose (simple SDL games). To improve on the situation, I wrote some wrappers around the toolchain which allow using existing D build tools and workflows for targeting emscripten / WASM. These come in the…

Profiling DMD's Compilation Time with dmdprof

Compilation time is frequently linked to productivity, and is of particular interest to D programmers. Walter Bright designed the language to compile quickly (especially compared to C++), and DMD, the reference D compiler implementation, is itself quite optimized. Direct quote from a colleague (after a long day of bisecting a regression in Clang, each step taking close to an hour): Whaaaaaaaaaaat?…

term-keys

term-keys is a package which allows configuring Emacs and a supported terminal emulator to handle keyboard input involving any combination of keys and modifiers. I created it out of frustration with trying to get work done remotely, while I was abroad. Even with the help of aconfmgr, I still had projects that would be too cumbersome to have their development environment replicated locally. I was…

rtf2any

rtf2any is a D library for parsing, converting and emitting RTF (Rich Text Format) documents. We use the library mostly to work with Worms Armageddon’s update documentation and changelog (ReadMe). One user-visible application can be seen at the previous link, which contains the same RTF document converted to MediaWiki syntax and split up into multiple pages. The library received a major…

Twilight Princess quick item selection

If you plan on playing Legend of Zelda: Twilight Princess on a PC (with the Dolphin emulator), you may find this mod useful. Unlike e.g. Ocarina of Time / Majora’s Mask, this game allocates only two slots for items, which means lots of time wasted going through menus to switch them. With this mod, you can select any item directly by pressing a single key. Setup instructions: This mod is for…

Linux rice

This is what my Linux desktop looks like right now: What’s going on here: The window manager is i3-gaps. (I’ve since contributed a few improvements to i3 for some use cases.) The status bar at the top is the standard i3-status, driven by a custom D program. Transparency (for programs that don’t support it natively) is achieved using a color-key shader applied by the Compton…

aconfmgr

aconfmgr is a configuration manager for Arch Linux. You can read the details of what aconfmgr is and what it does in the README; instead, here I’m going to write my personal reasons for creating aconfmgr. Setting up my Arch Linux system (to how I liked it) was a non-trivial effort. As I was going to switch my laptop to Arch soon as well (it was running Kubuntu at the time), I did not look…

Snipes

Snipes is a 1983 text-mode action game. David Ellsworth (Deadcode) managed to reverse-engineer and reimplement it as a Windows program, perfectly preserving the original game’s behavior, and adding replay recording and playback. The source code of the port has been published on GitHub, with the game’s original authors’ permission. My contribution was to port the game to SDL /…

Infinifactory mod

Infinifactory is a wonderful 3D puzzle game from Zachtronics. I’ve had a lot of fun with it, but was dissatisfied with some aspects of the UI, and decided to have a go at fixing these myself. Feature summary: Solution management Unlimited solution slots Solution renaming Block editing Rotate selection Flip selection Clone selection Add to selection Select thing Quick delete More information…

hax11

hax11 is a hackbrary to Hook and Augment X11 protocol calls. I initially created hax11 to work around poor MST support in Linux GPU drivers; however, its use outgrew its initial purpose. hax11 was initially based on kislotniq’s simple dell4khack library, however it no longer shares any code with its ancestor, and now uses a different approach (intercepting the X11 socket connection instead…

One year with the Truly Ergonomic keyboard

In late 2013 I started thinking about switching to an ergonomic keyboard. I did not have wrist pain or other health issues – although preventing them is a good reason as well, I mainly wanted to improve my productivity. The key layouts on typical keyboards are vastly suboptimal: the alphanumeric keys are staggered (a carryover from mechanical typewriters), and important keys (modifiers,…

Is D slim yet?

This is my project for last week’s D hackathon: This project aims to visualize the evolution of D’s reference implementation across a number of metrics over time. It does this by building D at all points in its GitHub history, then running a series of measurements on each version. The project brings together a number of components: Mozilla’s areweslimyet.com, which tracks Firefox…

The amazing template that does nothing

I’ve recently started using a new pattern more often in new D code, namely use of the Identity template. The Identity template (available in std.traits, although undocumented), is declared as follows: alias Identity(alias X) = X; This is a short-form of a template declaration, and is synonymous with the explicit form: template Identity(alias X) { alias Identity = X; } As this is an eponymous…

Very Sleepy CS is now Very Sleepy

I am delighted to announce that my fork of the Very Sleepy profiler, Very Sleepy CS, has been blessed as the official repository by Richard Mitton (Very Sleepy maintainer). As such, the Very Sleepy homepage has been updated to point to the GitHub repository and list the forked releases since Richard’s last release. You can also read Richard’s announcement on his blog. I have already…

ae.utils.funopt

ae.utils.funopt is a std.getopt enhancer: import std.stdio, ae.utils.funopt; int run(bool verbose, string input, string output) { // ... return 0; } int main(string[] args) { try return funopt!run(args); catch (Exception e) { stderr.writeln('Error: ', e.msg); return 1; } } Running program --verbose input.txt output.txt will cause run to be called with the appropriate arguments. Additionally,…

Splicing git repositories

Some projects eventually get split up into multiple source repositories for whatever reason. Sometimes, it is useful however to present the project as a single repository – it’s more difficult to examine a project’s development history when it is scattered among several repositories. Specifically, git bisect will not be very helpful if there is strong inter-dependency between the…

Functional image processing in D

I’ve recently completed an overhaul of the graphics package of my D library. The goals for the overhaul were inspired by D’s std.algorithm and std.range modules: Present everything as small, composable components Avoid implicit copying and prefer lazy evaluation Use templates for efficient code From its first iteration, all components of the image processing package were templated by…

Code signing

Certum is granting open-source developers free code signing certificates. I have applied, and got a certificate in less than a day. I’ve signed most executables I have released on files.cy.md, and plan to sign those I release in the future, especially for programs that need to run elevated (such as TrimCheck). You can find details on how to apply on Pete Batard’s blog. My additions to…

Low-overhead components

My personal dream of an ideal programming language is one that allows defining flexible, configurable components that can be coupled together with very little overhead, producing in the end code that, if reverse-engineered, would appear to be hand-written and optimized for the specific task at hand. Preconfigured component configurations / presets would be available for common use, favoring safety…

Dvorak-based International, Romanian and phonetic Russian layouts

I switched to the Dvorak keyboard layout a while ago, but English is only my third language. I’ve used the Microsoft Keyboard Layout Creator to create Dvorak-based variants of the Romanian and Russian layouts. The layouts are: DvorakIn — Dvorak International (has AltGr combinations for various international characters). Based on dubaron’s layout. DvrkRoCo — Romanian (comma…

Colorize your compiler’s output

When working from the command line, I pass compiler output through a small tool that matches output lines against regular expressions and prints them in various corresponding colors. Usage: replace your usual compiler invocation (in your build script, via a shell alias, etc.) with: colorout LANGUAGE.col COMPILER ARGUMENTS…. For example, create a batch file containing: @colorout.exe d.col…

New blog theme

I switched the blog to a new theme today. The old theme was a fixed-background modification of Sam’s Pixel theme. The new theme is a minimalistic child-theme modification of the standard WordPress twentytwelve theme.

Installing PHP and Apache module under /home

Let’s say you have your own Apache 2 setup in your home directory, and you want to build and install PHP as well, and set it up as an Apache module without root privileges (e.g. if you want to use a different PHP version than the one installed globally). You may run into problems such as PHP’s configure script not detecting apxs2 (and thus not building an Apache module). Or, if you…

Very Sleepy fork

I got fed up with waiting/pestering Richard Mitton (aka Kayamon / @grumpygiant) to integrate the Very Sleepy patches I’ve sent him last year or putting the code on a software forge, so I’m publishing my patches on GitHub myself. Very Sleepy is a polling Windows profiler with a wxWidgets-based GUI. This is a fork of the latest released version at the time of writing (0.82). There have…

DHCP test client

While trying to set up my home network, I was dismayed that there was no simple way to test the DHCP server. Snooping packets is limited to examining existing traffic. DHCP test tools exist (DHCPing and dhquery), however both are outdated and don’t work with the latest versions of their requirements, and both won’t work on Windows. I’ve written a simple DHCP “client”…

64-bit CacheSet

SysInternals CacheSet has a limitation: it is unable to set a cache size larger than 4GB. This is due to the fact that it is a 32-bit application, and the respective API (NtSetSystemInformation) accepts new settings as a 32-bit byte count. The solution: use the 64-bit API, which uses 64-bit integers. I’ve written a very simple 64-bit CacheSet-alike – just enter the desired cache size…

SSD TRIM check tool

A tool that makes it easy to check if TRIM works on your SSD. Source, download.

KeyboardEmperor

If you use Windows and like speed, you may have heard of Keyboard King, a program that allows accelerating your keyboard repeat rate to over Windows’ maximum limit. However, if you did use Keyboard King, you probably ran into its shortcomings: the method it uses to accelerate the repeat rate is buggy, because the approach it uses is insufficient. Enter KeyboardEmperor, a kernel-mode hack…

Fixing DirectMusic on some 64-bit Windows versions

If you’re getting error messages such as “No sound device detected. Sounds might not play.” or “Failed to create Direct Music Performance.” when running Game Maker games, the following may help you. Here’s what I did to fix them on my system: Download the DirectX redistributable Unpack it Unpack dxnt.cab In dmusic.inf, search and replace “HKCR,” with…

Referrer spam

I got tired of pesky referrer spambots junking up my logs, so I decided to find a way to get rid of them. Turns out, almost all referrer spam on my blog is generated with a small number of User-Agents: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8) Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824…

Programmatically print SWF

I was looking for a way to programmatically print a SWF file. The stand-alone Flash player has an option to print a SWF, however there is no shell action registered for it. After looking around a bit, I found that probably the easiest way is to use the ActionScript PrintJob API: package { import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import…

Wolfram|Alpha IRC script

If you’re hanging out on the same GameSurge channel(s) as me, you probably know about Byte’s tehh6x bot. I’ve recently added a Wolfram|Alpha command to it, allowing it to query W|A and return the results in a somewhat IRC-compatible format. Here’s the code: #!/usr/bin/perl use strict; use warnings; use URI::Escape; use LWP::UserAgent; use HTML::Entities; sub uhoh { print…

Wikipedia Watchlist RSS

Wikipedia’s Watchlist has a RSS feed, which is a nice way to keep track changes on your watched articles. However, the RSS feed doesn’t seem to conform to the RSS standard, and confuses some feedreaders – notably, Opera M2. Here’s a simple PHP script, which you can place on your website, that’ll fix the RSS feed. You’ll need to give it the URL to your RSS feed…

Color grep for Windows

Looking for color grep for Windows? I was. I didn’t find exactly what I was looking for; instead, I found something better. ack is a tool like grep, designed for programmers with large trees of heterogeneous source code. ack doesn’t enable or output colors on Windows by default. To get it all working, do the following: If you don’t have it yet, get ActivePerl. Download the…

Worms Armageddon Devblog

We’ve launched the Worms Armageddon Beta Update Develeopment Blog. Visit it to get the latest news about W:A development.

data.d – unmanaged memory wrapper for D

I have written a module containing classes to manage raw data in external memory. It provides semantics similar to built-in void[] arrays, but has the following advantages: Faster allocation and deallocation, since memory is requested from the OS directly as whole pages Greatly reduced chance of memory leaks due to stray pointers Overall improved GC performance due to reduced size of managed heap…

Import Wikipedia page history to git

I’ve written a small tool which downloads the history of a Wikipedia article, converts it and imports it into a new git repository. The main motivation behind writing it is being able to perform a per-line blame of the article’s history. I had tried levitation, but that tool seemed to be oriented towards large imports (or it might just be buggy), as it attempted to create huge binary…

GraphStudio fork

I have made a few improvements to GraphStudio, the open-source GraphEdit clone: The limit for text entry in certain combo boxes has been removed Basic XML graph saving support has been added (only filters and connections at the moment) Pins are now referred by their indexes in XML rather than by ambiguous names Added command-line /render parameter, which loads a graph, plays it and exits XML…

Why is the amount of text I can type in my combo box limited by its width?

Once in a while you’ll stumble upon a combo box which doesn’t allow you to type past the right edge of the control. When normally typing more text would just scroll the contents, you’ll just get back an annoying beep. The amount of text you can enter is actually bound by the on-screen width of the text – thus, you may be able to enter 125 “i” characters, but…

Setting shared Google Talk / Gmail status programmatically

There are a few ways to programmatically set the Google Talk / Gmail status via XMPP, however they have some problems if you are signed in into the same account with Google Talk or Gmail chat: You need to keep the program running – otherwise, the status will revert when the connection is closed; Other logged-in applications will not see the status change. Enter Google’s Shared Status…

Announcing: RABCDAsm

RABCDAsm (Robust ABC (ActionScript Bytecode) [Dis-]Assembler) is a collection of utilities including an ActionScript 3 assembler/disassembler, and a few tools to manipulate SWF files. This package was created due to lack of similar software out there. Particularly, I needed an utility which would allow me to edit ActionScript 3 bytecode (used in Flash 9 and newer) with the following properties:…

WordPress “Pixel” theme – fixed background mod

I love fixed backgrounds. So, I made a version of Sam’s Pixel theme with a fixed background (which you can see on the blog already). It even supports IE6 (well, almost) – thanks, ie7-js! Note: I re-exported the background from the original PSD as a PNG, since it’s too beautiful to be degraded by JPEG compression artifacts. The PNG is about 350kb in size – so, if that…

TimeTracker – minimalistic time-tracking

Starting with a new hourly-paid freelancing job, I needed some software to track the amount of time I spend working. I tried a few time tracking programs out there, but they all turned out to be bloated and clumsy (not to mention not open-source), so I decided to roll my own. No fancy interface, no useless options. Click the icon to start/stop work. Icon files are purposefully not embedded for…