Skip to content

Instantly share code, notes, and snippets.

View apuravchauhan's full-sized avatar

Apurav Chauhan apuravchauhan

View GitHub Profile
groups:
- name: Spring-boot
rules:
- alert: 5xx-over-2%
expr: sum(rate(orders_5xx_total[1m]))/sum(rate({__name__=~"orders_*.xx_total"}[1m])) *100 > 1
for: 15s
labels:
severity: critical
techteam: apurav
annotations:
@apuravchauhan
apuravchauhan / PrometheusSpringBoot.java
Created August 30, 2020 13:29
Spring Boot Application Integrated with Prometheus
package com.apurav;
import java.util.Map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@apuravchauhan
apuravchauhan / trendProcessor.py
Created July 6, 2019 05:32
Python utility to process Google trends data into HighCharts data format
import csv
import json
import os
import glob
class TrendProcessor:
def __init__(self, folder, dateHeader):
self.data = []
self.folder = folder
@apuravchauhan
apuravchauhan / index.html
Created May 27, 2019 14:41
HTML page calling JS bridge methods forwarding to native UPI calls
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="Apurav Chauhan">
<meta name="title" content="Web to android interaction">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
@apuravchauhan
apuravchauhan / WebAppInterface.java
Created May 27, 2019 14:34
Java class powering the JS API from within HTML
package com.apuravchauhan.apuravupi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;
package com.apuravchauhan.apuravupi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
/**
* @author apuravchauhan
*/
@apuravchauhan
apuravchauhan / home.scss
Created October 14, 2018 07:02
Setting transparent background so your camera preview in the background is visible in your Ionic hybrid app
page-home {
ion-content, a-scene {
background-color: transparent !important;
}
}
ion-app,.nav-decor {
background-color: transparent !important;
}
@apuravchauhan
apuravchauhan / home.ts
Created October 14, 2018 06:51
Home component with camera preview plugin integrated.
import { Component } from '@angular/core';
import { NavController,Platform } from 'ionic-angular';
import { CameraPreview, CameraPreviewOptions } from '@ionic-native/camera-preview';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@apuravchauhan
apuravchauhan / home.html
Created October 14, 2018 05:08
Ionic's home page component's html template with 3D models included
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="md-menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
<ion-content padding>
<a-scene vr-mode-ui="enabled: false">
@apuravchauhan
apuravchauhan / index.ftl
Created September 15, 2018 18:43
Java freemarker template converted from ReactJS JSX component
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Apurav Chauhan</title>
</head>
<body>