Skip to content

Instantly share code, notes, and snippets.

View h0tk3y's full-sized avatar
🐘

Sergey Igushkin h0tk3y

🐘
View GitHub Profile
*<+<#f23:: {
Send("{Blind}{LShift Up}{LWin Up}{RControl Down}")
KeyWait("F23")
Send("{RControl up}")
}

Declarative init definitions — design discovery for global/init declarative files replacing init scripts

Companion to research-init-scripts.md. That document catalogues why init scripts are used in practice; this one explores what would replace them if Declarative Gradle becomes the only scripting language. It is a design discovery — drafts, decisions reached in discussion, and questions left explicitly open — not an implementation plan. Any naming is provisional.

Context

Premise under exploration: Declarative Gradle (DCL) becomes the only scripting language in Gradle.

Четыре угла прямоугольника на местности:
0 = (0, 0),
(x, 0),
(0, y),
(x, y)
Векторы сторон:
m1 = 0 -> (x, 0) = (x - 0, 0 - 0) = (x, 0)
n1 = 0 -> (0, y) = (0 - 0, y - 0) = (0, y)
Вектор искомой точки выразим через два числа a и b и векторы сторон:
x = p1 ^ a1 * p2 ^ a2 * ... * p_k ^ a_k
t = (a1 + 1) * (a2 + 1) * (a_k + 1) // number of divisors
a1 = 0 => a1 + 1 = 1
x = 9
x = 3 ^ 2
divisors = { 1, 3, 9 }
t = (2+1) is prime
x = 60
Пушистость – крайне полезное качество, особенно если его развить до высокой степени.
Например, если ваша пушистость хотя бы 0.5 Агр., то есть примерно как у вербы, то
окружающие уже захотят потрогать вас, погладить, а то и накормить чем-нибудь
вкусненьким. А если пушистость приближается к одной целой Агриппине, то вы сможете
тыгыдыкать по льду Байкала без штанов, вас будут охотно брать в экспедиции за сокровищами,
а ещё можно получить работу помощника писательницы (потому что вы будете очень милым),
а это уже полпути к известности! Если же у вас не хватает для этого природной пушистости,
то подружитесь с кем-то с хорошей шёрсткой и всюду берите его с собой, так вы сможете
тоже пользоваться преимуществами этого качества.
@h0tk3y
h0tk3y / RemoveKDigits.java
Created February 5, 2025 18:11
Remove k digits - shortened
public static String removeKdigits(String num, int k) {
Deque<Character> resultDeque = new ArrayDeque<>();
resultDeque.add(num.charAt(0));
for (int i = 1; i < num.length(); ++i) {
var nextChar = num.charAt(i);
while (k > 0 && !resultDeque.isEmpty() && resultDeque.peekLast() > nextChar) { //Возвращаемся на символ назад
resultDeque.removeLast();
k--;
}
resultDeque.add(nextChar);
@h0tk3y
h0tk3y / Snow.kt
Created September 16, 2024 13:32
fun main() {
val n = readln().toInt()
val input = readln().split(" ").map { it.toInt() }
val result = solve(input)
if (result == null) {
println("NO")
} else {
println("YES")
println(result.joinToString(" "))
@h0tk3y
h0tk3y / 00-README.md
Last active July 4, 2024 16:00
DCL IDE experiment

Experimenting with DCL support in Android Studio

This set of patches shows some experiments in Android Studio to add features in the DCL support. It is based on the approach of directly converting DCL PSI elements to the DCL language tree and using that as an input to the Gradle analysis implementation. Therefore, it does not need to run the Gradle parser on the source text at all.

@h0tk3y
h0tk3y / 00-README.md
Last active July 2, 2024 10:44
AGP DCL support experimental changes

Experiment using AGP as a DCL model

Changes

Trimmed string navigation problem

You are given a multiline string $source$ – the content of a source file, and two numbers $startLine$ and $endLine$ such that $0 \le startLine \le endLine &lt; nLines$ where $nLines$ is the number of lines in $source$.

Trimming

You need to produce the resulting string $result$ such that:

  • It does not have any content from the $source$ lines whose zero-based line numbers $i &lt; startLine$ or $i &gt; endLine$.
  • It contains the lines at indices $i$ such that $startLine \le i \le endLine$, transformed by trimming the longest