Skip to content

Instantly share code, notes, and snippets.

@onegul
onegul / LruCache.kt
Created May 16, 2026 18:51
Lru Cache in Kotlin
fun main() {
val cache = LruCache<Int, Int>(3)
cache.printValues()
cache[1] = 1
cache.printValues()
cache[2] = 2
cache.printValues()
cache[1]
cache.printValues()
cache[0]

Bad Faith in Personal Life – How Even a Little Poisons Your Entire Life Quality

The same rule that kills companies and reputations also runs your personal life, but slower and more intimately.
A life with 5–10 % bad faith feels “mostly good” for years… until one day it suddenly feels empty, fragile, or collapses.

Area of Life Typical Bad-Faith Move (seems small at the time) What It Actually Does to You End-State When It Compounds
Romantic relationships Small lies to avoid conflict (“I was at the gym”), hiding dating apps “just in case”, financial infidelity Destroys trust slowly; you start performing instead of connecting Divorce, or a cold, transactional marriage that feels like a roommate contract
Friendships Flaking repeatedly with fake excuses, gossiping behind backs, using people for status or favors You train people to see you as unreliable → they qui
@onegul
onegul / ArcUtils.java
Created October 30, 2021 08:16 — forked from Takhion/ArcUtils.java
Collection of methods to achieve better circular arc drawing, as Canvas.drawArc() is unreliable. See the related article: https://medium.com/p/9155f49166b8
/**
* ArcUtils.java
*
* Copyright (c) 2014 BioWink GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@onegul
onegul / transcoder.java
Created June 21, 2021 09:26 — forked from jinminghe/transcoder.java
AndroidTranscoder
import android.annotation.TargetApi;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.media.MediaMuxer.OutputFormat;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.SystemClock;