Skip to content

Instantly share code, notes, and snippets.

import org.apache.spark._
import org.apache.spark.graphx._
val triplets = sc.textFile(path).flatMap { line =>
if (!line.isEmpty && line(0) != '#') {
val lineArray = line.split("\\s+")
if (lineArray.length < 2) {
None
} else {
val t = new EdgeTriplet[String, String]
@inket
inket / heroku-youtube-dl.rb
Last active February 2, 2016 15:02
heroku-youtube-dl
# Usage:
# ruby -e "$(curl <url_to_this_raw_gist>)" https://www.youtube.com/watch?v=Jo1tjBmwuXI
youtube_url = ARGV[0]
puts "YouTube URL: #{youtube_url}"
`mkdir youtube`
Dir.chdir "youtube"
`curl https://yt-dl.org/downloads/2014.10.13/youtube-dl > youtube-dl`
@prabhatkashyap
prabhatkashyap / CasperJS_in_scroll_pagination.js
Last active August 29, 2015 14:06
CasperJS is an open source navigation scripting & testing utility written in Javascript for the PhantomJS WebKit headless browser and SlimerJS (Gecko)
var casper = require('casper').create({
verbose: true,
logLevel: 'error',
pageSettings: {
loadImages: false,
loadPlugins: false,
userAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36'
}
});
@ueshin
ueshin / sparkmeetup.md
Created September 8, 2014 08:49
Spark SQL samples for Spark Meetup
@sujee
sujee / named.scala
Created September 2, 2014 20:42
named RDD
override def runJob(sc: SparkContext, config: Config): Any = {
val fileName = config.getString("input.file")
logger.info("### fileName : " + fileName)
var rdd = this.namedRdds.get[String](fileName)
logger.info("### rdd load 1 : " + rdd)
if (rdd.isDefined) {
logger.info("### rdd %s isDefined".format(fileName))
}
else {
logger.info("### rdd %s doesn't exist... loading".format(fileName))
@staltz
staltz / introrx.md
Last active May 12, 2025 23:22
The introduction to Reactive Programming you've been missing
@aslakknutsen
aslakknutsen / start_testing_java8_today.asciidoc
Last active October 2, 2024 15:10
Example of how to use both JDK 7 and JDK 8 in one build.

JDK 8 Released

Most of us won’t be able to use/deploy JDK 8 in production for a looong time. But that shouldn’t stop us from using it, right?

It should be possible to sneak in JDK 8 in the back way, the same way we snuck in Groovy and other libraries we wanted to use.

The Test Suite to the rescue

The Maven compiler plugin run in two separate lifecycles, compile and testCompile. Those can be configured separately.

@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@paulstatezny
paulstatezny / patterns-of-enterprise-application-architecture.md
Last active March 5, 2025 19:48
Notes from Patterns of Enterprise Application Architecture by Martin Fowler

Patterns of Enterprise Application Architecture

By Martin Fowler (2002)

Chapter 1: Layering

A basic example of layering: FTP < TCP < IP < Ethernet

Benefis of layering:

  • You can understand a layer without knowing much about the others.
  • Minimize dependencies.
@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active October 9, 2022 21:57
How Akka maps to EAI Patterns
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html