Skip to content

Instantly share code, notes, and snippets.

Ganesh Chand ganeshchand

Block or report user

Report or block ganeshchand

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Scala - Extractor and Pattern Matching.scala
trait User {
def name: String
}
//class FreeUser(name: String, upgradeProbality: Double) extends User
//class PremiumUser(name: String, loaltyPoint: Double) extends User
//val user1 = new FreeUser("John", 0.75)
//println(user1.name) doesn't work
@ganeshchand
ganeshchand / Mail.scala
Created Mar 7, 2017 — forked from mariussoutier/Mail.scala
Sending mails fluently in Scala
View Mail.scala
package object mail {
implicit def stringToSeq(single: String): Seq[String] = Seq(single)
implicit def liftToOption[T](t: T): Option[T] = Some(t)
sealed abstract class MailType
case object Plain extends MailType
case object Rich extends MailType
case object MultiPart extends MailType
View Mac Terminal Shortcuts
Ctrl + a go to the start of the command line
Ctrl + e go to the end of the command line
Ctrl + k delete from cursor to the end of the command line
Ctrl + u delete from cursor to the start of the command line
Ctrl + w delete from cursor to start of word (i.e. delete backwards one word)
@ganeshchand
ganeshchand / IntelliJ Out-of-memory Troubleshooting
Created Jul 18, 2016
IntelliJ Out-of-memory Troubleshooting
View IntelliJ Out-of-memory Troubleshooting
Check Memory usage:
println(sys.runtime.totalMemory())
println(sys.runtime.maxMemory())
println(sys.runtime.freeMemory())
Often, Scala or Spark program will throw Spark driver and executor will be entirely running inside the JVM that is running your code shown here that creates the SparkContext.
By that time, it's too late to obtain more Java heap than was allocated when the JVM started. You need to add that -Xmx1G arg to the
command IntelliJ uses to launch the JVM that runs your code.
View Apache Flink Getting Started
View Adding SSH key in github
If you have already a git repository in your computer, login to github, create a repository. It should give you a link to remote origin.
adding an existing repo to remote repository:
You need to decide whether to use ssh or https. If you use https, you get prompted for github userid/password everytime you push.
So, using ssh is preferred.
Follow these steps if you haven't added SSH key of the computer you are working with into your github account.
``
ssh-keygen -t rsa -b 4096 -C "your email adddress"
ssh-add ~/.ssh/id_rsa
pbcopy < ~/.ssh/id_rsa.pub // this copies SSH key to clipboard
``
@ganeshchand
ganeshchand / Spark Streaming
Created May 26, 2016
Spark Streaming notes
View Spark Streaming
http://www.michael-noll.com/blog/2014/10/01/kafka-spark-streaming-integration-example-tutorial/
View Computer algorithm
http://demo.learningequality.org/learn/khan/computing/computer-science/algorithms/intro-to-algorithms/what-are-algorithms/
@ganeshchand
ganeshchand / Spark Open Source
Created May 18, 2016
Spark Open Source Project
View Spark Open Source
Contributing to Spark project - https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark
View BasicOperations.scala
object ScalaJSExample extends js.JSApp{
def main() = {
val xs = Seq(1, 2, 3)
println(xs.toString)
val ys = Seq(4, 5, 6)
println(ys.toString)
val zs = for{
x <- xs
y <- ys
} yield x * y
You can’t perform that action at this time.