Skip to content

Instantly share code, notes, and snippets.

# The data set used in this example is from http://archive.ics.uci.edu/ml/datasets/Wine+Quality
# P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis.
# Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547-553, 2009.
import os
import warnings
import sys
import random
import pandas as pd
hbase.ss.jmx> (p/print-table [:host :blockCacheEvictedCount :blockCacheCount :blockCacheFree :blockCacheSize]
(map #(-> %
(j/massager :blockCacheFree (fn [x] (str (float (/ x 1024 1024)) "MB")))
(j/massager :blockCacheSize (fn [x] (str (float (/ x 1024 1024)) "MB")))
(j/massager :host (fn [x] "Some host.")))
(j/get-regionserver-metrics [:blockCacheEvictedCount
:blockCacheCount
:blockCacheFree
:blockCacheSize])))
===========================================================================================
@nipra
nipra / pom.xml
Created May 14, 2013 08:52 — forked from jnatkins/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Replace the group ID with your group ID -->
<groupId>com.mycompany.hadoopproject</groupId>
<!-- Replace the artifact ID with the name of your project -->
<artifactId>my-hadoop-project</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@nipra
nipra / notes.txt
Created November 13, 2012 10:04
CDH4 Hadoop + HBase Pseudo-distributed Mode installation
# Installing CDH4 on a Single Linux Node in Pseudo-distributed Mode
# https://ccp.cloudera.com/display/CDH4DOC/Installing+CDH4+on+a+Single+Linux+Node+in+Pseudo-distributed+Mode
# Installing CDH4 with MRv1 on a Single Linux Node in Pseudo-distributed mode
# On Ubuntu and other Debian systems
nipra@lambda:Downloads$ wget -cv http://archive.cloudera.com/cdh4/one-click-install/precise/amd64/cdh4-repository_1.0_all.deb
nipra@lambda:Downloads$ sudo dpkg -i cdh4-repository_1.0_all.deb # Adds /etc/apt/sources.list.d/cloudera-cdh4.list ??
nipra@lambda:Downloads$ dpkg -L cdh4-repository # To view the files on Ubuntu systems
# Install CDH4
@nipra
nipra / row_count_with_prefix.clj
Created October 31, 2012 17:39
Count rows starting with prefix
(let [f1 (PrefixFilter. (hb/to-bytes "0 "))]
(hb/with-table [table (hb/table "foo_bar_table")]
(hb/with-scanner [scanner (hb/scan table
:filter f1
:caching 1000)]
(loop [n 0]
(if (seq (.next scanner 1000))
(recur (+ n (count (.next scanner 1000))))
n)))))
scratch> (s/deserialize "some data" :bytes)
; Evaluation aborted.
scratch> (s/deserialize "{\"language\":\"Clojure\",\"library\":\"serialism\",\"authors\":[\"Michael\"]}"
:json)
; Evaluation aborted.
@nipra
nipra / hello-world.lisp
Created May 9, 2012 10:54
Hello World!
;;; http://www.xach.com/lisp/buildapp/
;;; buildapp --output hello-world --asdf-path ~/asds/ --load hello-world.lisp --entry main
;;; nipra@unlambda:~/Projects/CL$ ./hello-world
(in-package :cl-user)
(defun main (argv)
(declare (ignore argv))
(format t "Hello World!~%"))
@nipra
nipra / project.clj
Created February 13, 2012 04:03
test project
(defproject scratch "1.0.0-SNAPSHOT"
:description "FIXME: write description"
;; http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22
;; http://dev.clojure.org/display/doc/Clojure+Contrib
;; http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
:dependencies [[org.clojure/clojure "1.3.0"]
[org.mongodb/mongo-java-driver "2.6.3"]
[postgresql/postgresql "9.0-801.jdbc4"]
[mysql/mysql-connector-java "5.1.18"]
[org.apache.lucene/lucene-core "3.4.0"]
@nipra
nipra / project.clj
Created February 12, 2012 18:42
Scratch project
(defproject scratch "1.0.0-SNAPSHOT"
:description "FIXME: write description"
;; http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.clojure%22
;; http://dev.clojure.org/display/doc/Clojure+Contrib
;; http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
:dependencies [[org.clojure/clojure "1.3.0"]
[org.mongodb/mongo-java-driver "2.6.3"]
[postgresql/postgresql "9.0-801.jdbc4"]
[mysql/mysql-connector-java "5.1.18"]
[org.apache.lucene/lucene-core "3.4.0"]
@nipra
nipra / groupby_ex.clj
Created September 26, 2011 08:38
group-by example
user> (group-by #(cond (and (> % 10)
(< % 20))
:between-10-20
(and (> % 30)
(< % 40))
:between-30-40
(and (> % 90)
(< % 100))