Skip to content

Instantly share code, notes, and snippets.

View osipxd's full-sized avatar

Osip Fatkullin osipxd

View GitHub Profile
@osipxd
osipxd / !paper-versions.md
Last active May 16, 2025 08:40
Paper versions links
@osipxd
osipxd / structural_replace_library.md
Last active May 8, 2025 16:06
Collection of useful Structural Replace templates

Collection of useful Structural Replace templates.

How to Use?

  1. Copy the desired template XML
  2. In IntelliJ IDEA open Edit | Find | Replace Structurally...
  3. Press Ctrl + V ( + V)
  4. Click Find

Templates

@osipxd
osipxd / .editorconfig
Last active April 24, 2025 09:13
EditorConfig for Android projects with mapping to IntelliJ IDEA's config
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
@osipxd
osipxd / package-list
Last active August 14, 2024 22:37 — forked from DRSchlaubi/package-list
API package list for https://hub.spigotmc.org/javadocs/spigot/ (1.21.1)
org.bukkit
org.bukkit.advancement
org.bukkit.attribute
org.bukkit.ban
org.bukkit.block
org.bukkit.block.banner
org.bukkit.block.data
org.bukkit.block.data.type
org.bukkit.block.sign
org.bukkit.block.spawner
@osipxd
osipxd / MakeDebuggableTask.kt
Last active July 4, 2024 18:38
The task to add debuggable=true to obfuscated Android builds
package com.example.build
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
/** Adds `android:debuggable="true"` to the manifest. */
abstract class MakeDebuggableTask : DefaultTask() {
@osipxd
osipxd / setLocale.kt
Last active April 15, 2024 12:15
Set locale in Android application
import android.app.Activity
import android.app.Application
import android.content.ComponentCallbacks
import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import java.util.Locale
private const val LANGUAGE_RU = "ru"
@osipxd
osipxd / ImmutableList.kt
Last active March 28, 2024 00:19
Transparent wrapper making lists Immutable for compose.
/** Wrapper over the given [list] for Compose to mark this list as [Immutable]. */
@Immutable
@JvmInline
value class ImmutableList<T>(private val list: List<T>) : List<T> by list
/** Returns empty list marked as [Immutable]. */
inline fun <T> immutableListOf(): ImmutableList<T> = ImmutableList(emptyList())
/** Returns a new [Immutable] list of given [elements]. */
@osipxd
osipxd / prepare-cache.sh
Last active March 25, 2024 15:55
Script preparing Android project cache for GitLab CI
#!/usr/bin/env bash
set -eu
BUILD_CACHE_THRESHOLD=5000
function get_gradle_slug() {
local dist
dist=$(source gradle/wrapper/gradle-wrapper.properties && echo "${distributionUrl?:}")
dist=${dist##*gradle-}
@osipxd
osipxd / mac-wattage.sh
Last active February 7, 2024 19:01
Print current Mac wattage (with accuracy up to minute)
#!/usr/bin/env bash
set -euo pipefail
function extract_float_field() {
field=$1
ioreg -rw0 -c AppleSmartBattery |
grep BatteryData |
sed -E "s/.*\"$field\"=([0-9]+).*/\1/" |
xargs -I % lldb --batch --source-quietly --one-line "print/f %" | # Convert IEEE-754 float
@osipxd
osipxd / change-phone-number.md
Last active January 24, 2024 04:08
Редактирование номера телефона SIM-карты на Android

Что нужно?

  • Root
  • ADB (или любое приложение Terminal на телефоне)

Шаги

Подключение

Подключитесь к телефону через ADB и в открывшейся консоли переключитесь в режим Super User: