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 / 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
@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 / 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"
@shaobin0604
shaobin0604 / android-aar-maven-local.sh
Created June 14, 2019 06:05 — forked from mpurbo/android-aar-maven-local.sh
Installing Facebook SDK as aar to local maven repository
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
cd facebook-android-sdk-3.14
gradle facebook:build
mv facebook/build/libs/facebook.aar facebook/build/libs/facebook-3.14.aar
mvn install:install-file -Dfile=facebook/build/libs/facebook-3.14.aar -DgroupId=com.facebook -DartifactId=android-sdk -Dversion=3.14 -Dpackaging=aar
@shaobin0604
shaobin0604 / README-Template.md
Created August 31, 2018 03:46 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@shaobin0604
shaobin0604 / gist:f35faae7b9a32587e8bf
Created March 9, 2016 01:28 — forked from aisk/gist:3735854
百度地图坐标与像素互相转换的方法
pixelToPoint = function(point, zoom, center, bounds) {
// 像素到坐标
if (!point) {
return
}
var zoomUnits = getZoomUnits(zoom);
var mercatorLng = center.lng + zoomUnits * (point.x - bounds.width / 2);
var mercatorLat = center.lat - zoomUnits * (point.y - bounds.height / 2);
var mercatorLngLat = {lng: mercatorLng, lat: mercatorLat};
return mercatorToLngLat(mercatorLngLat)
@shaobin0604
shaobin0604 / Android Studio .gitignore
Created October 15, 2015 03:18 — forked from iainconnor/Android Studio .gitignore
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files