docker日志清理

sudo truncate -s 0  /var/lib/docker/containers/420f0b682e656a5aa3a8e56507c8ec9abde66474a5d6dfd68a4aa4477a3860f1/420f0b682e656a5aa3a8e56507c8ec9abde66474a5d6dfd68a4aa4477a3860f1-json.log

linux 修改时间

  1. date命令:查看当前时间

  2. date -s 完整日期时间(YYYY-MM-DD hh:mm[:ss]):修改日期、时间

注意时间要加引号

3.hwclock -w
将时间写入bios避免重启失效。

gitlab报500问题修复

Enter the DB console:

For Omnibus GitLab packages:

sudo gitlab-rails dbconsole

Reset CI/CD variables

Drop the table:

DELETE FROM ci_group_variables;
DELETE FROM ci_variables;

Reset Runner registration tokens

-- Clear project tokens
UPDATE projects SET runners_token = null, runners_token_encrypted = null;
-- Clear group tokens
UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
-- Clear instance tokens
UPDATE application_settings SET runners_registration_token_encrypted = null;
-- Clear runner tokens
UPDATE ci_runners SET token = null, token_encrypted = null;

Reset pending pipeline jobs

-- Clear build tokens
UPDATE ci_builds SET token = null, token_encrypted = null;

更新配置
gitlab-ctl reconfigure

ADB 指令

停止应用

adb shell am force-stop ${applicationId}

打开设置

adb shell am start -a android.settings.SETTINGS

拉取文件

adb pull /sdcard/xxx/ .

打开应用

adb shell am start -n "${applicationId}/${带包名的Activity}" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

拉取系统日志

adb logcat > log.txt

卸载应用并保留数据

adb shell pm uninstall -k ${包名}

替换安装

adb install -r ${文件路径}

相关链接

玩转ADB命令(ADB命令使用大全)

jetpack 获取NavController的3种方式

jetpack里建议ui用fragment组建,但是不像传统的方式自行管理fragment的示例,采用和activity类似的思想,托管给框架,注册给nav.xml,通过NavController来控制fragment,主要是控制跳转。

navigation有2种依赖包
– 基本

    implementation "android.arch.navigation:navigation-fragment:1.0.0-alpha07"
    implementation "android.arch.navigation:navigation-ui:1.0.0-alpha07"
  • KTX
    implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
    implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"

获取方式也自然分2种

  • 基本

通过activity获取
Navigation.java

public static NavController findNavController(@NonNull Activity activity, @IdRes int viewId) 

通过view获取
Navigation.java

public static NavController findNavController(@NonNull View view)

通过Fragment获取
NavHostFragment.java

public static NavController findNavController(@NonNull Fragment fragment)
– KTX

通过activity获取

fun Activity.findNavController(@IdRes viewId: Int): NavController

通过view获取

fun View.findNavController(): NavController

通过Fragment获取

fun Fragment.findNavController(): NavController