I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
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 demo | |
| import arrow.core.Either | |
| import arrow.core.None | |
| import arrow.core.Option | |
| import arrow.core.Some | |
| import arrow.core.continuations.Raise | |
| import arrow.core.continuations.effect | |
| import arrow.core.continuations.either | |
| import arrow.core.continuations.toEither |
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
| // Save as ~/.ammonite/predef.sc | |
| // To use fs2 from ammonite repl, type `load.fs2` from repl prompt. | |
| // You'll get all fs2 & cats imports, ContextShift and Timer instances | |
| // for IO, and a globalBlocker | |
| import $plugin.$ivy.`org.typelevel:::kind-projector:0.11.0` | |
| if (!repl.compiler.settings.isScala213) | |
| repl.load.apply("interp.configureCompiler(_.settings.YpartialUnification.value = true)") |
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
| # NVM | |
| curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
| nvm install 10 | |
| # Yarn | |
| curl -o- -L https://yarnpkg.com/install.sh | bash | |
| export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" |
This NixOS code ensures that the system provide version-specific $LOCALE_ARCHIVE
environment variables to mitigate the effects of
NixOS/nixpkgs#38991.
To deploy it, copy the file into your /etc/nixos folder using a file name
like multi-glibc-locale-paths.nix. Then edit your configuration.nix file to
contain the attribute:
imports = [ ./multi-glibc-locale-paths.nix ];
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
| -- Adapted from these sources: | |
| -- http://peterdowns.com/posts/open-iterm-finder-service.html | |
| -- https://gist.github.com/cowboy/905546 | |
| -- https://gist.github.com/ttimasdf/7bb02ed419db4b472b534e1a57008a3b | |
| -- | |
| -- Modified to work with files as well, cd-ing to their container folder | |
| on run {input, parameters} | |
| tell application "Finder" | |
| set my_file to first item of input | |
| set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file)) |
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
| import scalaz._ | |
| import scalaz.concurrent.Task | |
| def signal(i: Int): Task[Int] = | |
| Task.async[Int] { cb => cb(\/-(i)) } | |
| def loop(n: Int, acc: Int): Task[Int] = | |
| signal(acc + n).flatMap { x => | |
| if (n <= 0) Task.now(acc) | |
| else loop(n-1, x) |
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
| /** | |
| * In classic Scala implementation of hierarchies of Category theory laws (scalaz/cats), the dependency between | |
| * different laws is encoded using inheritance (https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/Monad.scala#L14) | |
| * | |
| * This approach creates well-known issues: for example, a Monad is able to _derive_ an Applicative. | |
| * So sometimes, you don't have the Applicative you want but the one derived from the Monad or it doesn't | |
| * compile because you have 2 Applicatives in your implicit scope. | |
| * | |
| * Alois Cochard has proposed a new model to represent that in (scato project)[https://github.com/aloiscochard/scato] or | |
| * (scalaz/8.0.x)[https://github.com/scalaz/scalaz/blob/series/8.0.x/base/src/main/scala/typeclass/Monad.scala] branch. |
NewerOlder