This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
import Control.Monad | |
import Control.Monad.Random | |
data RPS = Rock | Paper | Scissors | |
deriving (Show, Eq, Read) | |
data Result = Win | Lose | Tie | |
deriving (Show, Eq) | |
{-# LANGUAGE FlexibleInstances, DeriveFunctor #-} | |
import Control.Applicative | |
import Data.Unfolder | |
import Data.Unfoldable | |
import Data.Ratio | |
import Test.QuickCheck hiding (choose) | |
class Polynomial p where |
-1 0 1 2 3 4 5 | |
\ / \\/ \ / \ / | |
\ // \ / | |
\ // \ / | |
\\ / | |
\\ / | |
\\ / | |
\\/ | |
// | |
// |
{------------------------------------------------------------------------------ | |
reactive-banana | |
Implementation of an "industry strength" game loop with fixed time step | |
and variable fps. | |
See also http://gafferongames.com/game-physics/fix-your-timestep/ | |
-------------------------------------------------------------------------------} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module Main where |
> module Paxos.Basic where | |
> import Data.List (maximumBy) | |
> import Data.Maybe (catMaybes) | |
Phase 1a: Prepare | |
================= | |
A Proposer (the leader) creates a proposal identified with a number N. This | |
number must be greater than any previous proposal number used by this Proposer. | |
Then, it sends a Prepare message containing this proposal to a Quorum o |
This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:
chris-lea/nginx-devel
PPA to allow use of SPDY.ssl_ciphers
selection to mitigate BEAST attack, enable
[perfect forward secrecy][pfs] if possible and select the strongest
possible ciphers within those bounds. (Exception is made for several
ciphers at the end of list, for compatibility reasons.)Various blog posts related to Nix and NixOS
configuration.nix
example.[Unit] | |
Description=Loggly Forwarder | |
[Service] | |
ExecStart=/bin/sh -c "journalctl -o short -f | awk '{ print \"\<34\>1\", $0; fflush(); }' | awk '{ print $0, \"[your-consumer-token-from-loggly@41058 tag='deis']\" }' | ncat --ssl logs-01.loggly.com 6514" | |
[Install] | |
WantedBy=multi-user.target | |
[X-Fleet] |
Postgres lacks convenient operators for modifying JSON or JSONB values. A common operation one might want to do is to change one property in a JSON column across multiple rows, like:
UPDATE example SET json_col = json_col || '{ "prop": true }'::jsonb WHERE <conditions>;
The ||
operator is the natural choice for this because it is also used for array and jstore concatenation in Postgres.
This short PLV8 function adds the JSON concatenation operator. It is significantly more powerful than the array and hstore counterparts, and are capable of: