Skip to content

Instantly share code, notes, and snippets.

View vanjikumaran's full-sized avatar

Vanjikumaran vanjikumaran

View GitHub Profile
import java.security.Provider;
import java.security.Security;
public class SecurityListings {
public static void main(String[] args) {
for (Provider provider : Security.getProviders()) {
System.out.println("Provider: " + provider.getName());
for (Provider.Service service : provider.getServices()) {
System.out.println(" Algorithm: " + service.getAlgorithm());
}
@vanjikumaran
vanjikumaran / GetHeaderDetail
Created August 27, 2014 05:15
GetHeaderDetail.xml
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main">
<in>
<filter xmlns:ns="http://org.apache.synapse/xsd" source="get-property('To')" regex=".*/StockQuote.*">
<then>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"></address>
</endpoint>
</send>
</then>
<script>
var text = '{"invideoPromotion":{"items":[{"id":{"type":"video","videoId":"11","websiteUrl":""},"timing":{"type":"ms","offsetMs":"2222"},"customMessage":"aa","promotedByContentOwner":"vanji"}]}}'
var obj = JSON.parse(text);
document.writeln(JSON.stringify(obj));
for (var i = 0; i < obj.invideoPromotion.items.length; i++) {
if (obj.invideoPromotion.items[i].id.type == 'video') {
if (obj.invideoPromotion.items[i].id.websiteUrl == '') {
delete obj.invideoPromotion.items[i].id.websiteUrl;
}
<api xmlns="http://ws.apache.org/ns/synapse" name="strip" context="/strip">
<resource methods="POST GET">
<inSequence>
<header name="Authorization" scope="transport" value="Bearer XXXXXXXXXXXXXXXXXXXXX"></header>
<property name="uri.var.chargeId" expression="json-eval($.chargeId)" scope="default" type="STRING"></property>
<payloadFactory media-type="json">
<format></format>
<args></args>
</payloadFactory>
<property name="ContentType" value="application/x-www-form-urlencoded" scope="axis2"></property>
<api xmlns="http://ws.apache.org/ns/synapse" name="TestApi" context="/TestContext">
<resource methods="POST GET">
<inSequence>
<log level="custom">
<property name="Message Flow" value="Roovershof Plant Search API - IN"></property>
<property name="HTTP_METHOD IS###########" expression="$axis2:HTTP_METHOD"></property>
<property name="ip address" expression="get-property('axis2','REMOTE_ADDR')"></property>
<property name="Authorization" expression="get-property('transport','Authorization')"></property>
</log>
<property name="TIME_IN" expression="get-property('SYSTEM_TIME')" scope="default" type="LONG"></property>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="RecursiveValueFetch"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="Key" value="Location" scope="default" type="STRING"/>
import java.lang.Math;
public class NxNPattern
{
public static void main(String[] args)
{
for (int i = 0, j = 0; i < 49; i++) {
if (i % 7 == 0) {
if (j > 0) System.out.println();
j++;
Verifying that +vanjikumaran is my blockchain ID. https://onename.com/vanjikumaran
@vanjikumaran
vanjikumaran / _auth_failure_handler_.xml
Created July 22, 2016 21:07
Auth Failure Handler Sequence Synapse Configuration
<sequence name="_auth_failure_handler_" xmlns="http://ws.apache.org/ns/synapse">
<switch source="$trp:Accept">
<case regex="application/json">
<property name="error_message_type" value="application/json"/>
</case>
<default>
<property name="error_message_type" value="application/xml"/>
</default>
</switch>
<sequence key="_build_"/>
@vanjikumaran
vanjikumaran / MockServer.py
Created October 2, 2017 22:52
very simple TCP server made out of Python | To run $ python MockServer.py
# Copyright 2017 Vanji
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,