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 DeriveAnyClass #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Data.Aeson (FromJSON, Object, Value (..), eitherDecodeFileStrict, parseJSON, (.:)) |
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
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation -Name RealTimeIsUniversal -PropertyType DWORD -Value 1 | |
powerfcg -h off |
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
VM_NAME ?= fc32-arm-devel | |
VM_SIZE ?= 10G | |
all: run | |
run: prepare | |
virsh list | grep -q ${VM_NAME} || virsh start ${VM_NAME} | |
virsh console ${VM_NAME} --safe | |
prepare: Fedora-Minimal-armhfp-32-1.6-sda.qcow2 vmlinuz-5.6.6-300.fc32.armv7hl initramfs-5.6.6-300.fc32.armv7hl.img |
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 AllowAmbiguousTypes #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Control.Arrow ( (&&&) ) | |
import Data.Data | |
( ConstrRep (AlgConstr) | |
, Data | |
, cast |
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 System.Environment | |
data Token = Token | |
{ row :: Int | |
, col :: Int | |
, val :: Char | |
} deriving (Ord, Eq, Show) | |
tokenise :: String -> [Token] | |
tokenise = tok 1 1 |
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 Control.Monad | |
import Control.Monad.Extra | |
import Development.Shake | |
import Development.Shake.Command | |
import Development.Shake.FilePath | |
import Development.Shake.Util | |
main :: IO () | |
main = shakeArgs shakeOptions { shakeFiles = ".shake" } $ do | |
want ["aac"] |
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 DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE TypeInType #-} | |
import qualified Prelude as P |
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
# install zsh | |
sudo dnf install zsh zsh-syntax-highlighting | |
sudo chsh -s $(which zsh) $USER | |
# configure zsh | |
curl -sSL https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc > ~/.zshrc | |
cat << EOF > ~/.zshrc.local | |
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
source ~/.profile | |
EOF |
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
I’ve come to realize that understanding pointers in C is not a skill, it’s an aptitude. In first year computer science classes, there are always about 200 kids at the beginning of the semester, all of whom wrote complex adventure games in BASIC for their PCs when they were 4 years old. They are having a good ol’ time learning C or Pascal in college, until one day the professor introduces pointers, and suddenly, they don’t get it. They just don’t understand anything any more. 90% of the class goes off and becomes Political Science majors, then they tell their friends that there weren’t enough good looking members of the appropriate sex in their CompSci classes, that’s why they switched. For some reason most people seem to be born without the part of the brain that understands pointers. Pointers require a complex form of doubly-indirected thinking that some people just can’t do, and it’s pretty crucial to good programming. A lot of the “script jocks” who started programming by copying JavaScript snippets into t |
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 Control.Parallel.Strategies ( parListChunk, rdeepseq, using ) | |
import Data.List ( any, genericLength, group, sort, sortBy ) | |
import Data.Set ( deleteFindMin, fromList, insert ) | |
digits :: Integer -> [Integer] | |
digits 0 = [0] | |
digits n = (n `mod` 10) : if n > 9 then digits (n `div` 10) else [] | |
nextTerm :: Integer -> Integer | |
nextTerm n = foldl (\acc (a, b) -> acc * 100 + a * 10 + b) 0 gs |
NewerOlder