Skip to content

Instantly share code, notes, and snippets.

View dileeph's full-sized avatar

Dileep Hareendran dileeph

View GitHub Profile
@dileeph
dileeph / jooq-batch-insert-list
Created June 28, 2012 14:57
JOOQ - Batch inserting a list of records (not shown in JOOQ tutorial)
@Test
public void testBatch(){
/*Preparing sample data. */
MzRolesRecord admin = new MzRolesRecord();
admin.setCreatedDate(new Timestamp(System.currentTimeMillis()));
admin.setRoleDesc("Admin");
MzRolesRecord user = new MzRolesRecord();
user.setCreatedDate(new Timestamp(System.currentTimeMillis()));
@dileeph
dileeph / gist:3060105
Created July 6, 2012 13:18
JooQ - groupBy with function issue - ORA000979
public static Field<String> toChar(Field<Timestamp> timestampField,
String format) {
return Factory.function("to_char", String.class, timestampField,
Factory.val(format));
}
@Test
public void testToChar() {
@dileeph
dileeph / gist:786f097276a451e6142a
Created January 2, 2016 05:10
Github commit steps
Committing project to own repository for first time
//Configure username, email
git config --global user.name "userx"
git config --global user.email "[email protected]"
//Go to the folder where code is to be committed first time into repo (assuming repo //exists and no code present)
git init
//First thing will be to add the test-service project folder with all subfolders and //files into local repository.
@dileeph
dileeph / gist:c5f9eae2f971d91e1dda
Created January 2, 2016 05:12
Getting List of Objects with RestTemplate in Spring
RestTemplate restTemplate = new RestTemplate();
try {
ResponseEntity<List<Claim>> claimResponse = restTemplate.exchange(
uri,
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<Claim>>() {});
if(claimResponse != null && claimResponse.hasBody()){
claims = claimResponse.getBody();
@dileeph
dileeph / gist:8d5a23220db55955fa36
Created January 2, 2016 23:11
jenkins-workflow-example-1
stage 'Dev'
node {
git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
mvn 'clean package'
}
def mvn(args) {
sh "${tool 'M3'}/bin/mvn ${args}"
}
@dileeph
dileeph / gist:456755d11c1c6d6f0a56
Last active January 5, 2016 00:03
kubernetes-json-files
{
"kind": "ReplicationController",
"apiVersion": "v1",
"metadata": {
"name": "claims-web-controller",
"labels": {
"state": "serving"
}
},
@dileeph
dileeph / jenkins-workflow-docker-stash
Created January 5, 2016 21:50
jenkins workflow using 'stash' to pass files between two docker containers
node{
docker.image('buildpack-deps:jessie-scm').inside {
sh "echo 'hello' >> a.txt"
stash includes: 'a.txt', name: 'pom'
}
docker.image('buildpack-deps:jessie-scm').inside {
unstash 'pom'
sh "cat a.txt"
}
@dileeph
dileeph / authenticated-rest-call
Created January 7, 2016 00:42
authenticated-rest-call
package com.dh.ts.repo;
import java.net.URI;
import java.nio.charset.Charset;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@dileeph
dileeph / namespace json
Created May 3, 2016 21:00
namespace json for kubernetes
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "geolocus-ns"
}
}
@dileeph
dileeph / resource quota json
Last active May 3, 2016 21:09
resource quota json for a kubernetes namespace
{
"apiVersion": "v1",
"kind": "ResourceQuota",
"metadata": {
"name": "bs-quota"
},
"spec": {
"hard": {
"memory": "1Gi",
"cpu": "1",