Skip to content

Instantly share code, notes, and snippets.

View vinaysshenoy's full-sized avatar

Vinay Shenoy vinaysshenoy

View GitHub Profile
@vinaysshenoy
vinaysshenoy / build.gradle.kts
Created June 2, 2023 06:34
Enable test logging for Kotlin projects
tasks.test {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
events("skipped", "failed", "passed")
}
}
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Vinay Shenoy",
"label": "Engineering Lead at Qweebi",
"email": "work@vinaysshenoy.com",
"url": "",
"summary": "Software Engineer with 10+ years of experience, specializing in developer experience and consistent engineering delivery.",
"location": {
"countryCode": "SG",
@vinaysshenoy
vinaysshenoy / provider.kt
Last active November 29, 2022 16:31
Onion layers
interface Provider<T, U> {
fun provide(params: U?): T
}
class DatabaseProvider: Provider<User, string> {
override fun provide(id: string?): User {
// Query DB here
}
}
@vinaysshenoy
vinaysshenoy / fix.sh
Created September 28, 2022 05:15
Git LFS BS (Encountered files)
git rm .gitattributes
git reset .
git checkout .
@vinaysshenoy
vinaysshenoy / gist:f54a208ad93b10e94a3a
Created March 1, 2015 06:58
Android check if color is dark
public boolean isColorDark(int color){
double darkness = 1-(0.299*Color.red(color) + 0.587*Color.green(color) + 0.114*Color.blue(color))/255;
if(darkness<0.5){
return false; // It's a light color
}else{
return true; // It's a dark color
}
}
@vinaysshenoy
vinaysshenoy / files sorted by size.sh
Last active February 2, 2022 03:29
macOS list files by size
find . -type f -print0 | xargs -0 ls -l | sort -k5,5rn > ~/files.txt
find -E . -regex '.*\.(jpg|png)' -print0 | xargs -0 ls -l | sort -k5,5rn
find -E . -regex '.*\.(jpg|jpeg|png|hdr|exr)' -print0 | xargs -0 stat -f "%N,%z" > ./files.csv
@vinaysshenoy
vinaysshenoy / .profile
Created May 27, 2021 05:21
Delete gradle log files older than 7 days on login
export GRADLE_USER_HOME="$HOME/Dev/.gradle"
# Delete all gradle log files older than 7 days
find $GRADLE_USER_HOME/daemon -type f -mtime +7 -iregex '.*\.\(dmp\|log\)$' -delete
@vinaysshenoy
vinaysshenoy / FirstFragment.kt
Created September 30, 2020 07:49
Render a view to a Bitmap of a specific size
package `in`.obvious.android.bitmaptest
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Matrix
import android.graphics.RectF
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.LayoutInflater
@vinaysshenoy
vinaysshenoy / CompositeExtension.kt
Created September 12, 2020 05:52
Composite JUnit5 extension for composing a group of domain specific extensions
import org.junit.jupiter.api.extension.AfterAllCallback
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.AfterTestExecutionCallback
import org.junit.jupiter.api.extension.BeforeAllCallback
import org.junit.jupiter.api.extension.BeforeEachCallback
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback
import org.junit.jupiter.api.extension.ConditionEvaluationResult
import org.junit.jupiter.api.extension.ExecutionCondition
import org.junit.jupiter.api.extension.Extension
import org.junit.jupiter.api.extension.ExtensionContext
@vinaysshenoy
vinaysshenoy / Mobius.kt
Last active May 19, 2020 08:45
Exploratory DSL for rendering a representing a Mobius graph
mobius("Login") {
state("Default") {
events {
"InputChanged" leadsTo "Default"
"SubmitClicked" leadsTo "ValidateInput"
}
}
transient("ValidateInput") {