Skip to content

Instantly share code, notes, and snippets.

View leiweibo's full-sized avatar
🎯
Focusing

Weibo leiweibo

🎯
Focusing
  • Hangzhou, Zhejiang, China
View GitHub Profile
function main() {
echo "start to check chrome driver ..."
chromedriver -v
if [ $? -eq 0 ]; then
echo "chromedriver is install"
else
echo "chrome driver not install yet."
if [ "$(uname)"=="Linux" ]; then
echo "You are using linux."
elif [ "$(uname)" == "Darwin" ]; then
@leiweibo
leiweibo / fundspider.py
Created September 9, 2019 10:30
测试基金的历史净值是否正确
# coding:utf-8
import scrapy
from fundspider.items import FundspiderItem, FundNetValueItem
import json
import re
from datetime import datetime
from bs4 import BeautifulSoup
import numpy as np
import logging
@JAction(ai = DemoInterceptor.class)
public class DemoActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onDestroy() {
public static class DemoInterceptor implements Interceptor {
@Override
public boolean check(final Context context, final Intent intent) {
// do what you like, make sure if go to next activity or just stay here.
return true;
}
@Override
public boolean check() {
@leiweibo
leiweibo / CustomContext.java
Created December 2, 2015 14:56
the overrided startActivity method
public boolean startActivity(Context context, Intent intent) {
try {
String className = intent.getComponent().getClassName();
if (className.endsWith("_")) {
className = className.substring(0, className.length() - 1);
}
Class<?> c = Class.forName(className);
Action ac = c.getAnnotation(Action.class);
if (ac == null) {
Log.d(TAG, className + "start activity without annotation");
public interface Interceptor {
public boolean check(Context context, Intent intent);
public boolean check();
public class Stub implements Interceptor {
@Override
public boolean check() {
return false;
@Retention(RetentionPolicy.RUNTIME)
public @interface Action {
Class<?> ai();
}