This file contains hidden or 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/bin/env stack | |
-- stack --resolver lts-16.4 script --package network --package bytestring --package split | |
-- A minimalistic UDP library | |
{-# LANGUAGE OverloadedStrings, RecordWildCards #-} | |
module Udp ( withServer | |
, parseAddr | |
, Send | |
, Recv |
This file contains hidden or 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/bin/env stack | |
-- stack --resolver lts-16.4 script --package fsnotify --package directory --package filepath --package process | |
-- Usage | |
-- sync.hs <local-path> <remote-host> <remote-path> | |
-- | |
-- $ ./sync.hs ./path/to 1.2.3.4 /home/joe/path/to | |
-- Syncing changes from: /Users/joe/path/to/ | |
-- to: 1.2.3.4:/home/joe/path/to | |
-- ++ /home/joe/path/to/123/ |
This file contains hidden or 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 | |
set -xue | |
# taken from https://stackoverflow.com/a/55445034/107341 | |
brew leaves | xargs brew deps --installed --for-each | sed "s/^.*:/$(tput setaf 4)&$(tput sgr0)/" | |
#brew deps --tree --installed |
This file contains hidden or 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/bin/env stack | |
-- stack --resolver lts-13.0 --install-ghc runghc | |
-- see https://stackoverflow.com/questions/53978597/haskell-openfile-for-multiple-handles-wrrr-w-o-file-is-locked | |
module FDIO (Fd, open, read, write, seek, close, with) where | |
import Control.Exception (bracket) | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString.Char8 as C |
This file contains hidden or 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 RWSMonads where | |
import Control.Monad.Reader (Reader, runReader, ask) | |
import Control.Monad.State (State, runState, evalState, get, put) -- also gets/modify | |
import Control.Monad.Writer (Writer, runWriter, tell) | |
getSetCount :: Reader String Int | |
getSetCount = do | |
endpoint <- ask | |
return $ length endpoint |
This file contains hidden or 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
(ns whatever) | |
; loop + recur | |
(defn max-comparing | |
([f xs] | |
(when-let [[x & more] (seq xs)] | |
(loop [v x, k (f x), xs more] | |
(if-let [[x & xs] xs] | |
(let [k' (f x)] | |
(if (pos? (compare k k')) |
This file contains hidden or 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
# # # | |
# How to make your Atom + Haskell setup to behave (almost) like IntelliJ: | |
# (by Oleksandr Shyshko @oshyshko <-- let me know if you want to contribute or have ideas) | |
# | |
# -------------------------------------------------------------------------- | |
# 1. Install Stack (see http://docs.haskellstack.org/ for details) | |
# | |
# $ curl -sSL https://get.haskellstack.org/ | sh | |
# $ stack update | |
# $ stack setup |
This file contains hidden or 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
// | |
// Windows/Linux cursor movement keybindings for OS X | |
// | |
// Put this file to ~/Library/KeyBindings/DefaultKeyBinding.dict | |
// Read more at http://osxnotes.net/keybindings.html | |
// | |
{ | |
"\UF729" = moveToBeginningOfParagraph:; // home | |
"\UF72B" = moveToEndOfParagraph:; // end |