Skip to content

Instantly share code, notes, and snippets.

  1. General Background and Overview

The Indexed State Monad in Haskell, Scala, and C#

Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)

Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)

If that's the case, the indexed state monad can help!

Motivation

How to install latest GHC 7.10.1 + cabal 1.22.3.0 from source on Debian Testing

ghc 7.10.1 installation

Debian prerequisites

    $ sudo apt-get install build-essential ca-certificates xz-utils -y
    $ sudo apt-get install libgmp10 libgmp-dev libffi-dev zlib1g-dev -y  
    $ sudo -K
@valyakuttan
valyakuttan / gitcheatsheet.md
Last active November 10, 2023 17:36 — forked from RalucaNicola/github-commands.md
Common ly used git commands

Reverting a File to a Previous Commit

  • see all commits made to App.js.
    $ git log -- oneline src/App.js
  • Use the SHA value to to revert to the desired version
    $ git checkout 55a1dff -- src/App.js
@valyakuttan
valyakuttan / full-disk-encryption-arch-uefi.md
Last active September 9, 2021 04:01 — forked from huntrar/full-disk-encryption-arch-uefi.md
Arch Linux Full-Disk Encryption Installation Guide [Encrypted Boot, UEFI, NVMe, Evil Maid]

Arch Linux Full-Disk Encryption Installation Guide

This guide provides instructions for an Arch Linux installation featuring full-disk encryption via LVM on LUKS and an encrypted boot partition (GRUB) for UEFI systems.

Following the main installation are further instructions to harden against Evil Maid attacks via UEFI Secure Boot custom key enrollment and self-signed kernel and bootloader.

Preface

You will find most of this information pulled from the Arch Wiki and other resources linked thereof.

Note: The system was installed on an NVMe SSD, substitute /dev/nvme0nX with /dev/sdX or your device as needed.

@valyakuttan
valyakuttan / gpg-ssh-setup.md
Created October 11, 2021 17:28 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@valyakuttan
valyakuttan / GnuPG_Cheat_Sheet.md
Last active August 19, 2023 08:32 — forked from colematt/Backup-and-Restore-GPG-and-SSH-keys.md
[Backup and Restore GPG and SSH keys] #git #gpg #ssh

GnuPG Cheat sheet

Import and Backup secret keys

  1. Import secret keys from a backup

    $ gpg --decrypt backup_file.pgp | gpg --import
    
@valyakuttan
valyakuttan / git-commit-title-first-word.md
Created May 8, 2023 12:02 — forked from scmx/git-commit-title-first-word.md
Example list of verbs / first word to use in git commit title #git #commit #title

Example list of first words to use in a git commit title

I like writing well-formed git commits that explain the intention behind why a code change was made.

Check out Chris Beams excellent How to Write a Git Commit Message if you haven't read it.

Anyway, for a project I've been working on I've gathered up 900+ commits that hold up a pretty high quality (except for one 😁). Let's look at some trends about these commits!

Most common first words in commit titles of a project

Run a local HTTP server with Docker 🐳

Serve your static website from localhost using Docker and Nginx.

By @arrested-developer

Why Docker?

Do you know the famous phrase "it works on my machine"?