Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
1 2 3 | |
1 2 3 | |
1 2 3 |
/* | |
Copyright 2012-2021 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
/** | |
* Type-level Tower of Hanoi | |
* by Travis Brown | |
* | |
* Note: not optimal, and probably won't work for some valid inputs. | |
* Tested with Scala 2.9.2 and Shapeless 1.2.3. | |
*/ | |
import shapeless._, Nat._ |
package fizzbuzz | |
// This is church encoding of natural numbers | |
sealed trait Num { | |
def toInt : Int | |
override def toString = toInt.toString | |
} | |
final case object Z extends Num { | |
def toInt : Int = 0 |
import shapeless._, Nat._ | |
trait FizzBuzz[N <: Nat] { | |
type R3 <: Nat | |
type R5 <: Nat | |
def ti: ToInt[N] | |
def prev: List[String] | |
def d3: R3 =:= _0 | |
def d5: R5 =:= _0 |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import scala.util.{Try, Success, Failure} | |
def f(s: String): Try[Int] = Try { s.toInt } | |
def g(i: Int): Try[Int] = Try { i * 2 } | |
def unit[T](v: T): Try[T] = Success(v) | |
//val v = "1" | |
val v = "bad" | |
val m = Success(v) |
import shapeless._ | |
import poly._ | |
import shapeless.ops.hlist.FlatMapper | |
object am { | |
/** | |
* A type class that helps us partially apply a polymorphic binary function | |
* to some value and map the resulting function (which of course isn't | |
* literally a Poly1) over an HList. |
import geotrellis._ | |
import geotrellis.source._ | |
import geotrellis.raster._ | |
import geotrellis.data.arg._ | |
object Main { | |
def main(args:Array[String]):Unit = { | |
println("Merging...") | |
GeoTrellis.init(GeoTrellisConfig("/home/rob/data/sf/catalog.json")) |