This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source: https://gist.github.com/sonus21/53cd486fb0bdb83cd10d/ | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_search(values, key, lo=0, hi=None, length=None, comp=None): | |
""" | |
This is a binary search function which search for given key in values. | |
This is very generic in the sense values and key can be of different type. | |
If they are of different type then caller must specify comp function to | |
perform comparision between key and values's item. | |
:param values: List of items in which key has to be search | |
:param key: search key | |
:param lo: start index to begin search | |
:param hi: end index where search will be performed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<!-- | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <exception> | |
#include <stdexcept> | |
using namespace std; | |
class IndexError: public exception { | |
public: IndexError(char * msg) { | |
this -> msg = new char[strlen(msg)]; | |
cout << msg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
@EnableRedisRepositories | |
@EnableWebMvc | |
public class AsynchronousTaskExecutorApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(AsynchronousTaskExecutorApplication.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
email.queue.name=email-queue | |
invoice.queue.name=invoice-queue | |
# 30 seconds delay for invoice | |
invoice.queue.delay=300000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
import lombok.NoArgsConstructor; | |
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
public class Invoice { | |
private String id; | |
private String type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
import lombok.NoArgsConstructor; | |
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
public class Email { | |
private String email; | |
private String subject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
compileOnly 'org.projectlombok:lombok' | |
annotationProcessor 'org.projectlombok:lombok' | |
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' | |
implementation 'io.micrometer:micrometer-registry-prometheus' | |
implementation 'org.springframework.boot:spring-boot-starter-actuator' | |
// https://mvnrepository.com/artifact/com.h2database/h2 | |
compile group: 'com.h2database', name: 'h2', version: '1.4.200' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable prometheus exporter | |
management.metrics.export.prometheus.enabled=true | |
# Enable prometheus end point | |
management.endpoints.web.exposure.include=prometheus | |
# enable percentile-based histogram for http requests | |
management.metrics.distribution.percentiles-histogram.http.server.requests=true | |
# http SLA histogram buckets | |
management.metrics.distribution.sla.http.server.requests=100ms,150ms,250ms,500ms,1s | |
# enable JVM metrics | |
management.metrics.enable.jvm=true |
OlderNewer