Skip to content

Instantly share code, notes, and snippets.

import unittest
class Life(object):
def __init__(self, state):
self.state = state
def next(self):
cells_to_consider = set()
@mlen
mlen / gen.rb
Last active October 9, 2015 08:44
quine generator in ruby
head = "#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
char *s = "

Keybase proof

I hereby claim:

  • I am mlen on github.
  • I am mlen (https://keybase.io/mlen) on keybase.
  • I have a public key whose fingerprint is B865 E86A D36C 11A5 C1F8 C1D9 AAD4 CEC9 6B94 92C4

To claim this, I am signing this object:

Script started on Wed Jan 7 18:45:58 2015
aquila ~ % cat Test.hs
module Main where
import Control.Concurrent
main = do
threadDelay 1000000
putStrLn "hello"
aquila ~ % ghc Test.hs
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs
index 953797e..30f1f09 100644
--- a/compiler/utils/Outputable.lhs
+++ b/compiler/utils/Outputable.lhs
@@ -810,7 +810,7 @@ pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) ::
-- | Special combinator for showing string literals.
pprHsString :: FastString -> SDoc
pprHsString fs = [-v-]{+h+}cat (map text (showMultiLineString (unpackFS fs)))
require 'parslet'
module Strings
class Parser < Parslet::Parser
rule(:spaces) { match['\s\n'].repeat }
rule(:eq) { str("=") >> spaces }
rule(:colon) { str(";") >> spaces }
rule(:string) { str('"') >> (str('\\') >> any | str('"').absent? >> any).repeat.as(:internal) >> str('"') >> spaces }
module Main where
import Control.Applicative ((<$>), (<*>))
import Control.Concurrent (Chan, ThreadId, forkIO,
getChanContents, killThread, newChan,
threadDelay, writeChan)
import Control.Exception.Base (SomeException (..), catch, finally,
handle)
import Control.Monad (forM_, forever)
import Control.Monad.IO.Class (MonadIO, liftIO)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
import GHC.TypeLits
data Stack :: * -> Nat -> * where
Nil :: Stack t 0
Cons :: a -> Stack a b -> Stack a (1 + b)
upload :: Verbosity -> [Repo] -> Maybe Username -> Maybe Password -> [FilePath] -> IO ()
upload verbosity repos mUsername mPassword paths = do
let uploadURI = if isOldHackageURI targetRepoURI
then legacyUploadURI
else targetRepoURI{uriPath = uriPath targetRepoURI `FilePath.Posix.combine` "upload"}
Username username <- maybe promptUsername return mUsername
Password password <- maybe promptPassword return mPassword
let auth = addAuthority AuthBasic {
auRealm = "Hackage",
auUsername = username,
@mlen
mlen / Blink.hs
Created December 27, 2013 20:48 — forked from puffnfresh/Blink.hs