Skip to content

Instantly share code, notes, and snippets.

View joelthelion's full-sized avatar

Joel Schaerer joelthelion

  • Bioclinica
  • Lyon, France
View GitHub Profile
@joelthelion
joelthelion / gist:7d4d4b44120607b63035
Created July 9, 2015 23:18
Streaming JSON array downsampler written in (probably bad) Haskell
import Data.JsonStream.Parser
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.Aeson.Types as AT
import qualified Data.Aeson.Encode as AE
import Pipes
import qualified Pipes.Prelude as P
import System.IO (isEOF, stdin)
import System.Random
@joelthelion
joelthelion / gist:102413
Created April 27, 2009 09:35
Parse a string in C++
template<class ElementType>
std::vector<ElementType> parse_string(std::string str,char delim)
{
std::istringstream ss(str);
std::string token;
std::vector<ElementType> result;
while (getline(ss,token,delim))
{
std::istringstream token_parser(token);
ElementType value;