Skip to content

Instantly share code, notes, and snippets.

View Grogs's full-sized avatar

Greg Dorrell Grogs

View GitHub Profile
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % Test
@Grogs
Grogs / RateLimiter.scala
Created December 6, 2017 00:01
Token bucket rate limiter for Scala Futures
package me.gregd.cineworld.util
import java.util.concurrent.ConcurrentLinkedQueue
import monix.execution.Scheduler.Implicits.global
import monix.execution.atomic.AtomicInt
import scala.concurrent.{Future, Promise}
import scala.concurrent.duration._
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55573:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/
@Grogs
Grogs / FileCache.scala
Last active June 4, 2022 22:58
File backed implementation of ScalaCache Cache
import java.nio.ByteBuffer
import java.nio.channels.{AsynchronousFileChannel, CompletionHandler, FileLock}
import java.nio.file.StandardOpenOption.{CREATE, READ, WRITE}
import java.nio.file._
import java.util.concurrent.{Executors, TimeUnit}
import scala.compat.java8.FunctionConverters.asJavaConsumer
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import scala.concurrent.{ExecutionContext, Future, Promise}
document.querySelectorAll("#saved-passwords-list > .deletable-item > div").forEach(function(p) {
var url = p.querySelector(".url").title
var login = p.querySelector(".name").title
var password = p.querySelector(".password > input").value
console.log(url+"|"+login+"|"+password)
})

Keybase proof

I hereby claim:

  • I am grogs on github.
  • I am grogs (https://keybase.io/grogs) on keybase.
  • I have a public key ASD3ayP7kXNObEWH6f3U8xDBSKzpGlgVI-VAORw0nXemwAo

To claim this, I am signing this object: