Skip to content

Instantly share code, notes, and snippets.

package com.nikoskatsanos.benchmarks.loops;
import java.util.ArrayList;
import java.util.List;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
function setJDK() {
local USAGE="Usage: setJDK [-v \${JDK_VERSION}] [-d \${JDK_DISTRIBUTION}]"
local OPTIND v d
while getopts "v:d:" OPTION; do
case "$OPTION" in
v)
local version=$OPTARG
;;
function listJDKVendors() {
echo "$($java_home -V 2>&1 | tr ' ' '\0' | tr '\t' ' ' | cut -d ' ' -f2,1)"
}
function listJDKs() {
echo "$($java_home -V 2>&1)"
}
:w = Write the file, save any changes
:w! = Force right the file, when the file is read-only, but the user has write permissions on it, this forces a write
:q! = The infamous quite force command (enter stackoverflow link here)
:set hlsearch = Add highlighting for any search terms that are found
:syntax enable = Enable syntax highlighting
:set syntax ${syntax} = VIM has lots of pre defined syntaxts
:set number = Set line numbers
:e . = VIM can act as a dir tree viewer and file navigation. This is a really cool feature
:options = Show all options
:set = Diff of options to their default values
/${searchTerm} = Search for ${searchTerm}
n = find the next match
N = find the previous match
f${char} = Find the next occurance of character ${char}
yy = Copy the entire line
y = Copy the selection (Use 'v' or 'V' to select some text or a line)
d = Cut
D = Cut the entire line
p = Paste whatever is at the clipboard before the cursor
P = Paste whatever is at the clipboard after the cursor
i = Switch to insert mode and start inserting characters at the cursor's position
a = Switch to insert mode and start appending characters from the next cursor position
x = Delete the character under the cursor
dd = Delete the entire line
o = Insert and empty line and start appending on it
cw = Delete the word under cursor and start appending new character. This operation is useful when the user wants to change a word
v = Enter the visual mode, in order to select characters
V = Enter the visual mode and select the entire row
w = Move one word at a time
W = Move a continuous block of characters
[1-9]w = Move n words
gg = Go to the top of the file
G = Go to the end of the file
^ = Go to the beginning of a line
$ = Go to the end of a line