Skip to content

Instantly share code, notes, and snippets.

(defun slurp-files-in-directory (dir) (interactive) (setq vfiles (directory-files dir (not ‘absolute) “vcf”)) (mapcar insert-file-contents vfiles))

starter-template

title

<!DOCTYPE html>
<html lang="<lisp>(ob:blog-language BLOG)</lisp>">
  <head>
    <meta charset="utf-8">

(defun org-random-entry (&optional arg) “Select and goto a random todo item from the global agenda” (interactive “P”) (if org-agenda-overriding-arguments (setq arg org-agenda-overriding-arguments)) (if (and (stringp arg) (not (string-match “\S-” arg))) (setq arg nil)) (let* ((today (org-today)) (date (calendar-gregorian-from-absolute today)) (kwds org-todo-keywords-for-agenda) (lucky-entry nil)

@tonyday567
tonyday567 / rfdata-example.r
Created April 29, 2013 02:25
example of rates risk factor analysis
require(plyr)
table <- read.table("/var/folders/h1/yhtz6g614_g999nh_tb4gj600000gn/T/babel-6520FQ/R-import-652nsG",
header=TRUE,
row.names=NULL,
sep="\t",
as.is=TRUE)
specs = table
require(quantmod)
#get US 10y Yield from Fred
{-# LANGUAGE ScopedTypeVariables #-}
import Prelude
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.State.Strict
import Control.Monad.Trans.Maybe
import Pipes
-- import qualified Pipes.Prelude as P
import Pipes.Concurrent
@tonyday567
tonyday567 / pipes-sandpit.hs
Created July 19, 2013 07:44
breadcrumbs for pipes 4.0.0
import Pipes
import qualified Pipes.Lift as L
import qualified Pipes.Prelude as P
import Data.Monoid (Sum)
echo = runEffect $ (P.stdin >-> P.stdout) ()
list = runEffect $ L.execWriterP $
((P.range $ take 5 [1..]) >-> P.toList) () :: IO [Int]
-- game.hs
import Control.Concurrent hiding (yield)
import Control.Concurrent.Async
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Maybe
import Control.Monad.Trans.State.Strict
import Pipes
@tonyday567
tonyday567 / socket-client-state-maybe.hs
Last active December 20, 2015 16:09
Attempt at a simple tcp client that holds the socket handle as state.
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures
-fno-warn-type-defaults
-fno-warn-unused-do-bind
#-}
{-| Testing basic tcp server concepts and their interaction with pipes
TODO:
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-unused-do-bind #-}
{-| Testing basic tcp server concepts and their interaction with pipes
TODO:
- [ ] test usage
- [ ] port staying open
setSocketOption sock ReuseAddr 1
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-unused-do-bind #-}
{-| Testing basic interaction between
- StateT
- Pipes, and
- tcp server concepts
- using inner pipes (pipes within another pipe component with a wider context)
-}