Skip to content

Instantly share code, notes, and snippets.

View SeniorZhai's full-sized avatar
🏠
Working from home

SeniorZhai SeniorZhai

🏠
Working from home
View GitHub Profile
#!/bin/bash
#Modify this with your IP range
MY_IP_RANGE="192\.168\.1"
#You usually wouldn't have to modify this
PORT_BASE=5555
#List the devices on the screen for your viewing pleasure
adb devices
@SeniorZhai
SeniorZhai / ResourceUtils.java
Last active August 29, 2015 14:05
Resource管理工具
public class ResourceUtils {
public static String getFileFromAssets(Context context,String fileName) {
if(context == null || TextUtils.isEmpty(fileName)) {
return null;
}
StringBuilder s = new StringBuilder("");
try {
InputStreamReader in = new InputStreamReader(context.getResources().getAssets().open(fileName));
@SeniorZhai
SeniorZhai / SerializeUtils.java
Last active August 29, 2015 14:05
Serialize管理工具类
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class SerializeUtils {
public static Object deserialization(String filePath) {
ObjectInputStream in = null;
@SeniorZhai
SeniorZhai / PackageUtils.java
Created September 2, 2014 02:30
Package、Shell管理工具
public class PackageUtils {
public static final String TAG = "PackageUtils";
public static final int APP_INSTALL_AUTO = 0;
public static final int APP_INSTALL_INTERNAL = 1;
public static final int APP_INSTALL_EXTERNAL = 2;
public static final int install(Context context,String filePath) {
if (PackageUtils.isSystemApplication(context) || ShellUtils.RootPermission()) {
return installSilent(context,filePath);
@SeniorZhai
SeniorZhai / CacheUtils.java
Created September 2, 2014 03:05
Cache工具类
public class CacheUtils {
// 获取文件目录
public static File getFileDirectory(Context context) {
File appCacheDir = null;
if(appCacheDir == null) {
appCacheDir = context.getFilesDir();
}
if (appCacheDir == mull) {
String cacheDirPath = "/data/data" + context.getPackageName() + "/files/";
appCacheDir = new File(cacheDirPath);
@SeniorZhai
SeniorZhai / CommonUtils.java
Created September 2, 2014 03:18
通用工具类
public class CommonUtils {
private static NetworkInfo getNetworkInfo(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetWorkInfo();
}
// 是否存在网络
public static boolean isNetworkAvailable(Context context) {
NetworkInfo info = getNetworkInfo(context);
import java.lang.ref.WeakReference;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.widget.TextView;
public final class JumpingBeans {
/**
* The default fraction of the whole animation time spent actually animating.
@SeniorZhai
SeniorZhai / git-pip.py
Created October 10, 2014 07:03
pypi安装文件
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# an entire copy of pip.
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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