Skip to content

Instantly share code, notes, and snippets.

View bradleybeddoes's full-sized avatar
👋
Hello!

Bradley Beddoes bradleybeddoes

👋
Hello!
View GitHub Profile
def subject = "CN=idp1-aaftest.usq.edu.au,OU=Division of ICT,O=University of Southern Queensland,STREET=1 West St.,L=Toowoomba,ST=Queensland,2.5.4.17=#130434333530,C=AU"
def cn = subject =~ /^(?:.*,)*[cC][nN]=([^,]+)(?:,.*)*$/
cn.each {println it}
public boolean equals(Object obj) {
if (obj == null) { return false; }
if (obj == this) { return true; }
if (obj.getClass() != getClass()) {
return false;
}
Uri rhs = (Uri) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
<VirtualHost 1.1.1.1:443>
ServerName fr.host.edu.au:443
DocumentRoot /var/www/hosts/fr.host.edu.au
Include include/ssl-defaults.conf
SSLCertificateFile ...
SSLCertificateKeyFile ...
SSLCertificateChainFile ...
dataSource {
dbCreate = "update"
dialect= org.hibernate.dialect.MySQL5InnoDBDialect
jndiName= "java:comp/env/jdbc/FEDERATIONREGISTRY"
}
Regular expressions
A common pitfall in Ruby's regular expressions is to match the string's be-
ginning and end by ^ and $, instead of \A and \z.
Ruby uses a slightly different approach to match the end and the beginning of a string. That is why even many Ruby and Rails books make this wrong. So how is this a security threat? Imagine you have a File model and you validate the file name by a regular ex- pression like this:
class File < ActiveRecord::Base
validates_format_of :name, :with => /^[\w\.\-\+]+$/
end
This means, upon saving, the model will validate the file name to consist only of alpha- numeric characters, dots, + and -. And the programmer added ^ and $ so that file name will contain these characters from the beginning to the end of the string. However, in Ruby ^ and $ matches theline beginning and end. And thus a file name like this passes the filter without problems:
$(document).on('click', '.ajax-modal', function() {
$.get($(this).attr('data-load'),function(d){
$("#show-ajaxload-modal .modal-body").html(d);
$("#show-ajaxload-modal").modal('show');
});
});
----
<a href="#" class="btn btn-small ajax-modal" data-load="${createLink(controller:'subject', action:'showpublic', id:subject.id, absolute:true)}" ><g:message code="label.quickview" default="Quick View"/></a>
$> git checkout master
$> git pull origin beddoes oneill
$> vi food.rb
$> vi environment.rb
$> git add .
$> git commit -m "creates spawn v1.0 - not yet tested, bugs probably exist"
Writing objects: 30%, eta: 6 months.
Microsoft Windows 7 Home Premium 64bit OEM $92.50 $8.41 $92.50
Fractal Design Define R3 Case Black USB3.0 $138.00 $12.55 $138.00
Seagate SATA3 2TB 7200RPM Barracuda 64mb Cache $113.00 $10.27 $113.00
Power Colour AX7950-3GBD5-2DHV2 HD7950,3G DDR5,DVI,HDMI,2XminiDISPLAY,800 Mhz, $369.00 $33.55 $369.00
Total $64.77 $712.50
@bradleybeddoes
bradleybeddoes / createAAFBaseEnvironment.groovy
Created August 31, 2012 01:49
2.1.2 FR createAAFBaseEnvironment.groovy temp fix
import aaf.fr.foundation.*
/*
Bootstrap - Step 2
For federations other than the AAF use this as a starting point for initial FR population.
You'll probably want to customise a lot of the below.
*/
// Entities Descriptor
@bradleybeddoes
bradleybeddoes / fr-config.groovy
Created September 5, 2012 22:22
SP configuration in FR
serviceproviders {
shib23 {
displayName = "Shibboleth Service Provider (2.3.x)"
selected = true
entitydescriptor = '$host/shibboleth'
acs {
post {
uri = '$host/Shibboleth.sso/SAML2/POST'
index = 1
}