Skip to content

Instantly share code, notes, and snippets.

View manisnesan's full-sized avatar
🎯
Focusing

Manikandan Sivanesan` manisnesan

🎯
Focusing
View GitHub Profile
@manisnesan
manisnesan / cleanM2
Created May 15, 2014 17:53
Maven Housekeeping in Jenkins
#!/bin/bash
#
# This script cleans up m2 repository SNAPSHOT jars that are older than specified $AGE days in Jenkins host.
#
#
M2_REPO=/usr/share/tomcat6/.m2
OLDFILES=/tmp/oldfiles.txt
AGE=21
echo "Starting M2 directory clean up "
@manisnesan
manisnesan / python skeleton
Created August 4, 2014 00:24
Skeleton of Python program
#!/usr/bin/env python
"""
SYNOPSIS
TODO helloworld [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how to use this script. This docstring
will be printed by the script if there is an error or
@manisnesan
manisnesan / fib.py
Created August 4, 2014 00:49
Three different ways to compute fibonacci
#!/usr/bin/env python
def fib_iterative(n):
a,b = 1,1
for i in range(n - 1):
a,b = b,a+b
return a
def fib_recursive(n):
if (n == 1 or n == 2 ):
/**
* Sample Method to convert the inputstream feed from GSA to JaxB class Gsafeed
*/
public Gsafeed parseRecords(InputStream feedInputStream) {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
spf.setFeature("http://xml.org/sax/features/validation", false);
spf.setNamespaceAware(true); // Binding attributes
EntityResolver entityResolver = new EntityResolver() {
@manisnesan
manisnesan / integration-test-profile
Created August 20, 2014 14:31
Profile for integration tests in maven
<!-- To run $mvn install -Pintegration-tests -->
<profiles>
<profile>
<id>integration-tests</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
#!/bin/bash
JENKINS_CURRENT=$(df /usr/share/tomcat6/.jenkins | grep / | awk '{ print $5}' | sed 's/%//g')
#ROOT_CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=95
#THRESHOLD=5
if [ "$JENKINS_CURRENT" -gt "$THRESHOLD" ]
then
echo
@manisnesan
manisnesan / diskUsage.sh
Created August 22, 2014 17:28
Display the top 10 large files in the current directory
du -hsx * | sort -rh | head -10
@manisnesan
manisnesan / 01_equalities.clij
Created August 29, 2014 04:38
Clojure-Equalities
(ns koans.01-equalities
(:require [koan-engine.core :refer :all]))
(meditations
"We shall contemplate truth by testing reality, via equality"
(= true true)
"To understand reality, we must compare our expectations against reality"
(= 2 (+ 1 1))
@manisnesan
manisnesan / 02_lists.clj
Created August 29, 2014 04:39
Clojure-Lists
(ns koans.02-lists
(:require [koan-engine.core :refer :all]))
(meditations
"Lists can be expressed by function or a quoted form"
(= '(1 2 3 4 5 ) (list 1 2 3 4 5))
"They are Clojure seqs (sequences), so they allow access to the first"
(= 1 (first '(1 2 3 4 5)))