Uses R to create bar plots of region server writes.
-
Save the sample data into ~/tmp/region-data.csv
-
Install R and start R console
; Note: This script requires lein exec | |
; Follow instructions for installing lein and lein-exec | |
; Then run this as lein exec snipr.clj FILE.md | |
(require '[clojure.string :as str]) | |
(require '[clojure.java.io :as io]) | |
(defn load-script [script] | |
(load-file | |
(->> [(System/getenv "HOME") "Dropbox" "Env" "clj" script] (str/join "/")))) |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import org.apache.crunch.DoFn; | |
import org.apache.crunch.Emitter; | |
import org.apache.crunch.PipelineResult; | |
import org.apache.crunch.io.From; | |
import org.apache.crunch.io.To; | |
import org.apache.crunch.types.writable.Writables; | |
import org.apache.crunch.util.CrunchTool; |
# Build and run then open browser to http://localhost:9000/hello.html. | |
# Then open browser console. It has an error message like this: | |
# Uncaught TypeError: Cannot read property 'Jf' of undefined hello.js:6587 | |
# Also the REPL hangs. | |
# If I replace :advanced with :whitespace in project.clj then the browser | |
# console reports no errors. Also the REPL works fine. | |
# Make test directory. | |
mkdir -p $HOME/tmp/cljs-test |
import java.io.*; | |
import org.apache.hadoop.conf.*; | |
import org.apache.hadoop.fs.*; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapreduce.*; | |
import org.apache.hadoop.mapreduce.lib.input.*; | |
import org.apache.hadoop.mapreduce.lib.output.*; | |
import org.apache.hadoop.mapreduce.lib.partition.*; | |
import org.apache.hadoop.mapreduce.lib.reduce.*; |
# To run a command on all 4 hosts type: ethm COMMAND | |
# For example: ethm hostname | |
# You can also type: | |
# | |
# eth COMMAND # Run COMMAND on elephant, tiger, horse | |
# thm COMMAND # Run COMMAND on tiger, horse, monkey | |
# h COMMAND # Run COMMAND on horse | |
# m COMMAND # Run COMMAND on monkey | |
# | |
# And so on. |
(function() { | |
/** | |
* My JavaScript library. | |
* | |
* @author [your name here] | |
*/ | |
/** | |
* @class A namespace is a collection of functions and classes. |
package core; | |
import java.io.*; | |
import java.net.*; | |
/** | |
* Useful utility functions. | |
*/ | |
public class Util { |
by Asim Jalis, MetaProse.com
An interactive shell is useful for quickly trying out different commands. While Ruby, Python, and Clojure come with interactive shells, Perl does not. However, it is easy to create one using this one-liner on Unix systems:
perl -e 'do{print("perl> ");$_x=<>;chomp $_x;print(eval($_x)."\n")}while($_x ne "q")'
by Asim Jalis, MetaProse.com
Here are the steps for how to write bat and cmd files with C#.
Here is the problem this solves: Frequently I just want to write a short C# snippet. I don't want to write it as a source file, compile it, and run it. I'd rather just put the snippet in a bat file and run the bat file. I want to shorten the code-compile-execute loop to just code-execute.
The following steps show you how to create CSBat.exe which solves this problem. Note: The in-memory compiler code was taken from Don Box's CSRepl from his blog.