Skip to content

Instantly share code, notes, and snippets.

aahed
aalii
aapas
aargh
aarti
abaca
abaci
aback
abacs
abaft
@bigjason
bigjason / physsec_shopping.md
Created February 13, 2020 11:46 — forked from lrvick/physsec_shopping.md
PhysSec Shopping List

PhysSec Shopping List

Need to get into a building? Start a police car? Borrow a bulldozer? Go to a restricted elevator floor? It is pretty easy with the right tools and sometimes a bit of practice.

Knowing what those tools even are is half the battle. This guide attempts to solve that for you for for free.

Actually obtaining these tools is non-trivial but -all- of them can be obtained

@bigjason
bigjason / partial.py
Created April 23, 2019 23:52
Partial function application supporting any arg order (WIP)
_sentinal = object()
@dataclass(frozen=True)
class Placeholder(DataClassEnrichment):
keyword: Optional[str] = None
default: Optional[Any] = _sentinal
annotation: Type = Any
def type_repr_of(self, obj):
"""Return the repr() of an object, special-casing types (internal helper).
implicit class EitherTCompanionExt(wrapper: scalaz.EitherT.type) {
class PinnedEitherT[F[_]] {
def apply[A,B](a: Future[A \/ B]): scalaz.EitherT[Future, A, B] = scalaz.EitherT[Future, A, B](a)
}
@inline def eitherTPinned[F[_]] = new PinnedEitherT[F]
@inline def eitherTFuture[A, B](a: Future[A \/ B]): scalaz.EitherT[Future, A, B] = eitherTPinned[Future](a)
}
package object {
implicit def nelFormat[A](implicit format: Format[A]): Format[scalaz.NonEmptyList[A]] = new Format[scalaz.NonEmptyList[A]] {
import scalaz._, Scalaz._
override def writes(o: NonEmptyList[A]) = JsArray(o.toList.map(Json.toJson(_)))
override def reads(json: JsValue) = Json.fromJson[List[A]](json) match {
case JsSuccess(Nil, _) => JsError("empty list not valid")
case JsSuccess(head :: rest, _) => JsSuccess(NonEmptyList.nel(head, rest))
case JsError(errors) => JsError(errors)
@bigjason
bigjason / RicherTry.scala
Last active March 31, 2016 18:24
How the hell is `scala.util.Try` missing a `zip` function?
/*
This is free and unencumbered software released into the public domain.
*/
implicit class RicherTry[+T](wrapped: Try[T]) {
def zip[That](that: => Try[That]): Try[(T, That)] =
for (a <- wrapped; b <- that) yield (a, b)
}
@scala.annotation.tailrec
def fact(n: Int, acc: BigInt = 1): BigInt =
if(n < 0) throw new Exception("n must be >= 0")
else if (n == 0) acc
else fact(n - 1, acc * n)
This file has been truncated, but you can view the full file.
!function(){function e(e){console.log(e)}var t=["Genesis 1:1 In the beginning God created the heaven and the earth.","Genesis 1:2 And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.","Genesis 1:3 And God said, Let there be light: and there was light.","Genesis 1:4 And God saw the light, that it was good: and God divided the light from the darkness.","Genesis 1:5 And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day.","Genesis 1:6 And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters.","Genesis 1:7 And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so.","Genesis 1:8 And God called the firmament Heaven. And the evening and the morning were the second day.","Genesis 1:9 And God said, Let the waters under the heaven be
scala> Array(1).hashCode
res16: Int = 357917741
scala> Array(1).hashCode
res17: Int = 1064821544
scala> Seq(1).hashCode
res18: Int = 1945410391
scala> Seq(1).hashCode
[
"Red",
"Blue",
"Gray or Grey",
"DarkBlue",
"Black",
"Orange",
"Purple",
"Brown",
"Maroon",