Skip to content

Instantly share code, notes, and snippets.

@lkv1988
lkv1988 / fetch_some_cartoon.py
Last active December 3, 2022 10:14
cartoon_spider
import random
import threading
import time
import pathlib
import concurrent.futures
import requests
from typing import Optional, List
from lxml import etree
import config
@lkv1988
lkv1988 / df.py
Created November 30, 2022 09:51
DataFrame再过滤
df.query('column_name=="some_value") # new df
@lkv1988
lkv1988 / iphone_12_in_taobao.xml
Last active November 19, 2020 10:02
用DreamBox实现淘宝的产品卡片
<dbl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://db-xsd.oss-cn-beijing.aliyuncs.com/dbl.xsd">
<meta
ic_ip12="https://static.didialift.com/pinche/gift/resource/9uc9bip189-1605773441688-ic_ip12.png"
bg_red_small="https://static.didialift.com/pinche/gift/resource/9pds8nukfio-1605773441296-bg_red_small.png"
bg_red_bar="https://static.didialift.com/pinche/gift/resource/sh9qb8bo7do-1605773441013-bg_red_bar.png"
bg_orange="https://static.didialift.com/pinche/gift/resource/gnh6ug2clr-1605773440623-bg_orange.png"
/>
<render>
<image id="img_1" src="${ic_ip12}" width="110dp" height="110dp" leftToLeft="parent" topToTop="parent" marginLeft="5dp" marginTop="5dp"/>
<image src="${bg_orange}" width="0" leftToLeft="img_1" rightToRight="img_1" bottomToBottom="img_1" marginLeft="1dp" marginRight="1dp" marginBottom="1dp"/>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="aosp"
fetch=".."
review="https://android-review.googlesource.com/" />
<default revision="refs/tags/android-9.0.0_r47"
remote="aosp"
sync-j="4" />
@lkv1988
lkv1988 / OkHttpStack.java
Last active August 29, 2015 14:26 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@lkv1988
lkv1988 / AtLeastRecyclerView.java
Created June 17, 2015 11:06
InfinateViewPager and RecyclerIndicator
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class AtLeastRecyclerView extends RecyclerView {
public AtLeastRecyclerView(Context context) {
super(context);
}
@lkv1988
lkv1988 / ResourceTool.java
Created June 10, 2015 03:55
ResourceTool.java
public class ResourceTool {
public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableId, @ColorRes int colorId) {
Drawable drawable = res.getDrawable(drawableId);
int color = res.getColor(colorId);
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
return drawable;
}
public static Drawable getAlphaDrawable(Resources res, @DrawableRes int drawableId, @ColorRes int colorId) {
Bitmap bitmap = BitmapFactory.decodeResource(res, drawableId);
@lkv1988
lkv1988 / CopyInstalledAppActivity.java
Last active August 29, 2015 14:19
Get and copy installed package apk file
package com.github.airk.getinstalledapp;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.LoaderManager;
/*
* Copyright (C) 2014 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
@lkv1988
lkv1988 / CustomActionView.java
Created March 9, 2015 05:02
Add custom action view to MenuItem and response it
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.clear();
getMenuInflater().inflate(R.menu.menu_item, menu);
MenuItem item = menu.findItem(R.id.action_custom);
item.setActionView(R.layout.menu_custom);
item.getActionView().findViewById(android.R.id.text1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onCustomClick(v);