These are a list of usages of shell commands I can't live without on UNIX-based systems.
Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:
| import java.util.List; | |
| public interface Rotator { | |
| <T> void ror(int distance, List<T> list); | |
| <T> void rol(int distance, List<T> list); | |
| } |
| data Never | |
| data Once = Once | |
| miracle :: (Never -> a) -> (a -> Once) -> Once | |
| miracle = undefined -- let's keep the mystery... | |
| *Main> miracle miracle | |
| <interactive>:1:9: |
This is an environment file to source upon shell startup (via .bashrc/.bash_profile or your shell's corresponding file). If your shell isn't Bash you will likely need to port the functions to your shell's syntax.
When inside your local Git clone of a Github repo you need to do the following (only once per repo):
| import java.net.URI; | |
| import org.apache.http.HttpEntity; | |
| import org.apache.http.client.ResponseHandler; | |
| // Inspired by http://www.bizcoder.com/index.php/2010/08/28/agent-fielding-is-on-a-mission/ | |
| public interface RestAgent { | |
| // set the current URI | |
| RestAgent goTo(URI uri); |
| > POST /cookies | |
| < 201 I maded you a cookie | |
| < Location /cookies/1 | |
| > GET /cookies/1 | |
| < 410 But I ated it |
| package functional; | |
| class Foo { | |
| public String bar() { | |
| if (System.currentTimeMillis() > 0) {return null;} | |
| return "baz"; | |
| } | |
| } |
| module Routing where | |
| open import Function hiding (type-signature) | |
| open import Data.Bool hiding (_≟_) | |
| open import Data.Maybe | |
| open import Data.Char hiding (_≟_) | |
| open import Data.String as String | |
| open import Data.List as List hiding ([_]) | |
| open import Data.Product hiding (curry; uncurry) |
| -- An implementation of http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html | |
| type Size = Int | |
| type Word = String | |
| type Line = String | |
| linefy :: Size -> [Word] -> [Line] | |
| linefy s ws = go [] ws | |
| where go [] (w:ws) | length w > s = [] | |
| | otherwise = go [w] ws | |
| go (l:ls) (w:ws) | length w > s = [] | |
| | length w + 1 + length l > s = go (w:l:ls) ws |