Skip to content

Instantly share code, notes, and snippets.

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

Lilong Zhang and2long

🏠
Working from home
View GitHub Profile
@and2long
and2long / rename_files.py
Created January 12, 2022 06:06
重命名当前文件夹下的所有文件。
import os
import sys
# 重命名当前文件夹下的所有文件。
path = os.path.dirname(os.path.realpath(__file__))
print(path)
onlyfiles = [
f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and not f.startswith(".")
]
@and2long
and2long / python-formatting-blackArgs.json
Created September 6, 2021 03:34
python black config.
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--skip-string-normalization"
]
@and2long
and2long / ddbjson-to-json.py
Last active May 19, 2023 01:47
将 DynamoDB json 数据转换成普通 json 数据。
from boto3.dynamodb.types import TypeDeserializer, TypeSerializer
def from_dynamodb_to_json(item):
d = TypeDeserializer()
return {k: d.deserialize(value=v) for k, v in item.items()}
@and2long
and2long / ddb-get-item.py
Last active January 10, 2022 05:00
DDB获取一条数据
import json
import boto3
session = boto3.Session(profile_name="PROFILE NAME")
ddb_client = session.client("dynamodb")
table_name = 'Main-nhdgaeyblfgp3gygkcsjpmxvky-dev'
challenge_id = '0df3b39d-acb6-4fc9-a3cd-eebf29c8b958'
response = ddb_client.get_item(
@and2long
and2long / settings.json
Created July 16, 2020 07:25
yapf格式化配置
{
"python.formatting.provider": "yapf",
"python.formatting.yapfArgs": [
"--style",
"{column_limit: 200}"
],
}
@and2long
and2long / uninstall_apps.sh
Last active August 19, 2023 01:52
(安卓)一键卸载第三方程序脚本。
string=$(adb devices | egrep ".*device$")
devices=(${string//device/})
echo "检测到${#devices[@]}台设备连接"
for ((i = 0; i < ${#devices[*]}; i++)); do
echo "$(($i + 1)). ${devices[i]} : $(adb -s ${devices[i]} shell getprop ro.product.model)"
done
if [ ${#devices[@]} -gt 0 ]; then
echo "输入要操作的设备编号:"
read num
@and2long
and2long / next_video.sh
Last active July 26, 2020 05:00
(安卓)自动滑动视频。
findDevices() {
string=$(adb devices | egrep ".*device$")
if [ $? -eq 0 ]; then
devices=(${string//device/})
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "$time 检测到${#devices[*]}台设备"
for d in ${devices[@]}; do
echo "$d : $(adb -s $d shell getprop ro.product.model)"
done
return ${#devices[*]}
@and2long
and2long / next_video.py
Last active July 26, 2020 05:01
(安卓)自动滑动视频。
import re, os, sys, time, datetime
class AutoScroll(object):
def __init__(self):
self.devices = []
self.count = 0
def find_devices(self):
data = os.popen("adb devices").readlines()
"""
Amazon Gift Card
官网网页测试地址:
https://s3.amazonaws.com/AGCOD/htmlSDKv2/htmlSDKv2_NAEUFE/index.html
可对参数进行逐一对照。
官网API文档:
Amazon Gift Card Incentives API:https://developer.amazon.com/zh/docs/incentives-api/incentives-api.html
"""
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied. See the License for the specific