This file contains 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
{- | |
- Read n messages from a queue and then put them back on the queue: | |
- rabbitmqbrowse <hostname> <queue_name> <count_of_messages_to_read> | |
- Example usage: | |
- runhaskell rabbitmqbrowse.hs localhost my_queue 3 | |
- | |
- cabal install network amqp | |
-} | |
import qualified System.Environment as Env |
This file contains 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/bash -x | |
# Assuming you're using the 'mutable history' workflow (rebases everywhere), | |
# run this script from a branch that's been accepted in Differential to | |
# 'arc amend' the branch, rebase the code onto master, push up the changes, | |
# and delete the branch. | |
current_branch=$(git name-rev --name-only HEAD) | |
git fetch && git checkout master && git pull -r && | |
git checkout $current_branch && |
This file contains 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/bash | |
function usage() { | |
cat <<USAGE | |
usage: $0 options | |
Dump all beans (and values) from a JMX server. | |
OPTIONS: | |
-h Show this message |
This file contains 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/bash | |
# Usage: | |
# ./cassandra_maintenance.sh | |
# or | |
# CASSANDRA_HOME=/path/to/cassandra ./cassandra_maintenance.sh | |
# Some useful logging commands: | |
#nodetool -h localhost compactionstats | |
#while true; do date | perl -pe 's/\n/ /g' >> /tmp/cassandra.log 2>&1 && nodetool -h localhost compactionstats >> /tmp/cassandra.log 2>&1 && sleep 10s; done & |
This file contains 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 Main where | |
-- | All paths from the first row down | |
-- | |
-- >>> allPaths [[4,5]] | |
-- [[4],[5]] | |
-- >>> allPaths [[3], [4, 5]] | |
-- [[3,4],[3,5]] | |
-- >>> allPaths [[1,2], [3], [4,5]] | |
-- [[1,3,4],[1,3,5],[2,3,4],[2,3,5]] |
This file contains 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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
module Main where | |
import Data.Ratio | |
import Data.List | |
import Data.Maybe | |
import Data.Tuple |
This file contains 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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
module SafeList where | |
data Nat :: * where | |
Z :: Nat | |
S :: Nat -> Nat |
This file contains 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
{-# LANGUAGE TypeOperators, ScopedTypeVariables #-} | |
-- http://stackoverflow.com/questions/10239630/where-to-find-programming-exercises-for-applicative-functors | |
-- http://stackoverflow.com/a/10242673/1019205 | |
import Control.Applicative (Applicative, pure, (<$>), (<*>)) | |
import Data.Foldable (Foldable, foldMap) | |
import Data.Traversable (Traversable, sequenceA) | |
import Data.Monoid ((<>)) | |
data Triple a = |
This file contains 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 Main where | |
import qualified Data.List as L | |
import qualified System.Random as R | |
import qualified Data.Numbers.Primes as P | |
import Control.Parallel.Strategies (NFData, ($||)) | |
import qualified Control.Parallel.Strategies as S |
OlderNewer