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
# Config for Nginx to act as a front-end for Riak | |
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc) | |
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_) | |
# Config is in /etc/nginx/sites-available/default or somewhere like that | |
# Set up load-balancing to send requests to all nodes in the Riak cluster | |
# Replace these IPs/ports with the locations of your Riak nodes | |
upstream riak_hosts { | |
server 127.0.0.1:8098; |
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
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- | |
%% ex: ts=4 sw=4 et | |
%% @author Kevin Smith <[email protected]> | |
%% @copyright 2011 Opscode, Inc. | |
-module(example). | |
-behaviour(gen_server). | |
-export([start_link/0]). |
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
{- | |
Dear reader, | |
This is an attempt to de-mystify how Control.Monad.State.get seems to | |
magically create a State out of nothing. | |
Here's an example taken from the documentation: | |
tick :: State Int Int | |
tick = do |
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
fbettag@home .oO(~) $ siege -b http://172.16.1.5:8080/ | |
** SIEGE 2.70 | |
** Preparing 25 concurrent users for battle. | |
The server is now under siege...^C | |
Lifting the server siege... done. | |
Transactions: 977 hits | |
Availability: 100.00 % | |
Elapsed time: 11.40 secs | |
Data transferred: 2.97 MB | |
Response time: 0.29 secs |
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 GroupBy where | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
groupBy :: Ord b => (a -> b) -> [a] -> Map b [a] | |
groupBy f = foldr (\ v -> Map.insertWith (++) (f v) [v]) Map.empty | |
groupBy' :: Ord b => (a -> b) -> [a] -> Map b [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
(* Inspired by this puzzle from NPR: | |
http://www.npr.org/2012/01/29/146034893/this-puzzle-is-the-pits | |
(see the 'Next Weeks' challenge section there): | |
"Next Week's Challenge from listener Ed Pegg Jr.: Write the digits from | |
1 to 9 in a line. If you put times signs after the 2 and 4, a plus | |
sign after the 5, and a minus sign after the 7, you have | |
12 x 34 x 5 + 67 - 89, which equals 2018. | |
That's six years off from our current year 2012. This example uses | |
four arithmetic symbols. The object is to use just three of the | |
following arithmetic operations: addition, subtraction, multiplication |
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
<html> | |
<body> | |
GET squawk:<br /> | |
{{ squawk_get }}<br /><br /> | |
POST squawk:<br /> | |
{{ squawk_post }}<br /><br /> | |
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
/* Start by creating a reader for some fake yet conceivable type for executing SQL queries. */ | |
val dbReader: Reader[Properties, JdbcExecutor] = | |
for { | |
driver <- read[String]("db.driver") | |
uri <- read[String]("db.uri") | |
user <- read[String]("db.username") | |
password <- read[String]("db.password") | |
name <- read[String]("db.pool.name") | |
minCons <- read[Int]("db.pool.minConnections") |
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
Simple literate programming. | |
Add comments to your Erlang file with a special %%% syntax, like this: | |
%%% This is a comment that will be formatted in a variable width font with Markdown. | |
%%% You can use *emphasis* and | |
%%% # Headings | |
%%% and even | |
%%% | |
%%% - Lists |
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
object BenchmarkCommon { | |
import scala.util.Random | |
val DatasetSize = 10000 | |
val Iterations = 10000 | |
val ArrayPoolSize = 1000 | |
val ArrayPool = { | |
def randomArray(): Array[Int] = { | |
val array = new Array[Int](DatasetSize) | |
OlderNewer