Skip to content

Instantly share code, notes, and snippets.

@berngp
berngp / ClientBase.scala
Created April 8, 2014 00:04
Bad Things On Code.
// somewhere inside some cool framework
val classpathEntries = Option(conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH)).
getOrElse(getDefaultYarnApplicationClasspath())
// where
def getDefaultYarnApplicationClasspath(): Array[String] = {
try {
val field = classOf[MRJobConfig].getField("DEFAULT_YARN_APPLICATION_CLASSPATH")
@berngp
berngp / snippet_from_dot_zshrc.sh
Last active August 29, 2015 13:58
Dealing with Java 8 and 7 in the same Environment.
# snippet from my ~/.zshrc file.
export JAVA7_HOME="$(/usr/libexec/java_home -v 1.7)"
function with-jdk7
{
export JAVA_HOME="$JAVA7_HOME"
echo "$@"
$@
}
val r = 0.0 to 1.1 by 0.1
( ( r drop 2 ) drop 2 ) take 2 // doesn't work.
val r = BigDecimal(0.0) to 1.1 by 0.1
( ( r drop 2 ) drop 2 ) take 2 // does work.
@berngp
berngp / .gitconfig
Created March 30, 2014 05:27
dot.gitconfig
[user]
name = Your Name
email = [email protected]
[color]
ui = true
[core]
excludesfile = ~/.gitignore_global
editor = /usr/local/bin/mvim -f
@berngp
berngp / spark-xshell.sh
Created March 21, 2014 06:36
Spark Extended Shell
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
#
@berngp
berngp / .ctags
Last active August 29, 2015 13:57
Dot Files
--recurse=yes
--tag-relative=yes
--exclude=.git
--exclude='*/target/*'
--exclude=target
--exclude=vendor
--langdef=scala
--langmap=scala:.scala
--regex-scala=/^[ \t]*((abstract|final|sealed|implicit|lazy)[ \t]*)*((private|protected)(\[[a-zA-Z0-9_.]+\])?)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\6/c,classes/
@berngp
berngp / mesos-kpis.sh
Created March 1, 2014 02:46
Mesos KPIs
#!/usr/bin/env python
import collections
import datetime
import json
import signal
import sys
from contextlib import closing
from optparse import OptionParser
@berngp
berngp / bootstrap_automake_112.sh
Last active December 29, 2015 09:29
Bootstrap Mesos with Automake and Aclocal 1.12
AUTOMAKE="$(which automake-1.12)" ACLOCAL="$(which aclocal-1.12)" ./bootstrap
@berngp
berngp / master_state.json
Last active December 28, 2015 04:19
Example of the of Mesos Monitor Statistics JSON (monitor/statistics.json)
{
"activated_slaves": 1,
"build_date": "2013-11-07 10:40:03",
"build_time": 1383849603,
"build_user": "bernardo",
"completed_frameworks": [
{
"active": 1,
"completed_tasks": [
{
@berngp
berngp / Warning-motd.txt
Created July 16, 2013 18:40
IPTABLES disabled warning!
_ _ ___ ______ _ _ _____ _ _ _____
| | | |/ _ \ | ___ \ \ | |_ _| \ | | __ \
| | | / /_\ \| |_/ / \| | | | | \| | | \/
| |/\| | _ || /| . ` | | | | . ` | | __
\ /\ / | | || |\ \| |\ |_| |_| |\ | |_\ \
\/ \/\_| |_/\_| \_\_| \_/\___/\_| \_/\____/
IPTABLES DISABLED!!!! ______________
ALL PORTS ARE OPEN. ,===:'., `-._