Skip to content

Instantly share code, notes, and snippets.

cdaven / DeadlockController.cs
Created Feb 9, 2022
ASP.NET async Deadlock Example
View DeadlockController.cs
using System.Threading.Tasks;
using System.Web.Mvc;
namespace DeadlockExperiment.Controllers
public class DeadlockController : Controller
public ActionResult Index()
AsyncMethod().Wait(); // Deadlock!
cdaven / AsyncDeadlock.cs
Last active Feb 9, 2022
Example of synchronous blocking causing deadlock
View AsyncDeadlock.cs
async Task PauseAsync()
// Normal asynchronous method call
await Task.Delay(1000);
void Pause()
// Synchronous method blocking on asynchronous method
cdaven / AdventOfCode2020_Day1.fs
Last active Dec 2, 2020
Advent of Code 2020, Day1 (F#)
View AdventOfCode2020_Day1.fs
open System
let readLines filePath = System.IO.File.ReadAllLines(filePath)
let day1 =
printfn "** Day 1 **"
// Läs in alla rader till ett set av heltal
let entries = readLines "data/1.txt" |> Set.ofArray |> Int32.Parse
// Ta fram alla "2020-kompis-par" för varje tal
cdaven / MicroBreak.ahk
Last active Aug 13, 2020
Micro Break Reminder for Windows using AutoHotkey
View MicroBreak.ahk
; Run ShowBreakMessage every 30 minutes
SetTimer, ShowBreakMessage, 1800000
if (A_TimeIdlePhysical > 900000)
; Idle more than 15 minutes - no reminder
cdaven / Spacemacs on Windows
Last active Apr 9, 2022
Setting up Spacemacs on Windows 10
View Spacemacs on Windows

Install Emacs First

Download emacs-w64 and extract somewhere, e.g. a tools or apps folder like C:\Users\<user>\tools\emacs.

Select Emacs' Home

Emacs and many other applications store its configuration in the user's "home" folder. Translated directly from the Unix world, that is %UserProfile% (C:\Users\<user>), but Windows prefers %AppData% instead (C:\Users\<user>\AppData\Roaming).

For simplicity's sake, override this by specifying the HOME environment variable explicitly. Emacs and some other applications (e.g. MinGW) lets this override the default.

cdaven /
Last active Dec 26, 2019
Setup Ubuntu Development Machine on Windows
# Instructions for setting up a custom development machine
# on Ubuntu 18.04, distributed via Microsoft Store.
# Step 1: Install the Windows Subsystem for Linux:
# Step 2: Install Ubuntu via Windows Store:

Keybase proof

I hereby claim:

  • I am cdaven on github.
  • I am cdaven ( on keybase.
  • I have a public key whose fingerprint is 9B13 97E4 CED0 D7E1 F3DA 40F1 3CB0 EC77 AA22 DB8C

To claim this, I am signing this object:


git-flow cheat sheet

TL;DR from A successful Git branching model by Vincent Driessen.

Creating a feature branch

When starting work on a new feature, branch off from the develop branch.

$ git checkout -b myfeature develop
cdaven / 0_reuse_code.js
Created Jul 4, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console