Skip to content

Instantly share code, notes, and snippets.

@ov7a
ov7a / pom.xml
Created Oct 23, 2021
Integrating bpmnlint with maven
View pom.xml
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.0</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
@ov7a
ov7a / buenos_aires.py
Created Nov 28, 2020
Simple check of Buenos Aires Constant (aka prime generating constant)
View buenos_aires.py
import math
import sys
BAC = 2.920050977316134
def primes_BAC():
item = BAC
while True:
next_prime = int(math.floor(item))
yield next_prime
@ov7a
ov7a / get_branches_jira_status.py
Created Aug 6, 2020
Print related jira issue status for each branch in git repo to find branches which can be closed
View get_branches_jira_status.py
import argparse
import subprocess
from jira import JIRA
from getpass import getpass
import requests
EXCLUDE_BRANCHES = {"master", "develop"}
COMMON_BRANCH_PREFIX = "feature/"
COMMON_BRANCH_SUFFIX = "-epic"
HEADS_PREFIX = "refs/heads/"
@ov7a
ov7a / close_upsource_reviews.py
Created Jul 20, 2020
Batch close upsource reviews
View close_upsource_reviews.py
import requests
import argparse
REVIEWS_LIST_PATH = "{host}/~rpc/getReviews"
CLOSE_REVIEW_PATH = "{host}/~rpc/closeReview"
REVIEWS_REQUEST = "(state: open) and (accepted-by: 1 or (not (updated: {this month})))"
def parse_args():
View Main.scala
import org.apache.kafka.clients.consumer.ConsumerConfig
import org.apache.kafka.common.TopicPartition
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.spark.streaming.kafka010.KafkaUtils
import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.spark.{SparkConf, SparkContext, SparkEnv}
import org.apache.spark.streaming.kafka010._
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe
@ov7a
ov7a / Main.java
Created Aug 15, 2018
OOM MWE for flipkart-incubator/zjsonpatch
View Main.java
//works with 0.3.10 but fails with OOM with 0.4.4
//see https://github.com/flipkart-incubator/zjsonpatch/issues/77
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.flipkart.zjsonpatch.JsonDiff;
import java.io.IOException;
public class Main {
@ov7a
ov7a / TestDuration.scala
Last active Aug 22, 2018
Fun with Durations
View TestDuration.scala
import com.typesafe.config.ConfigFactory
import scala.util.Try
object TestDuration extends App {
val strings = Seq("1s", "2s", "2m", "2h", "2d", "2y", "1h30m", "86000000ms")
def getISOPrefix(duration: String): String = if (Set('y', 'd').contains(duration.last)) "P" else "PT"
val parseAndProcessDuration: Map[String, String => String] = Map(
@ov7a
ov7a / kibana_to_rm.js
Created Apr 23, 2018
From Kibana to Redmine
View kibana_to_rm.js
(function logs_data_main(){
const ui_id = "logs_ui";
const data_id = "logs_data_ui";
function addLogsData(){
let text = document.getElementById(data_id).value;
let lines = text.split('\n');
let urlsAndNames = lines
.filter(x => x.length > 2)
@ov7a
ov7a / build.gradle
Last active Feb 21, 2018
build.gradle quasar kotlin app example
View build.gradle
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'kotlin'
buildscript {
ext.kotlin_version = '1.1.51'
ext.quasar_version = '0.7.9'
repositories {
mavenCentral()
@ov7a
ov7a / Main.kt
Last active Feb 21, 2018
Kotlin and quasar MWE for Unable to instrument class kotlin/SynchronizedLazyImpl https://github.com/puniverse/quasar/issues/288
View Main.kt
package mwe
import co.paralleluniverse.fibers.Suspendable
import co.paralleluniverse.kotlin.Actor
import co.paralleluniverse.kotlin.register
import co.paralleluniverse.kotlin.spawn
import co.paralleluniverse.strands.Strand
class LazyActor : Actor() {