This file contains 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
function x_json() { | |
jq -creM "${1}" <([ -z ${2+x} ] && cat - || echo "${2}") | |
} |
This file contains 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 benchmarks.regex; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.regex.Pattern; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
public class ReplaceBenchmark { |
This file contains 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
;; The main function is `protobuf->map`, which performs the transformation. | |
;; Runtime reflection can be avoided if class is known beforehand. | |
;; The macro is completely optional, though it makes things *slightly* easier to read: | |
;; (protobuf->clj instance OuterClass$InnerClass) vs (protobuf->map instance (OuterClass$InnerClass/getDescriptor)) | |
(defn- *proto->fields | |
"Get fields from protobuf object's descriptor as clojure keywords" | |
[descr] | |
(map #(keyword (.getName %)) | |
(.getFields descr))) |
This file contains 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
# Default config for sway | |
# | |
# Copy this to ~/.config/sway/config and edit it to your liking. | |
# | |
# Read `man 5 sway` for a complete reference. | |
### Variables | |
# | |
# Logo key. Use Mod1 for Alt. | |
set $mod Mod4 |
This file contains 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
#!/bin/bash | |
set -euo pipefail | |
ykman info > /dev/null | |
SELECTED=$(ykman oath list | rofi -dmenu) | |
if [ -n "${SELECTED}" ]; then | |
ykman oath code ${SELECTED} | awk '{ print $NF }' | xsel -b | |
fi |
This file contains 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
#!/bin/bash | |
set -euo pipefail | |
# TODO Fix multiple remotes | |
readarray LOCAL <<< $(git branch --no-color | awk '{print $NF}') | |
readarray REMOTE <<< $(git branch -r | sed 's/.*origin\///g') | |
REMOTE_ONLY=($(echo ${LOCAL[@]} ${LOCAL[@]} ${REMOTE[@]} | tr ' ' '\n' | sort | uniq -u)) |
This file contains 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
#!/bin/sh | |
#_( | |
DEPS='' | |
OPTS=' | |
-J-Xms256m -J-Xmx256m -J-client | |
' | |
exec clojure $OPTS -Sdeps "$DEPS" "$0" "$@" | |
) | |
(require '[clojure.edn :as edn] |
This file contains 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
#!/bin/env bash | |
# Requires https://github.com/junegunn/fzf | |
git checkout "$(git branch | awk '{print $NF}' | fzf)" |
This file contains 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
" Code Completion | |
Plug 'shougo/deoplete.nvim' | |
" Plug 'roxma/nvim-completion-manager' | |
" Snippets | |
Plug 'shougo/neosnippet.vim' | |
Plug 'shougo/neosnippet-snippets' | |
" Ctags |
This file contains 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
def time[A](a: => A) = { | |
val now = System.nanoTime | |
val result = a | |
val micros = (System.nanoTime - now) / 1000 | |
println("%d microseconds".format(micros)) | |
result | |
} |
NewerOlder