Skip to content

Instantly share code, notes, and snippets.

@mping
mping / ducky.md
Created Jul 4, 2022 — forked from rizalgowandy/ducky.md
Programming media keys on the Ducky One 2 Skyline
View ducky.md

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:

View 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 Sep 22, 2018 — forked from Deraen/00_notes.md
Compojure-api and Buddy
View 00_notes.md
  • (: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 Jun 9, 2018 — forked from abravalheri/commit.md
RFC: Git Commit Message Guidelines
View commit.md

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

View quick-tips-optimizing-jvm.md

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 Jul 3, 2017 — forked from sujoyu/Main.scala
Scala parser combinator sample like HTML tag.
View Main.scala
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 — forked from bartojs/build.boot
gmail rest api java/clojure example with oauth2 and labels
View build.boot
;; 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"]])
@mping
mping / zsh.md
Last active Sep 1, 2016 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
View zsh.md

Prereq:

apt-get install zsh
apt-get install git-core

installation

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

@mping
mping / instructions.md
Last active Jun 14, 2016 — forked from nicerobot/jstatd.sh
Run jstatd w/o error 'access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)'
View instructions.md

Socks Proxy

image

Add Remote Host

image

Add Jstad Connection

image