Skip to content

Instantly share code, notes, and snippets.

View Heredoc.java
// Derived from : http://blog.efftinge.de/2008/10/multi-line-string-literals-in-java.html
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class Heredoc {
public static String S() {
StackTraceElement element = new RuntimeException().getStackTrace()[1];
@javadba
javadba / cltools.sh
Created Nov 26, 2016 — forked from justinbellamy/cltools.sh
Install Autoconf and Automake on OS X El Capitan
View cltools.sh
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@javadba
javadba / ha-core-site.xml
Created Oct 23, 2015
ha core-site.xml without kerberos
View ha-core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@javadba
javadba / ha-dfs-site.xml
Created Oct 23, 2015
ha hdfs-site.xml without kerberos
View ha-dfs-site.xml
configuration>
<property>
<name>dfs.datanode.data.dir</name>
<value>/mnt/hadoop/hdfs/data</value>
<final>true</final>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
@javadba
javadba / getProcessingCpuLoad.scala
Created Sep 17, 2015
getProcessingCpuLoad thread
View getProcessingCpuLoad.scala
val latch = new java.util.concurrent.CountDownLatch(1)
val t = new Thread() {
override def run() = {
var x = 1.0
val startt = System.currentTimeMillis
for (i <- 1 to lnLoops) {
x = (x * math.pow(i, 1.2) * i) /
(math.pow(x, 1.5) * math.sqrt(i) * math.max(math.abs(math.cos(x)), 0.1) * math.pow(i, 1.21))
}
println(s"X=$x duration=${System.currentTimeMillis-startt}")
View javadbaEtreOnMBPro.doc
EtreCheck version: 2.2 (132)
Report generated 7/21/15, 7:36 PM
Download EtreCheck from http://etresoft.com/etrecheck
Click the [Click for support] links for help with non-Apple products.
Click the [Click for details] links for more information about that line.
Hardware Information: ℹ️
MacBook Pro (Retina, Mid 2012) (Verified)
MacBook Pro - model: MacBookPro10,1
@javadba
javadba / gist:5552140
Created May 10, 2013
Concise string interpolation in python
View gist:5552140
def tostr(msg, inhash=locals()):
import StringIO
outstr = StringIO.StringIO()
print >> outstr, msg % inhash
return outstr.getvalue()
usage example:
s="Some message from %(froma)s \n on the %(day)d of %(month)s %(year)d \n Says %(message)s\n"
View gist:5078682
# Assumes you have Sun JDK installed already and JAVA_HOME set to that for root
# This is all basically a summary of various parts of https://ccp.cloudera.com/display/CDH4DOC/CDH4+Documentation
# Add Cloudera RPM-GPG-KEY and repo
rpm --import http://archive.cloudera.com/cdh4/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
rpm -ivh http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-cdh-4-0.x86_64.rpm
# Install CDH4 Base
yum install hadoop-0.20-conf-pseudo
You can’t perform that action at this time.