This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
disk=sda | |
bootpart=1 | |
mainpart=2 | |
# sda1 for boot, sda2 for main, may vary if doing a dual boot | |
# FIRST STOP THE zfs-zed SERVICE | |
systemctl stop zfs-zed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data BoundsError = BoundsError { listLength :: Int, attemptedToGet :: Int } deriving Show | |
getItem :: Int -> Int -> [a] -> Either a BoundsError | |
getItem traversedLength tryingToGet [] = Right $ BoundsError traversedLength (tryingToGet + traversedLength) | |
getItem _ 0 (x:_) = Left x | |
getItem traversedLength tryingToGet (x:xs) = getItem (traversedLength + 1) (tryingToGet - 1) xs | |
main :: IO () | |
main = do | |
print $ getItem 0 50 [0..10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit this configuration file to define what should be installed on | |
# your system. Help is available in the configuration.nix(5) man page | |
# and in the NixOS manual (accessible by running ‘nixos-help’). | |
{ config, pkgs, ... }: | |
{ | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Meta(type): | |
def __getattr__(cls, key): | |
return globals()[key] | |
def __setattr__(cls, key, value): | |
globals()[key] = value | |
def hasattr_(cls, key, original = hasattr): | |
if "hasattr" in cls.__dict__.keys(): #No recursion today | |
return key in globals().keys() |