Skip to content

Instantly share code, notes, and snippets.

View cueo's full-sized avatar

Mohit Mayank cueo

  • Purdue University
  • Indiana
View GitHub Profile
@cueo
cueo / xkcd_2445.py
Last active May 13, 2021 03:47
Talk to xkcd checkbox
# https://xkcd.com/2445
import requests
BASE_URL = 'https://xkcd.com/2445/morse/.../-.._-..._...--_...--_....-_.-_.-_-..._-....-_----._..---_.-_.----_-....-_.----_.----_._-..._-....-_---.._-----_-----_.----_-....-_---.._-.-._.----_-...._....-_....._....-_..-._-..._-----_..---_.-/'
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
@cueo
cueo / ReactiveWebClient.kt
Created September 24, 2020 18:35
Generic Kotlin coroutine to interact with Spring reactive WebClient
package com.cueo.demo.web
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.HttpHeaders
@cueo
cueo / build-kotlin-library-gradle.md
Last active May 26, 2020 05:15
Building a Kotlin library with Gradle

Introduction

The most boring part of a library is the setting up part. Choosing the build systems, publishing builds, setting up code coverage, linting, etc etc. This blog is aimed at abstracting those concerns in the form of a simple file at the end of all this.

Choosing a build system

  • Gradle
  • Maven

Both Gradle and Maven have their own pros and cons. It is not in the scope of this article to delve into those details. However, I'd mention that Gradle tends to be a little bit faster while Maven has better support (in terms of IDE or plugins).

@cueo
cueo / remove_unnecessary_stubbing.py
Last active June 3, 2019 18:23
Remove unnecessary stubbing UnnecessaryStubbingException automatically
'''
# Before running the script, we need to generate the list of unnecessary stubs.
# For this, run mvn clean install and copy paste the output here: https://regexr.com/4etmi
# This will extract all the stubs that should be removed.
# Create a file called: unnecessary-stubbings.txt in the same folder as this script.
# Paste the output from regexr into this file and run the below script.
'''
import json
import os