Skip to content

Instantly share code, notes, and snippets.

@exAspArk
exAspArk / self-signed-ssl-mongo.sh
Last active April 6, 2024 19:38
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

@leonardofed
leonardofed / README.md
Last active May 3, 2024 01:24
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@xrstf
xrstf / setup.md
Last active October 3, 2022 13:30
Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 Setup

Info

This guide sets up a non-clustered Nutch crawler, which stores its data via HBase. We will not learn how to setup Hadoop et al., but just the bare minimum to crawl and index websites on a single machine.

Terms

  • Nutch - the crawler (fetches and parses websites)
  • HBase - filesystem storage for Nutch (Hadoop component, basically)
@chaotic3quilibrium
chaotic3quilibrium / DIY Scala Enumeration - README.txt
Last active September 13, 2020 22:20
DIY Scala Enumeration (closest possible Java Enum equivalent with guaranteed pattern matching exhaustiveness checking)
README.txt - DIY Scala Enumeration
Copyright (C) 2014-2016 Jim O'Flaherty
Overview:
Provide in Scala the closest equivalent to Java Enum
- includes decorating each declared Enum member with extended information
- guarantees pattern matching exhaustiveness checking
- this is not available with scala.Enumeration
ScalaOlio library (GPLv3) which contains more up-to-date versions of both `org.scalaolio.util.Enumeration` and `org.scalaolio.util.EnumerationDecorated`:
@davegurnell
davegurnell / error-handling-in-scala.md
Created September 5, 2014 10:25
Error handling in Scala

Error Handling in Scala

Scala does not have checked exceptions like Java, so you can't do soemthing like this to force a programmer to deal with an exception:

public void stringToInt(String str) throws NumberFormatException {
  Integer.parseInt(str)
}
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@loicdescotte
loicdescotte / streamFile.md
Last active September 15, 2017 09:17
Stream and transform file with Play

Chunck by chunk

def  transform = Action {
    
     val fileStream: Enumerator[Array[Byte]] = {
         Enumerator.fromFile(new File("data.txt"))
     }
     
     val transfo = Enumeratee.map[Array[Byte]]{byteArray =>  
scala> :javap MongoDB
public class MongoDB$ extends java.lang.Object {
public static final MongoDB$ MODULE$; // actual instance of our `object`
public static {};
public MongoDB$();
// ...
}
@sadache
sadache / gist:4714280
Last active July 14, 2022 15:09
Playframework: Async, Reactive, Threads, Futures, ExecutionContexts

Asynchronicity is the price to pay, you better know what you're paying for...

Let's share some vocabulary first:

Thread: The primitive responsible of executing code on the processor, you can give an existing (or a new) Thread some code, and it will execute it. Normally you can have a few hundreds on a JVM, arguments that you can tweak your way out to thousands. Worth noting that multitasking is achieved when using multiple Threads. Multiple Threads can exist for a single processor in which case multitasking happens when this processor switches between threads, called context switching, which will give the impression of things happenning in parallel. An example of a direct, and probably naive, use of a new Thread in Java:

public class MyRunnable implements Runnable {
  public void run(){
 System.out.println("MyRunnable running");