I use this to run a slapd instance for testing schemata, searched, etc. during development.
mkdir -p schema
This is a Literate Haskell file: lines begining with `>` are Haskell | |
code and other lines are just plain old text (Markdown, actually). If | |
you save this file with a `.lhs` extension, the Haskell tools will all | |
run it just like a normal `.hs` file. | |
We're going to generate lists of random numbers and will need a few | |
helpful functions from the standard library: | |
> import Data.List (unfoldr) | |
> import System.Random |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Main where | |
import Control.Applicative | |
import Control.Monad.Except | |
import Control.Monad.IO.Class () | |
import Control.Monad.Reader | |
import Control.Monad.Writer |
module Main where | |
import Control.Applicative | |
import Data.Char | |
import Data.List | |
import Options.Applicative | |
import Options.Applicative.Types | |
-- * Options parsers |
module Main where | |
import Control.Applicative | |
import Data.Char | |
import Data.List | |
import Options.Applicative | |
import Options.Applicative.Types | |
-- * Options parsers |
#!/bin/sh | |
# | |
# Access a shared secret file. | |
set -eu | |
error() { | |
echo $1 | |
exit 1 | |
} |
module Main where | |
import System.Exit | |
import System.Process | |
main :: IO () | |
main = do | |
(c1, o1, e1) <- readProcessWithExitCode "ghc" ["-ilib", "-o", "/tmp/failure", "test/fail.hs"] "" | |
(c2, o2, e2) <- readProcessWithExitCode "ghc" ["-ilib", "-o", "/tmp/passure", "test/pass.hs"] "" |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Foo where | |
import GHC.TypeLits | |
data Header (sym :: Symbol) (val :: Symbol) | |
type Foo = '[Header "X-Forwarded-For" "Satan"] |
/** @file | |
* | |
* This code implements wraps and exports the OpenSSL hashing functions to Lua. | |
* | |
* To use this code arrange for it to be loaded by your Lua interpreter either | |
* by compiling it in or loading a shared library. You'll need to pass various | |
* flags to your compiler to get it to use the OpenSSL libraries, etc. I used | |
* something like this: | |
* | |
* gcc `pkg-config openssl --cflags --libs` -c lhash.c |
MAMP is a pretty crappy environment, but it beats the shit out of building a decent environment myself and is marginally more convenient than working on a Linux VM. This little script makes it more useful (for me) by providing a fake php
command in the $MAMP/Library/bin
directory which calls the real php
from the version you've configured MAMP to use.
Just put the accompanying script in the $MAMP/Library/bin
directory and make it executable, then make sure that $MAMP/Library/bin
is in your $PATH
before /usr/bin
(and any other directory containing an executable called php
).
Then any invocation of php
will be executed with the correct version (as far as MAMP cares, anyway!)
Future improvements include using the "next" php
in $PATH
if MAMP is not running.