NOTE: 534 stars, 106 forks. I love you all. Please contribute tips and edits back to this cheat sheet -- email's [email protected] and you can treat gists like git repositories and send git diffs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- To run $mvn install -Pintegration-tests --> | |
<profiles> | |
<profile> | |
<id>integration-tests</id> | |
<activation> | |
<activeByDefault>false</activeByDefault> | |
</activation> | |
<build> | |
<plugins> | |
<plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -hsx * | sort -rh | head -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
OlderNewer