Skip to content

Instantly share code, notes, and snippets.

@dmjio
dmjio / Elevator.cs
Created August 23, 2012 00:51
Making an elevator in C#
using System;
using System.Threading;
namespace OOP
{
public class Program
{
private const string QUIT = "q";
public static void Main (string[] args)
Build failed.
error: builder for '/nix/store/4nb133jpb8np159fs5c63gjn35h5pl0k-wasm32-unknown-wasi-ghc-native-bignum-9.6.5.drv' failed with exit code 1;
last 10 log lines:
import Data.List (foldl', tails)
import Data.Map.Internal.Debug
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Monoid
import qualified Data.Set as S
data TrieValue v
= TrieValue
{ next :: Trie v
import Data.List (foldl', tails)
import Data.Map.Internal.Debug
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Monoid
import qualified Data.Set as S
data TrieValue v
= TrieValue
{ next :: Trie v
import Data.List (foldl', tails)
import Data.Map.Internal.Debug
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Monoid
import qualified Data.Set as S
data TrieValue v
= TrieValue
{ next :: Trie v
import Data.List (foldl', tails)
import Data.Map.Internal.Debug
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Monoid
import qualified Data.Set as S
data TrieValue v
= TrieValue
{ next :: Trie v
@dmjio
dmjio / nixos-mbp-dual-boot-instructions.txt
Last active February 13, 2023 07:12
How to install nixos on a macbook pro dual boot (mid-2012 model)
Step 0: Download unetbootin and the latest nixos iso, put nixos iso onto unetbootin
Step 1: On OSX, Resize your OSX partition using disk utility (leave 25% - 75% as free space)
Step 2: Boot into NixOS from USB (hold down Alt-Option)
Step 3: Use fdisk to create 3 new partitions (nixosswap ~10GB, nixoshome ~75GB, nixosroot ~20GB)
Step 4: Init file systems / swaps
# mkfs.ext4 -L nixosroot /dev/sda4
# mkswap -L nixosswap /dev/sda5
# mkfs.ext4 -L nixoshome /dev/sda6
Step 5: Mount
# mount /dev/sda4 /mnt
@dmjio
dmjio / Main.hs
Last active January 7, 2023 17:21
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
module Main where
@dmjio
dmjio / nixos-mac
Created January 10, 2016 02:44
Install NixOS on an iMac / Macbook
# NixOS manual
nixos.org/nixos/manual/
# GET ETHERNET / WIRED INTERNET FIRST
# Prepare USB stick - dependent on machines - this worked for an iMac
http://superuser.com/questions/795879/how-to-configure-dual-boot-nixos-with-mac-os-x-on-an-uefi-macbook
# Prepare hard disk via Disk Utility on OSX beforehand (for multiple oses)
@dmjio
dmjio / gist:3831557
Created October 4, 2012 04:56
toLower.c
/*lower:convert c to lowercase; ASCII only*/
int lower(int c)
{
if (c >= 'A' && c <= 'Z')
return c +'a'-'A';
else
return c;
}