Skip to content

Instantly share code, notes, and snippets.

View hakanai's full-sized avatar
⚔️
Battling i16n demons

Hakanai hakanai

⚔️
Battling i16n demons
View GitHub Profile
@hakanai
hakanai / Disable Snipping Tool Hotkey.reg
Created April 23, 2024 12:02
Something I found useful
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"DisabledHotkeys"="S"
@hakanai
hakanai / Readme.md
Last active March 31, 2024 08:40
When you have to initialise multiple resources

Sometimes you have to initialise more than one resource and properly clean everything up.

This is the cleanest option I was able to figure out for Kotlin.

Example of usage:

        private val buffers: Array<AudioBuffer>
        private val device: AudioDevice
        private val context: AudioContext
@hakanai
hakanai / Readme.md
Last active March 19, 2024 00:16
Word combination finder

Started with https://gist.github.com/gubatron/65a153478149118908c6

  • Made it work (original was probably Python 2?)
  • Significantly tidied the code
  • Performance: Removed redundant sorting
  • Performance: Made input permutations unique so identical combinations weren't tried more than once

Still very slow for inputs 9+ letters long. Roughly exponential - takes around 1s for an 8 letter word, 10-11x longer for each additional letter.

@hakanai
hakanai / BetterErrorDialog.kt
Last active March 16, 2024 23:43
Attempt at replacing the Compose error handling to get a better looking dialog
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.window.DialogWindow
@Composable
internal fun BetterErrorDialog(state: ErrorDialogState) {
if (state.isVisible) {
@hakanai
hakanai / Main.kt
Last active January 4, 2024 03:25
Demonstration of recomposition not occurring if the initial window list was empty
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.*
import androidx.compose.ui.window.*
import kotlinx.coroutines.*
data class SystemProfile(
var name: String
)
@hakanai
hakanai / BrokenSurfaceShader.shader
Last active July 7, 2023 11:51
Reproduction of an annoying "feature" of surface shaders
Shader "Custom/BrokenSurfaceShader"
{
Properties
{
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
@hakanai
hakanai / BusinessTypes.txt
Last active July 1, 2023 01:59
BusinessTypes.txt
ABALONE FISHING
ACCOMMODATION
ACCOMMODATION FOR THE AGED OPERATION
ACCOUNTING SERVICES
ADHESIVE MANUFACTURING
ADULT SEX SHOP OPERATION
ADULT, COMMUNITY AND OTHER EDUCATION N.E.C.
ADVERTISING SERVICES
AGRICULTURAL AND CONSTRUCTION MACHINERY WHOLESALING
AGRICULTURAL MACHINERY AND EQUIPMENT MANUFACTURING
@hakanai
hakanai / Main.kt
Created May 13, 2023 03:42
Fragment shaders in Jetpack Compose
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Size
@hakanai
hakanai / Readme.md
Last active March 1, 2023 05:15
Performance issue removing 1,000,000 items from a mutable list in Compose

This was an idea for tree implementation I came up with to try and play well with the way Compose wants us to do things.

The basic idea:

  • Maintain a list of every row which is currently visible/expanded
  • When you expand a node, add all its children to the list
  • When you collapse a node, remove its children (caveat: and their children) from the list
  • Rendering nodes is fairly easy because the only thing that varies is the amount of indent and which icon to show

The idea seems sound - adding a million entries to the list is fast enough as to be unnoticeable.

@hakanai
hakanai / pmx21.md
Last active February 18, 2023 17:28 — forked from felixjones/pmx21.md
PMX (Polygon Model eXtended) 2.0, 2.1 File Format Specifications

PMX (Polygon Model eXtended) 2.1

This is an English description of the .PMX file format used in Miku Miku Dance (MMD).

PMX is the successor to the .PMD format (Polygon Model Data).

This is work-in-progress! Please leave feedback in the comments.

Todo