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
# utility function for your profile to search history | |
hgrep(){ | |
history | grep $1 | sort -k 2 | uniq -c -f 1 | sort | |
} |
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
sed -e 's/NumberLong("*\(-*[[:digit:]]*\)"*)/{ "$numberLong" : "\1" }/' -e 's/ObjectId("*\([[:alnum:]]*\)"*)/{ "$oid" : "\1 | |
" }/' |
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
implicit class ProductRDD[T <: Product](rdd: RDD[T]) { | |
/* Saves a RDD of Tuples into a TSV. | |
* Ex: Employee(emp_id = 123, Name(first="Bob",last="Smith")) => "123\tBob\tSmith" | |
*/ | |
def saveAsTsv(path: String) { | |
rdd.map(p => p.productIterator.flatMap { | |
case a: Product => a.productIterator //flattens nested case classes | |
case b => Seq(b) | |
}.mkString("\t")) |
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
/* Example using MultipleOutputs to write a Spark RDD to multiples files. | |
Based on saveAsNewAPIHadoopFile implemented in org.apache.spark.rdd.PairRDDFunctions, org.apache.hadoop.mapreduce.SparkHadoopMapReduceUtil. | |
val values = sc.parallelize(List( | |
("fruit/items", "apple"), | |
("vegetable/items", "broccoli"), | |
("fruit/items", "pear"), | |
("fruit/items", "peach"), | |
("vegetable/items", "celery"), | |
("vegetable/items", "spinach") |
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 org.apache.avro.Schema; | |
import org.apache.avro.io.BinaryData; | |
import org.apache.avro.mapred.AvroKey; | |
import org.apache.avro.mapred.Pair; | |
import org.apache.avro.mapreduce.AvroJob; | |
import org.apache.avro.reflect.ReflectData; | |
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.conf.Configured; | |
import org.apache.hadoop.io.RawComparator; |
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
;; Embedded Solr Example | |
(def server (create-solr-server | |
{:type :embedded :core "mycore" :dir "/home-path"})) | |
;; Http Solr Example | |
(def server (create-solr-server | |
{:type :http :host "localhost"})) | |
;; Adding Documents | |
(add server {:title "Don Quixote" |
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 my-credentials | |
(struct credentials "my-token" "my-client-name")) | |
(get-users my-credentials) | |
(get-projects my-credentials) | |
(get-tags my-credentials) | |
(get-entries my-credentials) | |
(get-entries my-credentials | |
{:to "iso-date-string" :from "iso-date-string"}) |
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
TocClient tc = new TocClient(); | |
tc.Message += new MessageEventHandler(OnMessage); | |
tc.SignOn("myscreenname","password"); | |
tc.StartListening(); | |
... | |
protected void OnMessage(object sender, MessageEventArgs e){ | |
WriteLine("{0}: {1}",e.From, e.Message); | |
} |
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
TocClient tc = new TocClient(); | |
tc.SignOn("myscreenname","password"); | |
tc.Send("mybuddy","Hello!"); | |
tc.SignOff(); |
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
<%@ Register TagPrefix="fluent" Namespace="Fluent.LogicTemplates" Assembly="Fluent.LogicTemplates" %> | |
<html> | |
<head> | |
<script language="C#" runat="server"> | |
private void Page_Load(object sender, System.EventArgs e) { | |
if(!IsPostBack){ | |
BindDataList(); | |
} | |
} |
NewerOlder