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
import java.util.concurrent.ArrayBlockingQueue | |
trait OptionNextToIterator[T] extends Iterator[T] { | |
def getOptionNext: Option[T]; | |
var answerReady: Boolean = false | |
var eof: Boolean = false | |
var element: T = _ | |
def hasNext = { |
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
/* | |
Test your JKS file easily. | |
You have created a java JKS trust store file to access a webservice with a certificate, and you want to test if it works? | |
Some colleagues often test this by deploying the jks to the application server (tomcat, weblogic...), restarting the server and manually running tests, | |
and repeating this procedure until the jks is properly created. | |
you can speed up this test by using this simple java program: | |
> javac TestJKS.java |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>david.rundeck</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/david/bin/rundeck/server/sbin/rundeck_launchd</string> | |
</array> |
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 | |
# use this script as follows: find . -mount -exec dstat {} \; | |
# this produces a list as follows: | |
# Regular File -rw-r--r-- david staff 2013-11-09 01:33:24 2013-11-09 01:33:24 14787 c3a7afd9e3cf89543352ee58e26cfb10 Invoice_41010102336895558_6601081486112013.pdf pdf ./accounting/files/Invoice_41010102336895557_6601081486112013.pdf | |
# Regular File -rw-r--r-- david staff 2013-09-01 00:41:05 2013-09-01 00:41:05 13636 55b47d2a41d5d6a072439ef2dabacac4 Invoice_41010102336895558_6601108809092013.pdf pdf ./accounting/files/Invoice_41010102336895557_6601108809092013.pdf | |
# ... | |
# see http://linux.die.net/man/1/stat for more stat options | |
if [ -z "$1" ] ; then |
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
def hasharray2hash(array, hash_key) | |
if (!array.kind_of?(Array) || !hash_key.kind_of?(String)) | |
raise 'invalid parameters' | |
end | |
array.reduce({}){|cumulate,entry| | |
if !entry.kind_of?(Hash) | |
raise 'expecting a hash: ' + entry.to_s | |
end | |
key = entry[hash_key] |
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
+++++++++++++++++++++++++++++ | |
+++ EXECUTING JAVA. CMD: java -version +++ start provisioning +++ | |
+++ EXECUTING JAVA. time: 20140410-093331 | |
+++ EXECUTING JAVA. java: /usr/java/jdk1.7.0_51/jre/bin/java | |
+++ EXECUTING JAVA. cp: | |
+++ EXECUTING JAVA. user: root | |
+++ EXECUTING JAVA. running. log: /tmp/log_puppet_weblogic/log-20140410-093331.txt | |
+++ EXECUTING JAVA. cat /tmp/log_puppet_weblogic/log-20140410-093331.txt. START. | |
java version "1.7.0_51" | |
Java(TM) SE Runtime Environment (build 1.7.0_51-b13) |
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
# here there is a guide about contributing to puppet: | |
# https://github.com/puppetlabs/puppet/blob/master/docs/quickstart.md | |
# It says: | |
# Quick Start to Developing on Puppet | |
# Before diving into the code, you should first take the time to make sure you have an environment where you can run puppet as a developer. | |
# In a nutshell you need: the puppet codebase, ruby versions, and dependencies. | |
# Once you've got all of that in place you can make sure that you have a working development system by running the puppet spec tests. | |
# | |
# I didn't manage to install all this in my OSX without breaking other dependencies, so I created a vagrant box with Ubuntu. | |
# I share here this set-up, so that it can be reproduced easily by anyone. |
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
import java.io.File | |
import org.apache.tika.detect._ | |
import org.apache.tika.metadata._ | |
import org.apache.tika.mime._ | |
import org.apache.tika.io._ | |
import org.apache.tika.parser.txt._ | |
import resource._ | |
def recursiveListFiles(f: File): List[File] = { | |
val these = f.listFiles.toList |
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 amm | |
// This script converts Maven dependencies from a pom.xml to sbt dependencies. | |
// It is based on the answers of George Pligor and Mike Slinn on http://stackoverflow.com/questions/15430346/ | |
// - install https://github.com/lihaoyi/Ammonite | |
// - make this script executable: chmod +x PomDependenciesToSbt | |
// - run it with from your shell (e.g bash): | |
// $ ./PomDependenciesToSbt /path/to/pom.xml | |
import scala.xml._ |
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
val sparkVersion = "1.6.1" | |
val hbaseVersion = "0.98.7-hadoop2" | |
name := "spark-examples" | |
version := sparkVersion | |
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint") | |
initialize := { |
OlderNewer