Skip to content

Instantly share code, notes, and snippets.

View adrian-baker's full-sized avatar

Adrian Baker adrian-baker

  • New Zealand
View GitHub Profile
public AWSCredentialsProvider getDefaultCredentials() {
final String profileName = AwsProfileNameLoader.INSTANCE.loadProfileName();
final AllProfiles allProfiles = new AllProfiles(Stream.concat(
BasicProfileConfigLoader.INSTANCE.loadProfiles(
AwsProfileFileLocationProvider.DEFAULT_CONFIG_LOCATION_PROVIDER.getLocation()).getProfiles().values().stream(),
BasicProfileConfigLoader.INSTANCE.loadProfiles(
AwsProfileFileLocationProvider.DEFAULT_CREDENTIALS_LOCATION_PROVIDER.getLocation()).getProfiles().values().stream())
.map(profile -> new BasicProfile(profile.getProfileName().replaceFirst("^profile ", ""), profile.getProperties()))
.collect(Collectors.toMap(profile -> profile.getProfileName(), profile -> profile,
@adrian-baker
adrian-baker / LICENSE
Last active October 6, 2018 21:38
This license applies to all public gists https://gist.github.com/adrian-baker
MIT License
Copyright (c) 2018 Adrian Baker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Path("/rainbow")
public class StreamingResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Rainbow getRainbow() {
return new Rainbow(
IntStream.range(0, Integer.MAX_VALUE).boxed(),
IntStream.range(0, Integer.MAX_VALUE).boxed(),
IntStream.range(0, Integer.MAX_VALUE).boxed());