Skip to content

Instantly share code, notes, and snippets.

View mdp's full-sized avatar

Mark Percival mdp

View GitHub Profile
@mdp
mdp / gist:a591c4163e4f39104266
Last active September 1, 2015 21:37 — forked from hazrac/gist:4470427
# This is a script to use two factor authentication with public ssh keys (since you can't use PAM (g2fa) and public keys) # You must refrence this script in your sshd config: ForceCommand="/usr/bin/two_factor_ssh" # The script has to be executible by the user logging in Work to use google 2 factor auth for ssh, based on these two posts: http://w…
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
# This is a script to use two factor authentication with public ssh keys (since you can't use PAM (g2fa) and public keys)
# You must refrence this script in your sshd config: ForceCommand="/usr/bin/two_factor_ssh"
# The script has to be executible by the user logging in
# get the username of the user logging in
user = ENV["USER"]
@mdp
mdp / hack.sh
Created April 1, 2012 15:40 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mdp
mdp / backbone_pushstate_router.js
Created January 19, 2012 16:46 — forked from tbranyen/backbone_pushstate_router.js
hijack links for pushState in Backbone
// Use absolute URLs to navigate to anything not in your Router.
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
// Use delegation to avoid initial DOM selection and allow all matching elements to bubble
$(document).delegate("a", "click", function(evt) {
// Get the anchor href and protcol
var href = $(this).attr("href");
var protocol = this.protocol + "//";
@mdp
mdp / android
Created February 9, 2011 05:31 — forked from anonymous/android
HTTP_HOST:whatsmyuseragent.com
HTTP_USER_AGENT:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17
HTTP_X_WAP_PROFILE:http://device.sprintpcs.com/HTC/APA9292KT/3706511.rdf