Skip to content

Instantly share code, notes, and snippets.

View kyrielia's full-sized avatar

Kyriacos Elia kyrielia

View GitHub Profile
@kyrielia
kyrielia / OAuth1AuthorizationUtil.groovy
Last active July 12, 2016 16:40
Generating an OAuth1 Authorization header with HMAC-SHA1 in Groovy
import org.apache.commons.lang.RandomStringUtils
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
/**
* Utility to create OAuth 1 authorization headers.
*
* @author Kyriacos Elia
*/
@kyrielia
kyrielia / oauth1-authorization-util.js
Last active February 25, 2016 11:34
A Node.js util class for generating an OAuth Authorization header.
// Include merge and crypto-js npm packages into your package.json
var merge = require('merge');
var crypto = require('crypto');
exports.generateAuthorizationHeader = function(method, url, consumerKey, consumerSecret, additionalParams) {
if ( additionalParams === null ) {
additionalParams = {};
}
/**
* An extension of the Spring Boot Actuator health indicator. Implementing this abstract class will give you both a
* health check on /health, as well as a Prometheus metric representing the health check on /metrics (1 for up, 0 for
* down).
* <p>
* Note: Spring health indicators only run when /health is called.
*/
abstract class HealthIndicatorWithMetric implements HealthIndicator {
private Logger log = LoggerFactory.getLogger(HealthIndicatorWithMetric.class);