Skip to content

Instantly share code, notes, and snippets.

Srikanth Seshadri sriki77

View GitHub Profile
@sriki77
sriki77 / JAXRSSessionsApi.java
Last active Aug 29, 2015
Serverside Code Gen By Swagger
View JAXRSSessionsApi.java
package io.swagger.api;
import io.swagger.annotations.ApiParam;
import io.swagger.api.factories.SessionsApiServiceFactory;
import io.swagger.model.Session;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@sriki77
sriki77 / SSLUnificationHandler.java
Created Aug 9, 2015
SSL Unification + Netty + Proxy
View SSLUnificationHandler.java
public class SSLUnificationHandler extends ChannelInboundByteHandlerAdapter {
static final String NAME = "HttpSsLUnificationHandler";
protected void addSSLHandler(ChannelPipeline pipeline) throws Exception {
//SSL Engine init....
pipeline.addAfter(NAME, "sslHandler", new SslHandler(sslEngine));
}
@Override
View WWII_Java_TZ.java
DateFormat indiaDtFmt = new SimpleDateFormat("dd/MM/yyyy HH'h'mm");
DateFormat gmtDtFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
indiaDtFmt.setTimeZone(TimeZone.getTimeZone("Asia/Calcutta"));
gmtDtFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
Date worldWarIIDate = indiaDtFmt.parse("02/02/1944 06h30");
Date nonWorldWarIIDate = indiaDtFmt.parse("02/02/2006 06h30");
System.err.println(gmtDtFmt.format(worldWarIIDate) +" GMT");
View Ruby_Day_1.rb
#1. Print Hello World
puts "Hello World."
#2. Index of "Ruby"
puts "Hello Ruby".index("Ruby")
#3. Name 10 times
puts "Srikanth#{$/}" * 10
View Print array 4 elements each time.rb
Print array 4 elements each time
[*(1..16)].each { |v| v%4==0? p(v) : print("#{v},")}
View csv.rb
module ActsAsCsv
def self.included(base)
base.extend ClassMethods
base.act_as_csv
end
module ClassMethods
def act_as_csv
include InstanceMethods
View car.io
#!/usr/bin/env io
Vehicle := Object clone
Vehicle desc := "Moving Object"
Car := Vehicle clone
Car drive := method ("Vrooom..." println)
ferrari := Car clone
Car drive
Car slotNames println
View 2d.io
list( list(2,3) list(3,4,5) list(6)) flatten sum
View attrxml.io
#!/usr/bin/env io
OperatorTable addAssignOperator(":", "genAttribute")
Builder := Object clone
Builder genAttribute := method(k,v,
k = k asMutable removePrefix("\"") removeSuffix("\"")
write(" "..(k)..("=\"")..(v).."\"") )
Builder curlyBrackets := method(
View books.prolog
#!/opt/local/bin/gprolog --consult-file
book('Seven langauges in seven days','Bruce tate').
book('Beyond Java','Bruce tate').
book('Bitter Java','Bruce tate').
book('Spring Developer Note Book','Bruce tate').
book('C programming language','Ritchie','Kernighan').
book('Practice Of Programming','Kernighan','Pike').
book('Unix Programming Environment','Pike','Kernighan').
You can’t perform that action at this time.