git clone https://github.com/jenv/jenv.git ~/.jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
sudo apt install openjdk-11-jdk
jenv add /usr/lib/jvm/java-11-openjdk-amd64/
jenv global 11.0.16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.View | |
import android.view.ViewGroup | |
import androidx.core.view.ViewCompat | |
import androidx.viewpager.widget.ViewPager | |
import androidx.viewpager.widget.ViewPagerUtils | |
import com.google.android.material.bottomsheet.BottomSheetBehavior | |
import java.lang.ref.WeakReference | |
import java.lang.reflect.Field | |
private val nestedScrollingChildRef: Field = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These critical programs are missing or too old: compiler | |
# upgrade make | |
```bash | |
#到 http://ftp.gnu.org/pub/gnu/make/ 查找最新安装包 | |
wget http://ftp.gnu.org/pub/gnu/make/make-4.3.tar.gz | |
tar -zxvf make-4.3.tar.gz | |
cd make-4.3 | |
./configure --prefix=/usr | |
type make | |
make check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webview.evaluateJavascript( | |
"(function(){document.documentElement.style.overflow='visible';}()", | |
null | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ktorHttpClient.post("xxxx") { | |
tryCompress(this, json) | |
} | |
private fun tryCompress(httpRequestBuilder: HttpRequestBuilder, json: JSONObject) { | |
val stringBody = tryCreateRequestBody(json = json) | |
if (stringBody.length > 4096) { | |
httpRequestBuilder.body = stringBody.gzipCompress() | |
httpRequestBuilder.headers[HttpHeaders.ContentEncoding] = "gzip" | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cn.ixiaochuan.frodo.api.moshi | |
import com.squareup.moshi.JsonAdapter | |
import com.squareup.moshi.JsonAdapter.Factory | |
import com.squareup.moshi.JsonDataException | |
import com.squareup.moshi.JsonReader | |
import com.squareup.moshi.JsonWriter | |
import com.squareup.moshi.Moshi | |
import com.squareup.moshi.Types | |
import org.json.JSONArray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* from my repo:https://github.com/Haoxiqiang/android-quick-reference | |
* In Idea's plugin, org.sqlite.JDBC won't auto registe. | |
* you should call any mehtod which make classloader load org.sqlite.JDBC | |
*/ | |
val classLoader = App.javaClass.classLoader | |
val resource: URL = classLoader.getResource("db/QuickRefDB.db")!! | |
val jdbcURL = "jdbc:sqlite::resource:${resource.toURI()}" | |
// try call org.sqlite.JDBC.<cinit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. change jenkins's config | |
vi /etc/sysconfig/jenkins | |
edit: | |
$JENKINS_USER="root" | |
2. change all files permisions | |
chown -R root:root /var/lib/jenkins | |
chown -R root:root /var/cache/jenkins | |
chown -R root:root /var/log/jenkins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffun View.traverseAdapterView() { | |
depthSearchViewGroup() | |
.forEach { viewGroup -> | |
clearAdapterReference(viewGroup) | |
} | |
} | |
fun View.depthSearchViewGroup(): MutableList<ViewGroup> { | |
val viewDeque = LinkedList<View>() | |
val viewGroups = mutableListOf<ViewGroup>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T : Any> mergeFields(from: T, to: T, acceptNULL: Boolean = false) { | |
from::class.java | |
.declaredFields | |
.forEach { field -> | |
val isLocked = field.isAccessible | |
field.isAccessible = true | |
val value = field.get(from) | |
if (acceptNULL || value != null) { | |
field.set(to, field.get(from)) | |
} |