Skip to content

Instantly share code, notes, and snippets.

Mateusz Lenik mlen

Block or report user

Report or block mlen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gameoflife.py
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 Oct 9, 2015
quine generator in ruby
View gen.rb
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 = "
View keybase.md

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:

View gist:a5863f3861ba8b662264
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
View foo.diff
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)))
View strings.rb
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 }
View HLoris.hs
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)
View GADTs.hs
{-# 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)
View gist:9688268
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,
View Blink.hs
You can’t perform that action at this time.