This file contains hidden or 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
┌──[pedrofurlanetto]─[~/VirtualDev/gritty]─ (AP-2097) | |
└─ $ traceroute google.com | |
traceroute to google.com (216.58.195.78), 64 hops max, 52 byte packets | |
1 ns.aainflight.com (172.19.248.1) 2.692 ms 2.603 ms 1.293 ms | |
2 10.24.80.1 (10.24.80.1) 3.106 ms 3.860 ms 3.312 ms | |
3 * * * | |
4 * * * | |
5 172.27.196.3 (172.27.196.3) 613.152 ms 611.821 ms 670.278 ms | |
6 * * * | |
7 * * * |
This file contains hidden or 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
run0 :: IO () | |
run0 = do | |
args' <- getArgs | |
let args = input args' | |
dynImg <- sequence $ readImageWithMetadata . fst <$> args | |
let img = getImg $ join dynImg | |
let bytes = LB.pack . compress <$> img | |
let writeTmp = LB.writeFile . snd <$> args | |
wrote <- sequence $ do | |
bits' <- bytes |
This file contains hidden or 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
[ | |
{ | |
"enabled": true, | |
"id": 3, | |
"installDate": 1536816442591, | |
"md5Url": "https://update.userstyles.org/143865.md5", | |
"name": "Github Dark Material", | |
"originalDigest": "5a8bbc1965d3dca4ed85e6140f86a674df5be101", | |
"originalMd5": "deb02357ad89cbd66cb108482829b9fa", | |
"sections": [ |
This file contains hidden or 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 Nth extends App { | |
// Problem: given two sorted lists (`as` and `bs` below) find the nth smaller element. | |
// It's assumed that `k <= as.length + bs.length`. | |
def nth(as:List[Int], bs:List[Int], k:Int):Int = (as, bs) match { | |
case (Nil, Nil) => ??? | |
case (a :: as, b :: bs) if k==0 => Math.min(a,b) | |
case (a :: as, b :: bs) if a < b => nth(as, b :: bs, k-1) | |
case (a :: as, b :: bs) if a > b => nth(a :: as, bs, k-1) |
This file contains hidden or 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
lift3 :: | |
Applicative f => | |
(a -> b -> c -> d) | |
-> f a | |
-> f b | |
-> f c | |
-> f d | |
lift3 f a b c = | |
{-let -- This produces the error below | |
g :: f (c -> d) |
This file contains hidden or 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
output :: Parser (Maybe OutFilename) | |
output = | |
( \x -> if x == "none" then Nothing else Just x ) <$> strOption | |
( long "output" | |
<> short 'o' | |
<> value "none" | |
<> metavar "FILENAME" | |
<> help "Output file" ) | |
<|> | |
flag' Nothing |
This file contains hidden or 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
scala> :paste | |
// Entering paste mode (ctrl-D to finish) | |
class A[T] { | |
def add(n: Int)( env: T =:= Int = null): Boolean = if(env == null) true else false | |
} | |
val a = new A[Int] | |
a.add(1) // 2 |
This file contains hidden or 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 IsItTrue { | |
val maybe = false | |
object bs { | |
val hhh = 10 | |
def inc(x:Int) = x + 1 | |
def sum(x:Int)(y:Int) = x + y | |
} | |
} | |
def f = false |
This file contains hidden or 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
public static class id extends Function { | |
public Closure enter(StgContext context) { | |
// context.R(2) is the first argument of the function | |
// All id simply does is evaluate the argument - | |
// it cannot do much more! | |
return context.R(2).evaluate(context); | |
} | |
public int arity() { return 1; } | |
} |
This file contains hidden or 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
sbt.version=0.13.13 |