Skip to content

Instantly share code, notes, and snippets.

View GitTester.java
package com.tut.jgit;
import java.io.File;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
public class GitTester {
View gist:66a0ded8477632ea0bb9e9bbb99ecf3e
REST API Concepts
-----------------
HTTP methods - GET, POST, PUT, DELETE
SOAP has WSDL as service definition
REST has no standard
200 - OK
500 - Error on the server while processing the request
404 - Page not found error
View jsfile
<%--
Document : manageHomePageFeeds
Created on : 26 Oct, 2012, 3:39:31 PM
Author : anand
--%>
<%@ taglib prefix="gs" uri="/struts-tags" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
View RedirectToBlog.java
package com.generalsentiment.action;
public class RedirectToBlog {
private String externalUrl;
public String getExternalUrl() {
return externalUrl;
}
@sangramanand
sangramanand / gist:3187774
Created Jul 27, 2012
Amazon Linux machine - sun jdk 1.7 & memcached installation
View gist:3187774
// remove open jdk by looking into its rpm
#rpm -qa
# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-52.1.9.10.40.amzn1.x86_64
// install sun jdk 7 rpm - for updated java jdk checkout @ http://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/#more-39
# wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u5-b05/jdk-7u5-linux-x64.rpm"
# rpm -ivh jdk-7u5-linux-x64.rpm
//after jdk is installed successfully, install memcached.
@sangramanand
sangramanand / gist:3183604
Created Jul 26, 2012
Java Time difference using JODA
View gist:3183604
Java Time difference using JODA
DateTime beforeCall = new DateTime();
Map<String, Map<String, String>> info = Maps.newHashMap();
Interval interval = new Interval(beforeCall, new Instant());
System.out.println("new call difference = "+interval.toDurationMillis());
DateTime beforeCall1 = new DateTime();
allAdmins = adminDAO.getAll();
@sangramanand
sangramanand / ValidatePhoneNumber
Created Feb 23, 2012
Validating phone number using Java
View ValidatePhoneNumber
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author anand
*/
public class ValidatePhoneNumber {
public static void main(String[] argv) {
@sangramanand
sangramanand / Elastic BeanStalk settings for Live Env
Created Jan 12, 2012
Elastic BeanStalk settings for Live Env
View Elastic BeanStalk settings for Live Env
Live Environment Configuration on Elastic Beanstalk
Ec2-instance type - c1.medium
Ec2 Security Groups - elasticbeanstalk-default, default, GSUI-Base
Monitor Interval - 1 minute
Http Listener port -80
Https Listen ort -443
SSL Certificate ID - rn:aws:iam::228576831886:server-certificate/GeneralSentiment-SSL
Application Health Check URL - /
Health Check Interval (seconds) - 30