Skip to content

Instantly share code, notes, and snippets.

View stefanJi's full-sized avatar
🎯
Focusing

Yang Ji stefanJi

🎯
Focusing
View GitHub Profile
@stefanJi
stefanJi / Videojs-Play.html
Last active July 21, 2022 13:08
VideoJs controlBar demo
<div>
<video width=450 height=300 class="video-js vjs-default-skin vjs-big-play-centered">
<source src="http://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" type="application/x-mpegURL" />
</video>
</div>
<hr />
<div>
<video width=450 height=300 class="video-js vjs-default-skin vjs-big-play-centered">
<source src="http://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" type="application/x-mpegURL" />
</video>
@stefanJi
stefanJi / wave_card.dart
Last active February 26, 2022 08:33
flutter wave card example
import 'package:flutter/widgets.dart';
class WaveCard extends StatelessWidget {
WaveCard({Key key, padding: EdgeInsets}) : super(key: key);
@override
Widget build(BuildContext context) {
final painter = WavePainter(Color.fromRGBO(96, 204, 184, 0.2));
return CustomPaint(
painter: painter,
@stefanJi
stefanJi / mp3Toaac.sh
Last active May 7, 2019 07:19
mp3 to aac
# install ffmpeg with aac model in mac
# brew tap varenc/ffmpeg
# brew tap-pin varenc/ffmpeg
# brew options ffmpeg
# brew install ffmpeg --with-fdk-aac --HEAD
# Useage: ./mp3Toaac.sh path-mp3-audios-dir/
# will cover all mp3 audios to aac audio.
echo "$1"
@stefanJi
stefanJi / subtract_collections.kt
Last active May 17, 2019 02:43
Kotlin 两个集合的差集
/**
* Returns a list of all the elements that are not included in this collection and that are not included in the specified collection.
*/
public fun <T> Iterable<T>.subtractX(other: Iterable<T>): List<T> {
return filterNot { other.contains(it) } + other.filterNot { contains(it) }
}
@stefanJi
stefanJi / interval_progressbar_usage.dart
Last active June 9, 2019 14:59
interval progress bar usage
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [10, 29, 18, 27, 16, 15, 24, 3, 20, 10]
.map<Widget>((i) {
return Padding(
padding: EdgeInsets.only(right: 10),
child: IntervalProgressBar(
direction: IntervalProgressDirection.vertical,
max: 30,
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;
@stefanJi
stefanJi / pausable_coroutines_dispatcher.kt
Created June 26, 2019 07:06
pausable dispatcher for kotlin coroutines
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)) {

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@stefanJi
stefanJi / android_dump_java_heap.sh
Last active October 22, 2019 08:10 — forked from LanderlYoung/android_dump_java_heap.sh
script to dump android java heap and convert use hprof-conv
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"
@stefanJi
stefanJi / steps.txt
Created October 26, 2019 02:50
为博客配置使用 acme 协议的 SSL 证书
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;