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
module Brightness (inc, dec) where | |
import System.IO | |
import Control.Monad.IO.Class (MonadIO, liftIO) | |
modifyFile :: (String -> String) -> Handle -> IO () | |
modifyFile f h = f <$> hGetLine h >>= hPutStr h | |
modifyBrightness :: MonadIO m => (Int -> Int) -> m () | |
modifyBrightness f = liftIO $ withFile "/sys/class/backlight/intel_backlight/brightness" ReadWriteMode $ modifyFile (show . f . read) |
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
label: Arch Linux new norename | |
kernel: /vmlinuz-linux | |
args: | |
- root=/dev/nvme0n1p2 | |
- rw | |
- initrd=intel-ucode.img | |
- initrd=initramfs-linux.img | |
- net.ifnames=0 |
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
import Data.Vect | |
%default total | |
Num Type where | |
(+) = Either | |
(*) = Pair | |
fromInteger 0 = Void | |
fromInteger 1 = Unit | |
fromInteger 2 = Bool |
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
import Interfaces.Verified | |
%default total | |
data Face = Frown | Smile | |
Semigroup Face where | |
Smile <+> Smile = Smile | |
Smile <+> Frown = Frown | |
Frown <+> Smile = Frown | |
Frown <+> Frown = Frown |
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
import Data.Vect | |
types : Vect 3 Type | |
types = [Int,Bool,Int] | |
nthType : {n: Fin 3} -> Type | |
nthType = index n types |
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
module Main where | |
import Prelude | |
import Effect (Effect) | |
import Flare (UI, string, runFlare) | |
greet :: String -> String | |
greet name = "Hello, " <> name | |
flare :: UI String |
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
package json | |
import shapeless._ | |
import shapeless.labelled.{FieldType, field} | |
sealed abstract class AST | |
case object Null extends AST | |
case class Bool(value: Boolean) extends AST | |
case class Str(value: String) extends AST | |
case class Num(value: Double) extends AST |
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
#!/usr/local/bin/#pxsl | |
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform | |
output -indent=yes | |
template -match=<<*[@name = 'get_row_header_cells' or @name = 'get_column_header_cells']>> | |
template @*|node() | |
copy | |
apply-templates @*|node() |
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
import shapeless._ | |
import shapeless.labelled.{FieldType, field} | |
abstract class Decode[A] { | |
def get: A | |
} | |
object Decode { | |
def apply[A](implicit decoder: Decode[A]) = decoder | |
implicit object getString extends Decode[String] { val get = "A string" } |
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
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} | |
import GHC.Generics (Generic()) | |
import Data.Yaml (decodeFileThrow, FromJSON, ToJSON) | |
import System.Process (callProcess) | |
import System.Environment (getArgs) | |
createEntry (BootEntry label kernel args) = | |
callProcess "sudo" ["efibootmgr", "--disk", "/dev/nvme0n1", "--part", "1", "--create", "--label", label, "--loader", kernel, "-u", unwords args] |
NewerOlder