Skip to content

Instantly share code, notes, and snippets.

View saevarb's full-sized avatar

Sævar Berg saevarb

  • NTT Data BS Nordics
  • Odense, Denmark
View GitHub Profile
---
title: Foobar
date: 2015-07-14
---
# This is a title
Here I want to write some stuff -- this is a markdown document.
And here, I want to include an automatically generated list of stuffs
import Text.Parsec
import Text.Parsec.String
import Control.Monad
-- Below is the Augmented BNF description of the IRC protocol,
-- according to RFC 2812, along with parsers written using Parsec
-- in Haskell
-- Let's start with something simple
-- letter = %x41-5A / %x61-7A ; A-Z / a-z
dateCtx :: Context String
dateCtx =
dateField "date" "%B %e, %Y"
<> constField "date" "foobar"
dateCtx :: Context String
dateCtx =
dateField "date" "%B %e, %Y"
<> modificationTimeField "date" "%B %e, %Y"
#!/usr/bin/env bash
set -euo pipefail
formats=$(youtube-dl -F "$1" | grep -A 1000 format | tail -n +2)
# Find the best format if it's there(is it always there?)
best=$(grep '(best)' <<< "$formats")
# Choose best format if available, otherwise
# present choices with dmenu
if [[ $? != 0 ]]; then
import Control.Monad.State
foo :: StateT Int IO ()
foo = do
get >>= \s -> liftIO . putStrLn $ "state = " ++ show s
iterateState
liftIO . putStr $ "Please enter q to quit> "
c <- liftIO getLine
unless (c == "q") foo
where
#!/usr/bin/env bash
# This will not work with set -e because killing ffmpeg means whole script
# ends.
set -xuo pipefail
dorecord() {
local filename="$(date "+%F_%V_%H-%M-%S").webm"
local start="$(date "+%s")"
(setq org-agenda-files '("~/notes"))
(setq-default org-directory "~/notes")
(setq-default org-return-follows-link t)
(setq org-default-notes-file (concat org-directory "/todo.org"))
(setq org-clock-into-drawer t)
(setq org-refile-targets '((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad.State
import Control.Monad.Trans.Free
import Data.Functor.Identity
data Turtle n
= MoveForward n
| MoveBackwards n
| TurnLeft n
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad.State
import Control.Monad.Trans.Free
import Data.Functor.Identity
data Turtle n
= MoveForward n
| MoveBackwards n
| TurnLeft n