~/.gitconfig
[includeIf "gitdir:/"]
path = .gitconfig_person
[includeIf "gitdir:~/work-a/"]
path = .gitconfig_work_a
| import java.net.Inet4Address | |
| import java.net.InetSocketAddress | |
| import java.net.Socket | |
| import java.nio.ByteBuffer | |
| import kotlin.random.Random | |
| fun main() { | |
| tlsHandshake() | |
| } |
| /** | |
| * <pre> | |
| * ClassFile { | |
| * u4 magic; | |
| * u2 minor_version; | |
| * u2 major_version; | |
| * u2 constant_pool_count; | |
| * cp_info constant_pool[constant_pool_count-1]; | |
| * u2 access_flags; | |
| * u2 this_class; |
~/.gitconfig
[includeIf "gitdir:/"]
path = .gitconfig_person
[includeIf "gitdir:~/work-a/"]
path = .gitconfig_work_a
| #!/bin/sh | |
| echo "Push source to repo" | |
| echo "Cur: `pwd`" | |
| cd ../source/_posts | |
| git add . | |
| git commit -m "feat: update or create post" | |
| git push | |
| cd ../../.deploy_git |
| # coding=utf-8 | |
| # | |
| # Usage: result = Differ(old_apk_path, new_apk_path).diff() | |
| # | |
| import os | |
| from argparse import ArgumentParser | |
| from zipfile import ZipFile | |
| KB = 1024.0 |
| acme.sh --issue -d blog.jiyang.site --webroot /home/jy/stefanji.github.io/ | |
| acme.sh --installcert -d blog.jiyang.site \ | |
| --key-file /home/jy/ssl/blog.jiyang.site.key \ | |
| --fullchain-file /home/jy/ssl/fullchain.cer | |
| ## nginx config | |
| server { | |
| listen 443 ssl http2; | |
| listen [::]:443 ssl http2; |
| ADB=${ANDROID_HOME}/platform-tools/adb | |
| HPROF_CONV=${ANDROID_HOME}/platform-tools/hprof-conv | |
| # customized functions | |
| # dump droid heap | |
| function droid_hd() { | |
| PACKAGE_NAME=$1 | |
| TIME=$(date +"%Y%m%d_%H%M%S") | |
| FILE_NAME="${PACKAGE_NAME}-${TIME}-heap.hprof" |
| import kotlinx.coroutines.* | |
| import java.util.concurrent.LinkedBlockingQueue | |
| import java.util.concurrent.atomic.AtomicInteger | |
| import kotlin.coroutines.CoroutineContext | |
| fun main() { | |
| val dispatcherMgr = PauseDispatcherMgr() | |
| GlobalScope.launch { | |
| withContext(dispatcherMgr.pausableDispatcher(Dispatchers.IO)) { |
| abstract class IntervalProgressPainter extends CustomPainter { | |
| final int max; | |
| final int progress; | |
| final int intervalSize; | |
| final Color highlightColor; | |
| final Color defaultColor; | |
| final Color intervalColor; | |
| final Color intervalHighlightColor; | |
| final double radius; |