Skip to content

Instantly share code, notes, and snippets.

@codebrane
codebrane / AttributesFromRawSAML.java
Created January 29, 2010 16:51
Working with SAML in Guanxi
org.guanxi.xal.saml_2_0.protocol.ResponseDocument responseDoc;
responseDoc = ResponseDocument.Factory.parse(pod.getBag().getSamlResponse());
To access the attributes in a SAML2 Response, see:
org.guanxi.sp.guard.AttributeConsumer::processSAML2Response
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int ints[] = {4,3,7,2,23,444,53,23,6,-1,0};
int intsSize = sizeof(ints)/sizeof(int);
int buffer, count, shuffleCount;
for (count=1; count < intsSize; count++) {
if (ints[count] < ints[0]) {
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.io.File" %>
<%
String url = request.getRequestURL().toString();
String dirToList = request.getRealPath(request.getServletPath());
File jsp = new File(dirToList);
File jspDirectory = jsp.getParentFile();
File[] dirContents = jspDirectory.listFiles();
%>
<AttributeStatement>
<Attribute Name="mail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<AttributeValue xsi:type="xs:string">harrymcd@jumpingupandown.com</saml:AttributeValue>
</Attribute>
</AttributeStatement>
<AttributeStatement>
<Attribute xmlns:x500="urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
Name="urn:oid:2.5.4.42"
FriendlyName="givenName"
x500:Encoding="LDAP">
<AttributeValue xsi:type="xsd:string">Harry</AttributeValue>
</Attribute>
</AttributeStatement>
@codebrane
codebrane / bb91users.p1
Created June 21, 2012 13:41
Powershell to extract user information from MSSQL Blackboard database
#
# MSSQL connection section from:
# http://www.systemcentercentral.com/BlogDetails/tabid/143/indexid/60012/Default.aspx
#
$SQLServer = 'HOSTNAME'
$SQLDBName = 'DATABASE_NAME'
$SqlQuery = 'select * from users'
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring"
id="matrixRouter"
trace="true">
@codebrane
codebrane / mount-dev-volumes.sh
Created November 7, 2012 15:13
Mounting TrueCrypt volumes from the commandline on OS X
clear
prompt="Password: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
PASSWORD+="$char"
@codebrane
codebrane / unmount-dev-volumes.sh
Created November 7, 2012 15:17
Unmounting TrueCrypt volumes from the commandline on OS X
clear
printf "unmounting /Volumes/APPSDEV\n"
/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -t -d /Volumes/APPSDEV
printf "unmounting /Volumes/CONFIGLOCAL\n"
/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -t -d /Volumes/CONFIGLOCAL
printf "unmounting /Volumes/SCRIPTS\n"
/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -t -d /Volumes/SCRIPTS
printf "unmounting /Volumes/SSHKEYS\n"
/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -t -d /Volumes/SSHKEYS
@codebrane
codebrane / Vagrant
Created November 16, 2012 08:54
Basic Vagrant file
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.customize ["modifyvm", :id, "--name", "ldap", "--memory", "512"]
config.vm.host_name = "ldap"
config.vm.forward_port 22, 2222, :auto => true
config.vm.network :hostonly, "33.33.13.37"
config.vm.share_folder "mac", "/mac", "~/"
end