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)
}
import play.api.libs.json._
import play.api.libs.functional.syntax._
import play.api.data.validation.ValidationError
implicit class JsPathPimps(path: JsPath) extends JsPath {
def readOrError[T](error: => String)(implicit r: Reads[T]): Reads[T] = new Reads[T] {
def reads(json: JsValue): JsResult[T] = path.readNullable(r).reads(json) match {
case JsSuccess(Some(value), _) => JsSuccess(value, path)
case JsSuccess(None, _) => JsError((path, ValidationError(error)))
case err@JsError(_) => err
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
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)
@bigjason
bigjason / vim7.3_mac_install.rb
Created March 28, 2012 18:03 — forked from pengwynn/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end