Skip to content

Instantly share code, notes, and snippets.

View zhuifengshen's full-sized avatar
:octocat:
玩悟尚志!

Devin zhuifengshen

:octocat:
玩悟尚志!
  • YouMi
  • Guangzhou
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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
@zhuifengshen
zhuifengshen / PreventRaisingAnException.py
Last active November 15, 2018 08:51
Decorate func with this to prevent raising an Exception when an error is encountered
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:
@zhuifengshen
zhuifengshen / check_attr.py
Created November 15, 2018 08:50
Decorate method with this to check whether the object has an attribute with the given name.
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)
@zhuifengshen
zhuifengshen / recursion_sum.py
Created November 22, 2018 08:00
列表递归求和
def sum(lst):
if lst == []:
return 0
return lst[0] + sum(lst[1:])
@zhuifengshen
zhuifengshen / recursion_max.py
Last active February 20, 2019 07:40
列表递归获取最大值
# 实现一
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
@zhuifengshen
zhuifengshen / recursion_count.py
Created November 22, 2018 08:12
列表递归获取个数
def count(lst):
if lst == []:
retrun 0
else:
return 1 + count(lst[1:])
@zhuifengshen
zhuifengshen / quicksort.py
Created November 27, 2018 02:54
快速排序算法
实现一:
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)
实现二:
@zhuifengshen
zhuifengshen / selectsort.py
Created December 3, 2018 17:42
选择排序算法
# 实现一
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]
@zhuifengshen
zhuifengshen / ACL4SSR-Helps.md
Created January 13, 2023 03:17 — forked from Teraflopst/ACL4SSR-Helps.md
本文主要是教你怎么定制一下自己的ACL或者clash规则。

1. 前言

本文主要是教你怎么定制一下自己的ACL或者clash规则。

前面稍微科普一下去广告的分类、不作为重点。

本文不能顾及全网的规则,仅做一般普及,需要有点基础,非小白科普文章