Quick Tip: Sync fork with original repo

1. Clone fork:

2. Add remote from original repository:

3. Update fork with changes from original repo:

Related:

 

 

Spring Boot CLI Hello World

Spring Boot CLI

For quickly getting some http endpoints up for prototyping I usually go with Spark for Java or Flask for Python. I’m also a fan of Spring Framework though I haven’t had a chance to work with it lately. Thinking of catching up again and checking out version 5, maybe with Kotlin. Spring Boot is great for getting a solid application up quickly. Looks like Spring Boot CLI might be an option for Java prototyping. I’m adding the minimal steps to expose an endpoint with plans to expand it later.

https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started-installing-spring-boot.html#getting-started-installing-the-cli

Install

Create App

View in browser

Resources

  • http://www.baeldung.com/spring-boot-cli
  • http://zetcode.com/springboot/groovycli
  • https://www.concretepage.com/spring-boot/spring-boot-cli-example
  • https://www.infoq.com/articles/microframeworks1-spring-boot

Working with Elasticsearch Snapshots

Create a snapshot

View existing repositories
curl -XGET 'localhost:9200/_snapshot/_all?pretty=true'

Create a directory accessible to the user running elasticsearch
mkdir backup
chown -R elasticsearch:elasticsearch /path-to/backup

Let elasticsearch know about path.repo (or in elasticsearch.yaml)
./bin/elasticsearch -Dpath.repo=/path-to/backup

Create a snapshot repo

Take a snapshot
curl -X PUT "localhost:9200/_snapshot/osm/snapshot_1?wait_for_completion=true"

Restore from Snapshot

todo…

Java Iterator and Iterable

So this question came up in a job interview not too long ago:

Implement a method that takes as a parameter a varargs of Iterables and returns a unified Iterator (without merging the the passed in Iterables into some collection)

Creating a custom Iterator and/or Iterable is pretty basic stuff but admittedly I can’t remember the last time I’ve done it. While I know that implementing Iterator requires at least implementing the hasNext and next method and I kinda forgot what the purpose of Iterable basically just means that you are providing the iterator() method, duh. Anyway, I obviously need some refreshers but in the mean time here’s my future white boarding solution

 

Shortcuts and Cheat sheets

Bash Scripting Cheat Sheet

https://devhints.io/bash

Emacs Edit Mode Keyboard Shortcuts

http://www.catonmat.net/download/readline-emacs-editing-mode-cheat-sheet.pdf

Emmet Cheat Sheet

http://docs.emmet.io/cheat-sheet/

IntelliJ Keyboard Shortcuts

https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-category.html
https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-keystroke.html
https://www.jetbrains.com/help/idea/adding-deleting-and-moving-code-elements.html
https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html

Mac Keyboard Shortcuts

https://support.apple.com/en-us/HT201236

Markdown Cheat Sheet

https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf
https://daringfireball.net/projects/markdown/basics

Scala Cheat Sheet

http://docs.scala-lang.org/cheatsheets/index.html

Vim Cheat Sheet

https://vim.rtorr.com/

Subversion

Basic

Changelist

References

SSH, SCP, SFTP

SSH (Secure Shell)

SCP (Secure Copy Protocol)

SFTP (Secure FTP)

References and Resources

Bash Keyboard Shortcuts

 

Bootstrapping with Gradle

Bootstrap options

Gradle Example

Common Config (in progress)

Create runnable Jar file

Configure the Jar task of the Java plugin:

Force running subsequent tests

Show StandardStreams from tests

See: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.logging.TestLoggingContainer.html

References and Resources