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

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
@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
@bigjason
bigjason / syntax_highlighting.py
Created September 22, 2011 22:38 — forked from mstarkman/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import os
from fnmatch import fnmatch
import sublime, sublime_plugin
class DetectFileTypeCommand(sublime_plugin.EventListener):
"""
Detects current file type if the file's extension isn't
Modified for Ruby on Rails and Sublime Text 2 Original pastie
here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa
@bigjason
bigjason / gist:1198936
Created September 6, 2011 20:56
paginator compatible with pymongo and mongoengine
# pagination.py
class Paginator(object):
def __init__(self, query, per_page):
"""Initialize a paginator.
Arguments:
- query -- queryset from pymongo or mongoengine
- per_page -- number of items per page