Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
shaobin0604 / Polynomial.java
Created December 5, 2022 03:18 — forked from derlin/Polynomial.java
a polynomial class for java implementing the basic operations +, -, /, *, compose and integrate.
// see http://introcs.cs.princeton.edu/java/92symbolic/Polynomial.java.html
public class Polynomial{
private int[] coef; // coefficients
private int deg; // degree of polynomial (0 for the zero polynomial)
// a * x^b
public Polynomial( int a, int b ){
coef = new int[ b + 1 ];
@shaobin0604
shaobin0604 / SlimScreenRecordTabFragment.java
Last active November 9, 2022 07:01
Mix Video with vocal audio and music audio using ffmpeg
package com.arthenica.ffmpegkit.test;
import static com.arthenica.ffmpegkit.test.MainActivity.TAG;
import static com.arthenica.ffmpegkit.test.MainActivity.notNull;
import android.os.Bundle;
import android.os.Environment;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
@shaobin0604
shaobin0604 / iframe-probe.py
Created July 7, 2022 09:39 — forked from ragnraok/iframe-probe.py
Shows GOP structure for video file using ffmpeg --show-frames output
#!/usr/bin/env python
#
# Shows GOP structure of video file. Useful for checking suitability for HLS and DASH packaging.
# Example:
#
# $ iframe-probe.py myvideo.mp4
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
/*
* Copyright (C) 2014 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#Sun May 12 15:08:17 ICT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-5.1.1-all.zip
@shaobin0604
shaobin0604 / TextDelegateHack.java
Created May 9, 2020 05:03
lottie text delegate
import com.airbnb.lottie.TextDelegate;
import org.joor.Reflect;
import java.util.Map;
public class TextDelegateHack {
private Reflect mTextDelegateRef;
@shaobin0604
shaobin0604 / AnimateCounter.java
Created April 29, 2020 09:21 — forked from bmarrdev/AnimateCounter.java
AnimateCounter provides ability to animate the counting of numbers using the builtin Android Interpolator animation functionality.
/*
* Copyright (C) 2015 Hooked On Play
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@shaobin0604
shaobin0604 / popup_animation.xml
Created April 29, 2020 08:53
游戏计次次数变化动画
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillBefore="true"
android:interpolator="@android:interpolator/linear"
android:shareInterpolator="true">
<alpha
android:duration="250"
android:fromAlpha="0.0"
android:startOffset="0"
@shaobin0604
shaobin0604 / buildRawMediaSource.java
Last active April 16, 2020 17:05
exoplayer play video files in resource/raw
private MediaSource buildRawMediaSource() throws RawResourceDataSource.RawResourceDataSourceException {
RawResourceDataSource rawDataSource = new RawResourceDataSource(this);
// open the /raw resource file
rawDataSource.open(new DataSpec(RawResourceDataSource.buildRawResourceUri(R.raw.test11_rotate_270)));
return new ProgressiveMediaSource.Factory(new DefaultDataSourceFactory(this, "ExoTest")).createMediaSource(rawDataSource.getUri());
}
@shaobin0604
shaobin0604 / git-hist
Created March 27, 2020 02:43 — forked from isaldin/git-hist
git hist alias
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"