Skip to content

Instantly share code, notes, and snippets.

Kasper B. Graversen kbilsted

Block or report user

Report or block kbilsted

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kbilsted / gitafterstats.cs
Created Apr 16, 2019
A simple program to parse git logs and produces change statistics grouped by month
View gitafterstats.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
namespace gitafterstat
/// <summary>
kbilsted / ExtractColumToFiles.cs
Created Oct 18, 2017
extract column values to files
View ExtractColumToFiles.cs
class Program
static void Main(string[] args)
var xml = GetXmlData();
WriteToFiles(xml, "xml");
var xsd = GetXsdData();
WriteToFiles(xsd, "xsd");
View functional core, imperative

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

View CompressCSharpCode
using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace CSharpCompression
class Program
kbilsted / doubleclick_with_keyboard.ahk
Created May 27, 2016
AutoHotkey: Double-click using the 1/2 key in the upper left corner rather than using the mouse button - to reduce RSI
View markdown table reformat.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
namespace MarkDownTableReformatter
class Program
kbilsted / ProgrammerKeyboardRemapping.ahk
Last active Mar 14, 2019
A keyboard remapping making it easier to program with nordic (DK, SE, NO) Qwerty keyboard layouts
View ProgrammerKeyboardRemapping.ahk
; To use this script first install
; ------------------------------------------------------------
; This script remaps your keyboard so it is more convenient to code
; while under the slavery of the nordic QWERTY mapping
; The script will do the following
; * Remap alt-j, alt-k. alt-l. alt-i to become cursor movements
; * Remap å and ¨ to imulate the nice position of []{} on US-QWERTY
; * Remap alt-h to be ";\n" since that is a very frequent sequence for C#. Java, C, ... programmers
kbilsted /
Last active Jun 8, 2018
Git guide for Hg users

A Git guide for Hg/Mercurial users

Delete stuff

  • hg uncommit / hg strip
  • git reset --hard HEAD~1

Combine stuff

View better_dvorak.ahk
; Use Scroll Lock to swap keyboard layouts
; and do not let Control, Alt, or Win modifiers act on Dvorak
Loop {
If GetKeyState("ScrollLock", "T")
and !GetKeyState("Control")
and !GetKeyState("Alt")
and !GetKeyState("LWin")
and !GetKeyState("RWin") {
Suspend, Off
} else {
You can’t perform that action at this time.