Skip to content

Instantly share code, notes, and snippets.

View mmahadevan-okta's full-sized avatar

Madhu Mahadevan mmahadevan-okta

View GitHub Profile
@mmahadevan-okta
mmahadevan-okta / setup-code-ts.sh
Last active March 25, 2017 19:35
Setup Typescript with VS Code.
#!/usr/bin/env sh
if [ "$1" != "" ]; then
mkdir "$1" && cd "$1"
if [ "$(type -t curl)" == "file" ]; then
curl -L -s https://www.gitignore.io/api/node,macos >> .gitignore
else
echo "curl not found."
fi
@mmahadevan-okta
mmahadevan-okta / gist:9814282
Created March 27, 2014 18:08
sanitizeUsername
private String sanitizeUsername(String name) {
LOGGER.debug("sanitizeUsername(" + name + ")");
if ( ! StringUtils.containsOnly(name.toUpperCase(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$_@")) {
name = name.replaceAll("[^A-Za-z0-9\\#\\$\\_\\@]", "");
}
LOGGER.debug("sanitized to [" + name + "]");
return name;
}
@mmahadevan-okta
mmahadevan-okta / conf.log4j
Created January 9, 2014 00:01
Configuration file for grc # grc -c conf.log4j tail -f /usr/local/Cellar/tomcat/7.0.47/libexec/logs/catalina.out
# From http://fahdshariff.blogspot.ca/2011/04/highlighting-command-output-with.html
# this configuration file is suitable for displaying log files
#errors
regexp=^.*(ERROR|Error|Exception).*$
colours=bold red
======
#stack trace
regexp=^\s+at [^:]*:\d*\)$
colours=red
@mmahadevan-okta
mmahadevan-okta / gist:8030706
Created December 18, 2013 22:09
Expression Language examples
Use the following functions to apply basic transformations to the properties listed below.
f:toUpperCase(property)
f:toLowerCase(property)
f:substringBefore(property, searchString)
f:substringAfter(property, searchString)
f:replace(property, oldValue, newValue)
${f:toUpperCase(f:substring(user.firstName,0,1))}${f:toUpperCase(f:substring(user.lastName,0,1))}${f:toLowerCase(f:substring(user.lastName,1,99))}
@mmahadevan-okta
mmahadevan-okta / Snoopster.jsp
Created November 27, 2013 14:38
Dump various incoming HTTP parameters and headers
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Snoopster</title>
<%@ page import="javax.servlet.http.
HttpUtils,java.util.Enumeration" %>
</HEAD>

Perl

perl -MMIME::Base64 -ne 'print decode_base64($_)' ./saml_input.txt | xmllint --format - | source-highlight  -s xml -f esc

Ruby

cat ./saml_input.txt | ruby -r Base64 -ne 'puts Base64.decode64($_)' | xmllint --format - | source-highlight  -s xml -f esc