Skip to content

Instantly share code, notes, and snippets.

@ruurtjan
ruurtjan / Kafka-default-partitioner.java
Created October 31, 2018 09:58
Kafka default partitioner
return Utils.toPositive(Utils.murmur2(keyBytes)) % numPartitions;
@ruurtjan
ruurtjan / VectorImplicits.scala
Created July 13, 2018 07:48
Learning linear algebra with Scala - vector implicits sample
import MatrixImplicits._
import model.{Matrix2, Vector2}
object VectorImplicits {
implicit class ArithmeticVectorImplicits(v: Vector2) {
def +(v2: Vector2): Vector2 = ???
def *(scalar: Float): Vector2 = ???
def *(m: Matrix2): Vector2 = ???
def isLinearlyDependent(v2: Vector2): Boolean = ???
@ruurtjan
ruurtjan / MatrixImplicits.scala
Created July 13, 2018 07:47
Learning linear algebra with Scala - matrix implicits sample
import VectorImplicits._
import model.{Matrix2, Vector2}
object MatrixImplicits {
implicit class ArithmeticMatrixImplicits(m: Matrix2) {
def *(m2: Matrix2): Matrix2 = ???
def *(scalar: Float): Matrix2 = ???
def determinant(): Float = ???
def changesOrientation(): Boolean = ???
@ruurtjan
ruurtjan / get-windows-product-key.vbs
Last active November 26, 2021 12:45
A product key retrieval script that was used by Microsoft support. Save it with the `.vbs` extension, right click and select `Open with Command Prompt`.
Set WshShell = CreateObject("WScript.Shell")
Key = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
DigitalID = WshShell.RegRead(key & "DigitalProductId")
ProductName = "Product Name: " & WshShell.RegRead(Key & "ProductName") & vbNewLine
ProductID = "Product ID: " & WshShell.RegRead(Key & "ProductID") & vbNewLine
ProductKey = "Installed Key: " & ConvertToKey(DigitalID)
ProductID = ProductName & ProductID & ProductKey
If vbYes = MsgBox(ProductId & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "Windows Key Information") then
Save ProductID
End if
### Keybase proof
I hereby claim:
* I am ruurtjan on github.
* I am ruurtjan (https://keybase.io/ruurtjan) on keybase.
* I have a public key ASDrUF-JhLiWYlDnwjSHRsKzDYfQWupmAxQyB9huh-FQLAo
To claim this, I am signing this object: