Skip to content

Instantly share code, notes, and snippets.

View rrajendran's full-sized avatar

Ramesh Rajendran rrajendran

  • Capella Technologies Ltd.,
  • Wokingham, United Kingdom
View GitHub Profile
@rrajendran
rrajendran / gitbranch
Created February 11, 2013 21:58
Loops through all the git projects and branches to a given name. usage: ./gitbranch.sh <branch-name>
#!/bin/bash
gitbranch() {
while read data; do
cd $data
git stash
git checkout $1 | cat
git pull
cd ..
echo
@rrajendran
rrajendran / gitpull
Created February 11, 2013 22:00
Pulls all the project in a given directory usage: ./gitpull.sh
#!/bin/bash
gitpull() {
while read data; do
cd $data
git pull | cat
echo -e
cd ..
done
}
@rrajendran
rrajendran / databaseContext.xml
Last active December 13, 2015 19:08
Spring database context configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
@rrajendran
rrajendran / BaseDao.java
Last active December 18, 2015 13:19
JPA Dao Layer with default implementation by an abstract class. This is something similar to CrudRepository in spring data jpa
import java.io.Serializable;
public interface BaseDao<T, ID extends Serializable> {
/**
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
* entity instance completely.
*
* @param entity
* @return the saved entity
*/
@rrajendran
rrajendran / blueprint.xml
Last active March 20, 2021 01:22
Spring osgi service exported and imported by Blueprint. Basically if you want to share spring services with blueprint, this is the work around which worked from me.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<reference id="helloBean" interface="com.osgi.HelloWorldInterface"/>
<bean id="sageMasterStockService" class="com.osgi.blueprint.impl.HelloWorldService">
<property name="helloBean" ref="helloBean"/>
delimiter //
CREATE PROCEDURE simpleproc (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t;
END//
delimiter ;
<jdbc:initialize-database data-source="dataSource" >
<jdbc:script execution="INIT" separator="//" location="classpath:/scripts/StoredProcedures/*.sql"/>
</jdbc:initialize-database>
$$
CREATE PROCEDURE simpleproc (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t;
END
$$
@rrajendran
rrajendran / gist:8556604
Created January 22, 2014 10:33
Delete all *.orig files in mercurial repository
alias clear-orig='find . -iname "*.orig" -exec rm "{}" ";"'
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.cert.CertificateException;