Skip to content

Instantly share code, notes, and snippets.

@mmaravich
mmaravich / YubikeyAuthenticationProvider.java
Created August 29, 2014 09:22
Spring Security authentication provider that uses YubiKey OTP as password
package com.curlapp.yubikey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.CredentialsExpiredException;
import org.springframework.security.authentication.DisabledException;
@pulse00
pulse00 / .gitconfig
Last active August 29, 2015 14:04
Dotfiles
[core]
autocrlf = input
[user]
name = pulse00
email = [email protected]
[alias]
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
cp = cherry-pick
st = status -s
cl = clone
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@tommeier
tommeier / autorun-plexconnect.sh
Last active January 11, 2020 04:10
Plexconnect for Qnap (Intel - tested on 439 with Apple TV 3). Streaming media to Apple TV 3 from Qnap 439.
#!/bin/sh
# /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
# chmod +x /share/MD0_DATA/.qpkg/autorun/autorun-plexconnect.sh
curl -L https://gist.github.com/tommeier/6255771/raw/update_plex_connect.sh | bash &
@pulse00
pulse00 / post-merge
Created February 14, 2013 12:09
Simple git post-merge hook to check if your composer dependencies are in sync with the composer.lock file after merging a remote branch.
#!/usr/bin/env php
<?php
/**
* Simple git post-merge hook to check if your composer dependencies are in sync with the composer.lock file after merging a remote branch.
*
* Put this into a file called `post-merge` inside your `.git/hooks` directory and make it executable using `chmod +x .git/hooks/post-merge`.
*
* This script assumes you use the following Symfony components:
*
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@rjz
rjz / cs-jq-plugin-template.coffee
Created September 3, 2012 17:01
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@leon
leon / TruncateHtmlExtension.php
Created June 2, 2012 11:25
Symfony 2 Twig Extension that truncates html and preserves tags
<?php
/**
Truncate Html string without stripping tags
register in Resources/config/services.yml with:
services:
truncatehtml.twig.extension:
class: Radley\TwigExtensionBundle\Extension\TruncateHtmlExtension
tags:
- { name: twig.extension }
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}