Skip to content

Instantly share code, notes, and snippets.

ov7a / pom.xml
Created October 23, 2021 10:57
Integrating bpmnlint with maven
View pom.xml
<id>install node and npm</id>
ov7a /
Created November 28, 2020 16:40
Simple check of Buenos Aires Constant (aka prime generating constant)
import math
import sys
BAC = 2.920050977316134
def primes_BAC():
item = BAC
while True:
next_prime = int(math.floor(item))
yield next_prime
ov7a /
Created August 6, 2020 10:47
Print related jira issue status for each branch in git repo to find branches which can be closed
import argparse
import subprocess
from jira import JIRA
from getpass import getpass
import requests
EXCLUDE_BRANCHES = {"master", "develop"}
HEADS_PREFIX = "refs/heads/"
ov7a /
Created July 20, 2020 07:39
Batch close upsource reviews
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 /
Created August 15, 2018 21:13
OOM MWE for flipkart-incubator/zjsonpatch
//works with 0.3.10 but fails with OOM with 0.4.4
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.flipkart.zjsonpatch.JsonDiff;
public class Main {
ov7a / TestDuration.scala
Last active August 22, 2018 14:06
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 / kibana_to_rm.js
Created April 23, 2018 07:43
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 / build.gradle
Last active February 21, 2018 08:42
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 {
ov7a / Main.kt
Last active February 21, 2018 08:41
Kotlin and quasar MWE for Unable to instrument class kotlin/SynchronizedLazyImpl
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() {