Skip to content

Instantly share code, notes, and snippets.

@tiiime
tiiime / build.gradle
Created January 8, 2024 05:48
gradle task 输出 aar 依赖到 mrDebugDependencies.txt 文件,使用 parse_aar_activity.py 读取 mrDebugDependencies.txt,输出所有 activity 以及所在的 aar 文件。
// 放到 app/build.gradle 文件内
task showDeps {
doLast {
project.configurations.mrDebugRuntimeClasspath.each { File file ->
project.file('mrDebugDependencies.txt') << "${file.path} \n"
}
}
}
@tiiime
tiiime / fish_prompt.fish
Last active July 28, 2023 08:25
on-my-zsh ys theme like fish prompt
function fish_prompt -d "Write out the prompt"
printf '%s %s @ %s in %s [%s] \n%s ' (set_color blue)(echo \#) (set_color cyan)$USER(set_color normal) (set_color green)$hostname(set_color normal) \
(set_color yellow)(prompt_pwd)(set_color normal) \
(echo -n (date +%H:%M:%S)) \
(set_color red)(echo \$)(set_color normal)
end
@tiiime
tiiime / 微软拼音添加小鹤双拼.reg
Created September 10, 2022 02:57
Windows 装机配置
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\InputMethod\Settings\CHS]
"EnableExtraDomainType"=dword:00000001
"Enable Double Pinyin"=dword:00000001
"DoublePinyinScheme"=dword:0000000a
"UserDefinedDoublePinyinScheme0"="小鹤双拼*2*^*iuvdjhcwfg^xmlnpbksqszxkrltvyovt"
import re
import os
folder = os.getcwd()
count = 1
# count increase by 1 in each iteration
# iterate all files from a directory
for file_name in os.listdir(folder):
# Construct old file name
@tiiime
tiiime / README.md
Last active January 20, 2022 03:26
delegate set operate, run specify action

Usage

var drawGravity: Int by InvalidateDelegate(Gravity.LEFT)

private inner class InvalidateDelegate<T>(t: T) : SetActionDelegate<T>(t, {
    invalidate()
})
@tiiime
tiiime / Android 12 显示声明 exported 属性.md
Last active November 11, 2021 09:57
批量修改 android:exported,适配 Android 12 行为变更
$ curl -s "https://get.sdkman.io" | bash

$ source "~/.sdkman/bin/sdkman-init.sh"

$ sdk install kotlin

$ cd /path/to/your/project

$ wget exported.main.kts
@tiiime
tiiime / builder.kt
Created June 23, 2021 02:59
Kotlin property builder
package com.example.playground
class Builder {
val setName: PropertiesSetter<String, Builder> = PropertiesSetter(this)
val setAge: PropertiesSetter<Int, Builder> = PropertiesSetter(this)
fun build(){
setName.value
@tiiime
tiiime / FullscreenDialog.kt
Created March 18, 2021 10:11
fullscreen dialog
...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.FullScreenDialogTheme)
}
...
@tiiime
tiiime / adb-clear.sh
Last active December 22, 2020 08:03
clearn package
# Usage:
# adb-clear com.android.chrome
adb shell "run-as $1 sh -c \"pm clear $1\""
@tiiime
tiiime / logcat.sh
Created December 17, 2020 04:12
get current running app log
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-c)
adb logcat -c
shift
;;
*)
esac