I hereby claim:
- I am nthportal on github.
- I am nthportal (https://keybase.io/nthportal) on keybase.
- I have a public key whose fingerprint is BA6F F781 FFAD 1AE8 3DDF 735D C3FE 56CA 394F B05D
To claim this, I am signing this object:
import random | |
import itertools | |
def relative_complement(superset, subset): | |
return [elem for elem in superset if elem not in subset] | |
def simulate(): | |
n = 1000 |
I hereby claim:
To claim this, I am signing this object:
Regarding Project Euler problem 59
The problem contains one correct statement, which is that
For unbreakable encryption, the key is the same length as the plain text message, and the key is made up of random bytes.
Assuming that the bytes are actually random, there is said to be 'perfect secrecy' - the ciphertext reveals no information (other than length, obviously) about the plaintext. However, this approach has several problems, which will be covered below.
The problem goes on to say that, "[u]nfortunately, this method is impractical for most users," (yup) "so the modified method is to use a password as a key." (NO. BAD. VERY BAD. NONONONO)
ProxyRequests Off | |
ProxyPreserveHost On | |
<VirtualHost *:80> | |
ServerName example.com | |
RedirectPermanent / https://example.com/ | |
</VirtualHost> | |
<VirtualHost *:443> | |
SSLEngine on |
case class User(id: User.Id, firstName: User.FirstName, lastName: User.LastName, email: User.Email) | |
object User { | |
opaque type Id = Long | |
object Id { | |
def apply(value: Long): Id = value | |
implicit class Ops(val self: Id) extends AnyVal { | |
def value: Long = self | |
} |
scala> class Foo { | |
| def p1[A, B](t: (A, B)): (Option[A], Option[B]) = { | |
| val (e1, e2) = t | |
| (Some(e1), Some(e2)) | |
| } | |
| def p2[A, B](t: (A, B)): (Option[A], Option[B]) = { | |
| (Some(t._1), Some(t._2)) | |
| } | |
| } | |
defined class Foo |
private final class SingleUse[R](resource: => R) { | |
private val used = new AtomicBoolean(false) | |
def useWith[A](f: R => A)(implicit r: Using.Resource[R]): A = | |
if (used.getAndSet(true)) throw new IllegalStateException("resource has already been used") | |
else Using.resource(resource)(f) | |
} | |
final class Using[R, A] private[Using](resource: SingleUse[R], op: R => A) { | |
private def use0()(implicit r: Resource[R]): A = resource.useWith(op) |
_rwhich_1() { | |
readlink -e "$(command -v "$1")" | |
} | |
_rwhich_comp() { | |
mapfile -t COMPREPLY < <(compgen -c "${COMP_WORDS[COMP_CWORD]}") | |
return 0 | |
} | |
# recursively resolve commands ("recursive `which`") | |
rwhich() { |
import scala.util.matching.Regex | |
object Impl { | |
sealed trait WConfAnyFilterable { | |
type Result = WConfFilterable with WConfCompletable | |
@annotation.inline | |
private[this] def quote(literal: String): String = Regex.quote(literal) | |
#!/usr/bin/env amm | |
import $ivy.`com.lihaoyi::ammonite-ops:2.4.0` | |
import ammonite.ops._ | |
import scala.collection.immutable.ArraySeq | |
import scala.util.control.NoStackTrace | |
object Abort extends Throwable("unable to process inputs") with NoStackTrace |