Skip to content

Instantly share code, notes, and snippets.

View Jacke's full-sized avatar
👀
Mastermind

Stan Sobolev Jacke

👀
Mastermind
View GitHub Profile
@Jacke
Jacke / StoreRocksDB.scala
Created May 7, 2021 19:36 — forked from pauca/StoreRocksDB.scala
Template for testing: RocksDB with Scala
import java.io.File
import org.rocksdb._
import org.rocksdb.util.SizeUnit
import scala.collection.JavaConversions._
// build.sbt
// name := "RocksDB"
// version := "0.1"
// scalaVersion := "2.12.0"
// libraryDependencies += "org.rocksdb" % "rocksdbjni" % "5.0.1"
@Jacke
Jacke / postgres-cheatsheet.md
Created September 5, 2020 19:14 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@Jacke
Jacke / trampoline.scala
Created August 19, 2020 10:20
Trampoline
sealed trait Trampoline[A] {
def flatMap[B](f: A => Trampoline[B]) = {
FlatMap[A, B](this, f)
}
}
case class More[A](k: () => Trampoline[A]) extends Trampoline[A]
case class Done[A](result: A) extends Trampoline[A]
case class FlatMap[A, B](
sub: Trampoline[A],
k: A => Trampoline[B]
@Jacke
Jacke / SlickMetaGenPlugin.scala
Created July 14, 2020 15:57 — forked from nafg/SlickMetaGenPlugin.scala
Simple code generator for Slick using Scalameta rather than strings, as an SBT plugin
import java.sql.Types
import scala.annotation.tailrec
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import scala.meta._
import slick.dbio.DBIO
import slick.jdbc.meta.{MColumn, MQName, MTable}
@Jacke
Jacke / ReaderK.scala
Created June 19, 2020 17:16 — forked from notxcain/ReaderK.scala
ReaderK
package aecor.testkit
import aecor.data.PairE
import aecor.encoding.WireProtocol
import aecor.encoding.WireProtocol.{ Encoded, Invocation }
import cats.data.ReaderT
import cats.tagless.FunctorK
import cats.tagless.implicits._
import cats.~>
import scodec.bits.BitVector
@Jacke
Jacke / CombiningTaglessHandlers.scala
Created June 18, 2020 22:47 — forked from ioleo/CombiningTaglessHandlers.scala
Example of free tagless combined handlers for module
import cats.data.IdT
import cats.{~>, Id, Monad}
import freestyle.tagless.logging.LoggingM
import freestyle.tagless._
import sourcecode.{File, Line}
@tagless trait Summer {
def sum(a: Int, b: Int): FS[Int]
}
import cats.data.{EitherT, State}
import cats.effect.Sync
import cats.implicits._
import cats.mtl.MonadState
import cats.mtl.implicits._
import cats.tagless.implicits._
import cats.tagless.{Derive, FunctorK}
import cats.{Bifunctor, MonadError, ~>}
import com.itv.heimdall.models.{DbError, ErrorType}
package minimize
object app {
import cats.tagless._
import util.Try
import cats.tagless.implicits._
import cats.implicits._
import cats._
import cats.free.Free
import cats.arrow.FunctionK
@Jacke
Jacke / vimeo-downloader.js
Created April 17, 2020 18:13 — forked from mistic100/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
### Keybase proof
I hereby claim:
* I am jacke on github.
* I am jacke (https://keybase.io/jacke) on keybase.
* I have a public key ASBpQAlibEiOD6upHfUNbym1hxGXGYefLhO8nEejyiWSGgo
To claim this, I am signing this object: