本文主要是教你怎么定制一下自己的ACL或者clash规则。
前面稍微科普一下去广告的分类、不作为重点。
本文不能顾及全网的规则,仅做一般普及,需要有点基础,非小白科普文章
#!/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 |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.4' | |
} | |
} | |
apply plugin: 'android' |
def prevent(func): | |
""" | |
Decorate func with this to prevent raising an Exception when an error is encountered | |
""" | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
try: | |
return func(*args, **kwargs) | |
except BaseException: |
def check(attr): | |
def decorator(method): | |
""" | |
Decorate method with this to check whether the object has an attribute with the given name. | |
""" | |
@wraps(method) | |
def wrapper(self, *args, **kwargs): | |
if hasattr(self, attr): | |
return method(self, *args, **kwargs) |
def sum(lst): | |
if lst == []: | |
return 0 | |
return lst[0] + sum(lst[1:]) |
# 实现一 | |
def maxer(lst): | |
if len(lst) == 0: | |
return None | |
if len(lst) == 1: | |
return lst[0] | |
else: | |
sub_max = maxer(lst[1:]) | |
return lst[0] if lst[0] > sub_max else sub_max |
def count(lst): | |
if lst == []: | |
retrun 0 | |
else: | |
return 1 + count(lst[1:]) |
实现一: | |
def quicksort(data): | |
if len(data) < 2: | |
return data | |
pivot = data[1] | |
less = [i for i in data[1:] if i <= pivot] | |
greater = [i for i in data[1:] if i > pivot] | |
return quicksort(less) + pivot + quicksort(greater) | |
实现二: |
# 实现一 | |
def selectionSort(arr): | |
for i in range(len(arr) - 1): | |
tmp = i | |
for j in range(i+1, len(arr)): | |
if arr[tmp] > arr[j]: | |
tmp = j | |
if i != tmp: | |
arr[i], arr[tmp] = arr[tmp], arr[i] | |