Skip to content

Instantly share code, notes, and snippets.

@roberthamel
roberthamel / pipeline.yml
Created August 9, 2018 19:47
Concourse pipeline example
---
resources:
- name: source-code
type: git
check_every: 10s
source:
uri: ((gitRepository))
branch: master
- name: deploy-cf
type: cf
@roberthamel
roberthamel / log.txt
Created August 5, 2018 21:10
Reactive Hello Logs
Starting a Gradle Daemon (subsequent builds will be faster)
:compileJava
:processResources UP-TO-DATE
:classes
:bootRun
2018-08-05 17:09:43.829 DEBUG 67535 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Could not find key 'logging.register-shutdown-hook' in any property source
2018-08-05 17:09:43.833 DEBUG 67535 --- [ main] .c.l.ClasspathLoggingApplicationListener : Application started with classpath: [file:/Users/r/Sites/gs-reactive-rest-service/complete/build/classes/java/main/, file:/Users/r/Sites/gs-reactive-rest-service/complete/build/resources/main/, file:/Users/r/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-webflux/2.0.3.RELEASE/eed9177298124780a7dec0ba7a68e42268122a5f/spring-boot-starter-webflux-2.0.3.RELEASE.jar, file:/Users/r/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/2.0.3.RELEASE/2e389a8727588c549c28bb277f0f573f65554850/spring-boot-starter-json-2.0.3.RELEASE.jar, file:/Users/r/.gradle/caches/mo

./gradlew build -x test --continuous ./gradlew bootRun

@roberthamel
roberthamel / QnA.md
Last active July 3, 2018 11:59
Questions and Answers

Mockito - Part 2

01: Creating a Hello World Controller

// [...]/controllers/HelloWorldController.java

@RestController
public class HelloWorldController {
 
@roberthamel
roberthamel / commands.sh
Last active March 14, 2018 00:40
install jenkins on ec2
# install java 8, uninstall java 7
sudo yum install java-1.8.0
sudo yum remove java-1.7.0-openjdk
# make java 8 default
sudo /usr/sbin/alternatives --config java
sudo /usr/sbin/alternatives --config javac
# install maven
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
@roberthamel
roberthamel / Menu.java
Created February 14, 2018 03:21 — forked from Superpat/Menu.java
A small java command line api to generate a menu that can return a generic
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
/** Menu api for the command line
* <p>
* Takes a list of options containing a value and a menu title, when called, the menu returns an optional type containing the option.
* </p>
* @author Patrick Marchand <mail@patrickmarchand.com>
* @version 0.2
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@roberthamel
roberthamel / .bashrc
Last active February 3, 2018 15:44
Some Windows config
##########
# WSL
##########
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# if running in terminal
if test -t 1; then
@roberthamel
roberthamel / generate-pushid.js
Created January 8, 2018 03:53 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/