Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #2

Open
wants to merge 176 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
4e56de8
fix bug
jumploop Mar 21, 2021
9c0cfa0
adapt python3
jumploop Mar 21, 2021
f604b45
fix bug
jumploop Mar 21, 2021
0919e01
modify code
jumploop Mar 21, 2021
41899be
add new file to chrome directory
jumploop Mar 21, 2021
cbe9462
Merge pull request #1 from jumploop/dev
jumploop Mar 21, 2021
f672a27
update coroutine
jumploop Mar 21, 2021
0d4a466
adapt python3
jumploop Mar 22, 2021
9a5a82e
test
jumploop Mar 22, 2021
b65c1be
adapt python3
jumploop Mar 22, 2021
b064738
adapt python3
jumploop Mar 22, 2021
fb1d4e0
adapt python3
jumploop Mar 22, 2021
fcae80a
adapt python3
jumploop Mar 22, 2021
3fa64a9
adapt python3
jumploop Mar 22, 2021
10abe65
add ssh
jumploop Mar 22, 2021
64f9986
add curl
jumploop Mar 22, 2021
275cdeb
adapt python3
jumploop Mar 22, 2021
96202f3
bug fix
jumploop Mar 22, 2021
733f469
bug fix
jumploop Mar 22, 2021
237ac9d
adapt python3
jumploop Mar 22, 2021
d3b7f7e
bug fix
jumploop Mar 22, 2021
8e323c4
bug fix
jumploop Mar 22, 2021
61153ae
Merge pull request #2 from jumploop/dev
jumploop Mar 23, 2021
bb1d4e1
get host ip from socket
jumploop Apr 15, 2021
582c9cf
Merge pull request #3 from jumploop/dev
jumploop Apr 15, 2021
8192ed5
用subprocess执行命令
jumploop Apr 16, 2021
0747e9b
用subprocess执行命令
jumploop Apr 16, 2021
34ef692
用subprocess执行命令
jumploop Apr 16, 2021
62e7b37
Merge remote-tracking branch 'origin/dev' into dev
jumploop Apr 16, 2021
3615c64
用subprocess执行命令
jumploop Apr 16, 2021
eda9940
Merge branch 'dev' of https://github.com/jumploop/collection_python i…
jumploop Apr 16, 2021
2a7e7aa
Merge pull request #4 from jumploop/dev
jumploop Apr 16, 2021
8b80aa7
excel文件操作
jumploop Apr 21, 2021
4b54804
发送邮件
jumploop Apr 21, 2021
2217dcc
excel操作
jumploop Apr 23, 2021
86e54a2
excel操作
jumploop Apr 24, 2021
489bca9
adapt python3
jumploop Apr 26, 2021
2652b86
Merge pull request #5 from jumploop/dev
jumploop Apr 26, 2021
3f01773
装饰器
jumploop May 2, 2021
595fc97
Merge pull request #6 from jumploop/dev
jumploop May 2, 2021
27e4c9a
用 Python 自动生成 Excel 数据报表
jumploop May 3, 2021
b169ecd
format code
jumploop May 4, 2021
25854a5
带进度条的下载器
jumploop May 4, 2021
d5e6bb2
Python数据可视化
jumploop May 4, 2021
e3a7548
脚本简单合并Youtube下载的视频和音频文件
jumploop May 4, 2021
d8aaeba
文字水印
jumploop May 4, 2021
8943ee9
图片水印
jumploop May 5, 2021
5d94b50
修改变量名
jumploop May 5, 2021
dd5431c
监控目录变化
jumploop May 9, 2021
a01efa8
zip压缩包密码破解
jumploop May 9, 2021
22bb9b8
Python处理Excel的脚本
jumploop May 9, 2021
756d999
Schedule周期任务调度工具
jumploop May 14, 2021
f871484
update
jumploop May 15, 2021
1039282
Merge pull request #7 from jumploop/dev
jumploop May 15, 2021
ca84de7
入门Pandas不可不知的技巧
jumploop May 16, 2021
3835861
adapt python3
jumploop May 23, 2021
b13b70d
fix bud
jumploop Jun 6, 2021
7b6415b
last friday
jumploop Jun 6, 2021
0718734
计算当前月份的日期范围
jumploop Jun 6, 2021
46cbd2e
计算当前月份的日期范围
jumploop Jun 6, 2021
06f4517
update .gitignore file
jumploop Jun 10, 2021
ec543c7
tempfile的使用
jumploop Jun 10, 2021
84921ce
Python GUI之tkinter创建主窗口及Label部件
jumploop Jun 13, 2021
8fc6989
Python GUI之tkinter
jumploop Jun 13, 2021
0c68ae0
递归统计一个目录下所有视频文件的总时长
jumploop Jun 17, 2021
f63cda3
使用 ffmpeg 截取视频片段并且重新拼接
jumploop Jun 17, 2021
7faf6de
用来测试接口的 flask server
jumploop Jun 17, 2021
a1090e6
dict
jumploop Jun 17, 2021
405f696
手机远程控制电脑
jumploop Jun 19, 2021
b62bff4
手机远程控制电脑
jumploop Jun 19, 2021
46317ec
打印ASCII字母表、数字、标点符号
jumploop Jul 10, 2021
45b5ae2
简单的pandas数据处理
jumploop Jul 11, 2021
82d003c
add find file script
jumploop Aug 4, 2021
0f3a080
Merge pull request #8 from jumploop/dev
jumploop Aug 4, 2021
b2a3eab
Create LICENSE
jumploop Aug 4, 2021
34012a5
Merge pull request #9 from jumploop/add-license-1
jumploop Aug 4, 2021
9725348
combinations
jumploop Aug 4, 2021
ea73df4
random_string_generator
jumploop Aug 4, 2021
9b1c8b0
palindrome
jumploop Aug 4, 2021
c9e0950
华氏温度转换为摄氏温度
jumploop Aug 23, 2021
82da954
华氏温度转换为摄氏温度
jumploop Aug 23, 2021
588865c
判断是否为闰年
jumploop Aug 23, 2021
41b5dee
最小公倍数和最大公约数
jumploop Aug 23, 2021
e8b1b4d
无聊程序
jumploop Sep 4, 2021
eb2de26
将视频转Gif
jumploop Oct 5, 2021
f66f18d
Merge pull request #10 from jumploop/dev
jumploop Nov 21, 2021
db1585f
add lazy_find.sh
jumploop Nov 21, 2021
327c80c
format code
jumploop Dec 9, 2021
c251534
Pack the zip file
jumploop Feb 26, 2022
263e232
Merge pull request #11 from jumploop/dev
jumploop Feb 26, 2022
45c47b4
adapt python3
jumploop Feb 27, 2022
20ff20c
make tar file
jumploop Feb 27, 2022
22a1589
单例模式
jumploop Mar 3, 2022
f67393e
迭代器
jumploop Apr 9, 2022
0f50637
解决python2下json反序列化后是unicode的问题
jumploop Apr 9, 2022
53e61e2
python2下Unicode转str
jumploop Apr 10, 2022
a8d1844
代码优化
jumploop Apr 10, 2022
6b0d282
增加文档字符串
jumploop Apr 10, 2022
91cb18d
处理pylint问题
jumploop Apr 10, 2022
1657d39
解决Python 2下的json.loads()导致的unicode编码问题
jumploop Apr 10, 2022
cacd921
itertools库的简单使用
jumploop Apr 10, 2022
ea52b3b
itertools库的简单使用
jumploop Apr 10, 2022
fdb4802
itertools模块的简单使用
jumploop Apr 10, 2022
98595e2
可自定义属性的装饰器
jumploop Apr 13, 2022
b70a79e
Merge pull request #12 from jumploop/dev
jumploop Apr 13, 2022
0f97b4e
datetime.now替换datetime.today
jumploop Apr 14, 2022
01ddac1
添加函数文档字符串
jumploop Apr 15, 2022
5875c7f
argparse的简单使用
jumploop Apr 17, 2022
08da3ef
寻找水仙花数
jumploop Apr 19, 2022
446265e
Flask SQLAlchemy demo
jumploop May 3, 2022
ad8a911
Flask SQLAlchemy students
jumploop May 3, 2022
cbafc8a
办公自动化
jumploop Nov 12, 2022
9b3ba44
生成虚假数据
jumploop Nov 13, 2022
5e2bb85
生成虚假数据
jumploop Nov 13, 2022
4176e54
双色球选号
jumploop Nov 22, 2022
a6299ba
双色球和大乐透选号
jumploop Nov 22, 2022
d55e027
双色球和大乐透选号numpy版本
jumploop Jan 30, 2023
eddc633
双色球和大乐透选号不可以有重复的
jumploop Jan 31, 2023
1ad7409
删除目录中的指定文件并带回滚功能
jumploop Feb 20, 2023
9d19223
VPS测试脚本,方便你更好地了解你的服务器
jumploop Mar 7, 2023
3d3168c
使用 try/while/for 中 else 分支
jumploop Mar 17, 2023
b7b0080
满足您所有开发需求的简短Python代码段
jumploop Apr 15, 2023
7d038a8
simple log
jumploop May 10, 2023
0d130a6
Log output to console and log files
jumploop May 10, 2023
232efa4
supports backup and rollback for deleting files
jumploop May 17, 2023
962b00a
Build a simple anonymous rsync server
jumploop Jul 31, 2023
a6ba4c9
Build a simple anonymous rsync server
jumploop Jul 31, 2023
0bff58b
modify rsync shell
jumploop Aug 2, 2023
6c8d1f5
lottery procedure
jumploop Aug 8, 2023
60ae3d7
解密字符串
jumploop Aug 22, 2023
191bec8
check url
jumploop Aug 29, 2023
33d6abc
word sort
jumploop Sep 7, 2023
498f293
File change monitoring
jumploop Sep 17, 2023
c91f662
modify watching
jumploop Sep 17, 2023
9edd3fe
pyinotify simple demo
jumploop Sep 17, 2023
0daeabf
modify watching.py
jumploop Sep 17, 2023
08a8055
add new file
jumploop Sep 17, 2023
42fb8e7
modify simple.py
jumploop Sep 17, 2023
4041f40
update watching.py
jumploop Sep 18, 2023
e9f8070
test execute time
jumploop Sep 23, 2023
ad7c57d
Caching results
jumploop Sep 23, 2023
c3ef8db
valid data
jumploop Sep 24, 2023
60a4317
log results
jumploop Sep 24, 2023
eecce5b
suppress errors
jumploop Sep 24, 2023
57e885d
validate output
jumploop Sep 24, 2023
f876da6
Retry execution
jumploop Sep 28, 2023
2ca65c1
visualize results
jumploop Sep 28, 2023
5f33e55
visualize results
jumploop Sep 28, 2023
2791351
debug
jumploop Sep 28, 2023
b929bf7
deprecated function
jumploop Sep 28, 2023
05a56b6
bin to dump
jumploop Oct 14, 2023
f6bef99
output square
jumploop Oct 17, 2023
e10ad65
output square
jumploop Oct 17, 2023
4480cff
output trapezoid
jumploop Oct 17, 2023
09dcb26
output trapezoid
jumploop Oct 17, 2023
f007f3a
add .sh suffix
jumploop Oct 19, 2023
6024631
add .sh suffix
jumploop Oct 19, 2023
516cb27
Isosceles trapezoid
jumploop Oct 19, 2023
7c9c271
Merge branch 'PegasusWang:master' into dev
jumploop Oct 26, 2023
ac26bb4
This is a script for nginx proxy health check
jumploop Oct 26, 2023
d32d623
Merge remote-tracking branch 'origin/dev' into dev
jumploop Oct 26, 2023
3a16b6e
manage lv
jumploop Oct 26, 2023
af31db0
manage lv
jumploop Oct 26, 2023
5a82af5
manage lv
jumploop Oct 26, 2023
ad5dce7
lv client
jumploop Oct 26, 2023
7e59cb7
监控日志
jumploop Nov 23, 2023
5f86a4f
inotify rsync file
jumploop Dec 5, 2023
abaccdd
number to ip
jumploop Dec 6, 2023
454273a
ip to binary
jumploop Dec 6, 2023
a31bb9f
ip to number
jumploop Dec 6, 2023
3baba0c
ip to number and num to ip
jumploop Dec 20, 2023
944bf20
monitor disk space
jumploop Feb 28, 2024
4aa3f00
download chrome driver
jumploop Mar 4, 2024
ef48e28
add logger and demo
jumploop Mar 6, 2024
6b32132
add logger and demo
jumploop Mar 18, 2024
a57c035
优化代码
jumploop May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ _templates/*
__pycache__/
.cache
.python-version
venv/*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 一叶知秋

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
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions Schedule/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time

import schedule


def job():
print("I'm working...")


# 每十分钟执行任务
schedule.every(10).minutes.do(job)
# 每个小时执行任务
schedule.every().hour.do(job)
# 每天的10:30执行任务
schedule.every().day.at("10:30").do(job)
# 每个月执行任务
schedule.every().monday.do(job)
# 每个星期三的13:15分执行任务
schedule.every().wednesday.at("13:15").do(job)
# 每分钟的第17秒执行任务
schedule.every().minute.at(":17").do(job)
# 每10秒执行任务
schedule.every(10).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
44 changes: 44 additions & 0 deletions Schedule/demo10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import functools

import schedule

"""
Schedule 不会自动捕捉异常,它遇到异常会直接抛出,这会导致一个严重的问题:后续所有的作业都会被中断执行,因此我们需要捕捉到这些异常。
"""


def catch_exceptions(cancel_on_failure=False):
def catch_exceptions_decorator(job_func):
@functools.wraps(job_func)
def wrapper(*args, **kwargs):
try:
return job_func(*args, **kwargs)
except:
import traceback
print(traceback.format_exc())
if cancel_on_failure:
return schedule.CancelJob

return wrapper

return catch_exceptions_decorator


@catch_exceptions(cancel_on_failure=True)
def bad_task():
return 1 / 0

@catch_exceptions(cancel_on_failure=True)
def job():
print("i'm working...")


schedule.every(5).seconds.do(bad_task)
schedule.every(7).seconds.do(job)

while True:
schedule.run_pending()
20 changes: 20 additions & 0 deletions Schedule/demo2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import schedule

"""
只运行一次任务
"""


def job_that_executes_once():
print('i\'m working...')
# 此处编写的任务只会执行一次...
return schedule.CancelJob


schedule.every().day.at('22:30').do(job_that_executes_once)
while True:
schedule.run_pending()
time.sleep(1)
33 changes: 33 additions & 0 deletions Schedule/demo3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import schedule

"""
获取目前所有的作业
取消所有作业
"""

def greet(name):
print('Hello', name)


def hello():
print('Hello world')


# do() 将额外的参数传递给job函数
schedule.every(2).seconds.do(greet, 'Alice')
schedule.every(4).seconds.do(greet, 'Bob')
schedule.every(6).seconds.do(greet, name='jack')

schedule.every().second.do(hello)
# 获取目前所有的作业
all_jobs = schedule.get_jobs()
print(all_jobs)
# 取消所有作业
schedule.clear()

while True:
schedule.run_pending()
time.sleep(1)
30 changes: 30 additions & 0 deletions Schedule/demo4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time

import schedule

"""
标签功能
"""


def greet(name):
print('Hello {}'.format(name))


# .tag 打标签
schedule.every().day.do(greet, 'Andrea').tag('daily-tasks', 'friend')
schedule.every().hour.do(greet, 'John').tag('hourly-tasks', 'friend')
schedule.every().hour.do(greet, 'Monica').tag('hourly-tasks', 'customer')
schedule.every().day.do(greet, 'Derek').tag('daily-tasks', 'guest')

# get_jobs(标签):可以获取所有该标签的任务
friends = schedule.get_jobs('friend')

# 取消所有 daily-tasks 标签的任务
schedule.clear('daily-tasks')

while True:
schedule.run_pending()
time.sleep(1)
32 changes: 32 additions & 0 deletions Schedule/demo5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta, time
import schedule

"""
设定作业截止时间
"""


def job():
print('Boo')


# 每个小时运行作业,18:30后停止
schedule.every(1).hours.until('18:30').do(job)

# 每个小时运行作业,2030-01-01 18:33 today
schedule.every(1).hours.until('2030-01-01 18:33').do(job)

# 每个小时运行作业,8个小时后停止
schedule.every(1).hours.until(timedelta(hours=8)).do(job)

# 每个小时运行作业,11:32:42后停止
schedule.every(1).hours.until(time(11,32,42)).do(job)

# 每个小时运行作业,2020-5-17 11:36:20后停止
schedule.every(1).hours.until(datetime(2020, 5, 17, 11, 36, 20)).do(job)

# 截止日期之后,该作业将无法运行。
while True:
schedule.run_pending()
23 changes: 23 additions & 0 deletions Schedule/demo6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import schedule

"""
立即运行所有作业,而不管其安排如何
"""


def job_1():
print('Foo')


def job_2():
print('Bar')


schedule.every().monday.at("12:40").do(job_1)
schedule.every().tuesday.at("16:40").do(job_2)

schedule.run_all()
# 立即运行所有作业,每次作业间隔10秒
schedule.run_all(delay_seconds=10)
16 changes: 16 additions & 0 deletions Schedule/demo7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from schedule import every,run_pending,repeat

"""
装饰器安排作业
"""
# 此装饰器效果等同于 schedule.every(10).minutes.do(job)
@repeat(every(10).minutes)
def job():
print("I am a scheduled job")

while True:
run_pending()
time.sleep(1)
30 changes: 30 additions & 0 deletions Schedule/demo8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
import schedule
"""
并行执行

默认情况下,Schedule 按顺序执行所有作业。其背后的原因是,很难找到让每个人都高兴的并行执行模型。

不过你可以通过多线程的形式来运行每个作业以解决此限制:
"""
def job1():
print("I'm running on threads %s" % threading.current_thread())
def job2():
print("I'm running on threads %s" % threading.current_thread())
def job3():
print("I'm running on threads %s" % threading.current_thread())

def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()

schedule.every(10).seconds.do(run_threaded, job1)
schedule.every(10).seconds.do(run_threaded, job2)
schedule.every(10).seconds.do(run_threaded, job3)

while True:
schedule.run_pending()
time.sleep(1)
21 changes: 21 additions & 0 deletions Schedule/demo9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import schedule
"""
日志记录
"""
logging.basicConfig()
schedule_logger = logging.getLogger('schedule')
# 日志级别为DEBUG
schedule_logger.setLevel(level=logging.DEBUG)


def job():
print("Hello, Logs")


schedule.every().second.do(job)
schedule.run_all()

schedule.clear()
12 changes: 12 additions & 0 deletions YouTubesphb/YouTube 音视频合并.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off
title YouTube ����Ƶ�ϲ� 20140127
echo ���ߣ�Crexyer
echo ��վ��http://www.crexyer.com/
echo.
set /p audio=�뽫����Ƶ���ļ���ק���˴������»س�ȷ�ϣ�
set /p video=�뽫����Ƶ���ļ���ק���˴������»س�ȷ�ϣ�
ffmpeg.exe -i %audio% -i %video% -acodec copy -vcodec copy output.mp4
echo.
echo �ϲ�������
echo �ļ��Ѿ���������ص� output.mp4 �ļ���
pause
Binary file added YouTubesphb/ffmpeg.exe
Binary file not shown.
9 changes: 7 additions & 2 deletions algorithm_datastructure/dict_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class ObjectDict(dict):
"""from tornado.util.ObjectDict, access dict by dot"""

def __getattr__(self, key):
try:
return self[key]
Expand All @@ -16,7 +17,6 @@ def __setattr__(self, key, value):

import collections


class TransformedDict(collections.MutableMapping):
"""A dictionary that applies an arbitrary key-altering
function before accessing the keys"""
Expand All @@ -43,10 +43,12 @@ def __len__(self):
def __keytransform__(self, key):
return key


# pip install fronzendict

class FronzenDict(TransformedDict):
"""immutable dict, init by a dict"""

def __init__(self, d):
self.store = d

Expand All @@ -57,4 +59,7 @@ def __setitem__(self, key, value):

# since python3.3, you can use immutable dict
import types
d_proxy = types.MappingProxyType(d) # can add new key/value by assignment but can not assign key alrady exists

d = {1: 'hello', 2: 'world'}
d_proxy = types.MappingProxyType(d) # can add new key/value by assignment but can not assign key alrady exists
print(d_proxy)
Loading