Skip to content

Instantly share code, notes, and snippets.

@mping
mping / ducky.md
Created September 19, 2023 10:59 — forked from schmich/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 RGB TKL, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@mping
mping / ducky.md
Created July 4, 2022 12:49 — forked from rizalgowandy/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2

To use media keys on the Ducky One 2, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@mping
mping / either.clj
Created February 15, 2021 19:19 — forked from mping-exo/either.clj
(require '[clojure.spec.alpha :as s])
(s/def ::test (s/and (s/keys :req-un [(or ::key1 ::key2)])
(fn [{:keys [key1 key2]}]
(not (and key1 key2)))))
;; s/or validates some of the keys
;; the (fn..) ensures that both keys CANNOT be present
@mping
mping / 00_notes.md
Created September 22, 2018 18:34 — forked from Deraen/00_notes.md
Compojure-api and Buddy
  • (:identity req) is auth backend independent way to access user data
  • login and logout implementation depends on auth backend
  • :current-user doesn't imply that authentication is required, route should also have :auth-rules if authentication is required
@mping
mping / commit.md
Last active June 9, 2018 11:47 — forked from abravalheri/commit.md
RFC: Git Commit Message Guidelines

Commit Message Guidelines

Goals

  • allow generating CHANGELOG.md by script
  • allow ignoring commits by git bisect (not important commits like formatting)
  • provide better information when browsing the history

Proposal

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@mping
mping / Main.scala
Created July 3, 2017 09:46 — forked from sujoyu/Main.scala
Scala parser combinator sample like HTML tag.
import scala.util.parsing.combinator._
import scala.language.postfixOps
object Main {
def main(args:Array[String]) = {
val sc = new java.util.Scanner(System.in)
val input = collection.mutable.ListBuffer[String]()
while(sc.hasNextLine) {
input += sc.nextLine
@mping
mping / build.boot
Created May 27, 2017 11:57 — forked from bartojs/build.boot
gmail rest api java/clojure example with oauth2 and labels
;; 1) first goto https://console.developers.google.com/start/api?id=gmail
;; -- to turn on gmail api for your account
;; 2) then create a oauth consent with app name
;; 3) then add oauth clientid and download to ./clientsecret.json
;; 4) boot run
;; -- when running first time a browser will open to accept authorizaton
(set-env! :dependencies '[[com.google.apis/google-api-services-gmail "v1-rev34-1.21.0"]
[com.google.api-client/google-api-client "1.20.0"]
[com.google.oauth-client/google-oauth-client-jetty "1.20.0"]])