This blog post series has moved here.
You might also be interested in the 2016 version.
This blog post series has moved here.
You might also be interested in the 2016 version.
| """ | |
| Custom parser for nginx log suitable for use by Datadog 'dogstreams'. | |
| To use, add to datadog.conf as follows: | |
| dogstreams: [path to ngnix log (e.g: "/var/log/nginx/access.log"]:[path to this python script (e.g "/usr/share/datadog/agent/dogstream/nginx.py")]:[name of parsing method of this file ("parse")] | |
| so, an example line would be: | |
| dogstreams: /var/log/nginx/access.log:/usr/share/datadog/agent/dogstream/nginx.py:parse | |
| Log of nginx should be defined like that: | |
| log_format time_log '$time_local "$request" S=$status $bytes_sent T=$request_time R=$http_x_forwarded_for'; | |
| when starting dd-agent, you can find the collector.log and check if the dogstream initialized successfully | |
| """ |
At DICOM Grid, we recently made the decision to use Haskell for some of our newer projects, mostly small, independent web services. This isn't the first time I've had the opportunity to use Haskell at work - I had previously used Haskell to write tools to automate some processes like generation of documentation for TypeScript code - but this is the first time we will be deploying Haskell code into production.
Over the past few months, I have been working on two Haskell services:
I will write here mostly about the first project, since it is a self-contained project which provides a good example of the power of Haskell. Moreover, the proces
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
| package com.agilogy.spray.cors | |
| import spray.http.{HttpMethods, HttpMethod, HttpResponse, AllOrigins} | |
| import spray.http.HttpHeaders._ | |
| import spray.http.HttpMethods._ | |
| import spray.routing._ | |
| // see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS | |
| trait CORSSupport { | |
| this: HttpService => |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # This will capture a screenshot, put it in your Public Dropbox folder, | |
| # reveal it in Finder and copy a sharable URL to the clipboard. E.g. | |
| # https://dl.dropboxusercontent.com/u/21267/shots/shot_2014-05-19_12-30-48.png | |
| # Uncomment options below for things like opening in Preview, | |
| # copying a Markdown/HTML image tag etc. | |
| # Replace with your Dropbox user ID. | |
| # | |
| # Share something from your Public folder to find it. |
Thanks to this article by Christoph Berg
Directories and files
~/| import qualified Data.PQueue.Prio.Min as PQ | |
| import qualified Data.HashSet as Set | |
| import qualified Data.HashMap.Strict as Map | |
| import Data.Hashable (Hashable) | |
| import Data.List (foldl') | |
| import Data.Maybe (fromJust) | |
| astarSearch :: (Eq a, Hashable a) => a -> (a -> Bool) -> (a -> [(a, Int)]) -> (a -> Int) -> Maybe (Int, [a]) | |
| astarSearch startNode isGoalNode nextNodeFn heuristic = | |
| astar (PQ.singleton (heuristic startNode) (startNode, 0)) |