Skip to content

Instantly share code, notes, and snippets.

@j796160836
j796160836 / download_docker_images.sh
Last active December 27, 2023 07:44
download all docker images from list
#!/bin/bash
docker_images=(
"nginx:latest"
)
for image in "${docker_images[@]}"; do
echo "Downloading $image ..."
echo
image_name=${image##*/}
@j796160836
j796160836 / Tree.kt
Last active December 11, 2022 13:46
Tree.kt
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.drawscope.DrawScope
@j796160836
j796160836 / ffmpeg_mkv_mp4_conversion.md
Last active January 31, 2022 01:03 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@j796160836
j796160836 / DelegateDispatcher.md
Created September 24, 2019 17:56
DelegateDispatcher

DelegateDispatcher

Create an interface to receive delegate callback and dispatch to muitpule observer instances.

Usage

For example, we create an delegate called MyClassDelegate.

protocol MyClassDelegate {
@j796160836
j796160836 / RemoveWin10PreInstallApps.ps1
Created August 7, 2019 03:34
Remove Win10 unused pre installed apps (Run it with Windows PowerShell (Admin))
# Run with Windows PowerShell (Admin)
# https://www.thewindowsclub.com/remove-built-windows-10-apps-users-using-powershell-script
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *getstarted* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
@j796160836
j796160836 / Gatekeeper_issue.md
Last active December 3, 2018 15:38
Gatekeeper issue.md

[LockedApp] can’t be opened because it is from an unidentified developer. Your security preferences allow installation of only apps from the App Store and identified developers.

This is actually a macOS Gatekeeper issue try these steps:

To resolute Gatekeeper issues on macOS Sierra you might have to partially or completely disable Gatekeeper checks.

Option I For a certain application run in Terminal:

用 ADB 切換語言

Method 1

$ adb shell "setprop persist.sys.language zh; setprop persist.sys.country TW; setprop ctl.restart zygote"

Method 2

@j796160836
j796160836 / adbTopMostActivity.sh
Created September 25, 2018 23:48
Get the top most activity from adb command
#!/bin/bash
devices=`adb devices | awk '{if(NR>1)print $1}'`
for device in $devices ; do
model=`adb -s $device shell getprop ro.product.model`
echo
echo '=== '$model' ('$device') ==='
adb -s $device shell dumpsys activity top | grep ACTIVITY
done
@j796160836
j796160836 / copyToProject.py
Created January 30, 2018 09:12
Copy illustrator CC output images to your Android project.
#!/usr/bin/env python
# encoding: utf-8
# ## copyToProject.py
# Copy illustrator CC output images to your Android project.
# ### How to use:
# 1. Put this script at the illustrator CC output folder
# 2. Edit `projectPath` and `targetPrefix` for your want
# For example, we have these files: