Skip to content

Instantly share code, notes, and snippets.

my-cookbook/attributes/default.rb:
default['foo']['version'] = "1.0"
default['foo']['other'] = "some-string#{node['foo']['version']}"
I have a role that overrides :foo => { :version => "2.0" }
@bdemers
bdemers / gist:e08f13bedeb696253caf
Created June 30, 2015 20:17
undercloud-install-error
[stack@manager ~]$ rpm -qi python-rdomanager-oscplugin
Name : python-rdomanager-oscplugin
Version : 0.0.0.post52
Release : 2.el7ost
[stack@manager ~]$ openstack undercloud install
...
WARNING: map-packages is deprecated. Please use the pkg-map element.
/**
* Basic usage:<p>
* <code>
* Environment env = new BasicIniEnvironment("classpath:shiro.ini");
* SecurityManager securityManager = env.getSecurityManager();
* </code>
*
*/
public class BasicIniEnvironment extends DefaultEnvironment {
package com.example.edgeservice
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.web.servlet.FilterRegistrationBean
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
import org.springframework.cloud.netflix.feign.EnableFeignClients
import org.springframework.cloud.netflix.feign.FeignClient

Keybase proof

I hereby claim:

  • I am bdemers on github.
  • I am bdemers (https://keybase.io/bdemers) on keybase.
  • I have a public key ASAdBQ7CfzapuguEq6yzQ2Qc6SPObwcWsID5lNAVlXZSigo

To claim this, I am signing this object:

@bdemers
bdemers / mvnwarn.zsh
Created September 30, 2019 19:56
Maven Fail On Warning
# Tested on OS X (with a bunch of gnu utils installed)
function mvnwarn {
tmp_file=$(mktemp $TMPDIR/$(uuidgen).txt)
MAVEN_OPTS="-Djansi.force=true" mvn -Dstyle.color=always $@ | tee "${tmp_file}"
exit_code=${pipestatus[1]}
if [ $exit_code -ne 0 ]; then
return 1
fi
@bdemers
bdemers / Wrapper.java
Created October 4, 2019 21:52
Wrap Beans
@Bean
BeanPostProcessor delegateForFoo() {
return new WrappingBeanPostProcessor<>(Foo.class, original -> new MyCustomFoo(original));
}
public class WrappingBeanPostProcessor<T> implements BeanPostProcessor {
private final Class<T> type;
private final UnaryOperator<T> beanCreator;
@bdemers
bdemers / AppExample.java
Created October 11, 2019 17:37
Create and Parse JWTs in Java with JJWT
package com.okta.developer;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Base64;
package org.jetbrains.kotlin.maven;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.io.File;
@bdemers
bdemers / SomeTest.java
Last active April 10, 2020 19:45
TestNG + Mockito + PowerMock
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.testng.PowerMockObjectFactory
import org.testng.IObjectFactory
import org.testng.annotations.ObjectFactory
import org.testng.annotations.Test
import static org.mockito.Mockito.*
import static org.powermock.api.mockito.PowerMockito.mockStatic
@PrepareForTest(AStaticClass.class)
public class SomeTest {