Skip to content

Instantly share code, notes, and snippets.

View wolfhong's full-sized avatar

wolfhong wolfhong

  • ShenZhen, China
View GitHub Profile
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@wolfhong
wolfhong / demo_using_proxy.py
Created August 4, 2018 17:02
使用代理服务器进行网络请求的例子
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
proxy data:
http://cn-proxy.com/
http://cn-proxy.com/archives/218
'''
from __future__ import unicode_literals
import os
import requests
@wolfhong
wolfhong / progress.py
Created June 6, 2018 06:46 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# 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:
#
@wolfhong
wolfhong / demo_phonenumbers.py
Created May 15, 2018 13:21
一个demo,演示python-phonenumbers库如何提取电话的。电话号码的格式需要指定是哪个国家。
# pip install phonenumbers
import phonenumbers
text = """
非常紧急转告:被告**,户籍地址:山东***室 。济南律师事务所郑重告知:因你恶意拖欠佰仟金融公司的贷款,我所已经将你“涉嫌贷款诈骗罪”的相关材料已递交到公安局。请保持手机24小时处于待机状态,接受当地公安24小时内随时传唤或询问。原告律师-张良 办公室:0531-8235 0561 手机:15753145942 电话这几天打遍所有联系人 和单位。 结果 让济南的朋友 在 电信局 通过熟人 查到 0531-8235 0561 是济南德盈律师事务所的,还冒充济南律师事务所。
鉴于此事严重性,速加qq 291906768 或者 微信
是这样的,12月1号01095595电话邀请账单分期提额到10万,上个月我自己做了个分期,分期后还款3000多,可是我错就错在当天全额还上了,可是昨天光大银行的催收部门给我打电话,说我上个月没有还款,然后晚上就致电4008111333,确认已经产生滞纳金,于是我当即就还上了,请问卡友们,像这样的情况,三个月后我还能申请临时额度提高吗?以前申请可是从来没有拒绝过"
你也可以试试下面的电话号码会不会被解析到。如果使用*号,就不会被识别到。空格和-号都还好。
"182--6008--6180",
"1826 00 86180",
@wolfhong
wolfhong / demo_pyfiglet.txt
Created May 15, 2018 12:07
pyfiglet的所有字体显示"demo text"的效果,所有的字体文件在pyfiglet/fonts可以查看到。
1943____
------------------------------
#### ### # # ### # # ### # # ### # #
#### ### # # ### # # ### # # ### # #
#### ### # # ### # # ### # # ### # #
# ## ## #### #### ### # # ### # # ## #### ### # # ### # #
## ## ## ## #### ### # # ### # # ## ## ### # # ### # #
## ### ### #### #### ### # # ### # # ### #### ### # # ### # #
# ## ## ## #### ### # # ### # # ## ## ### # # ### # #
## ## ## ## #### ### # # ### # # ## ## ### # # ### # #
@wolfhong
wolfhong / ugly_code.py
Last active May 5, 2018 10:26
代码示例,非常丑陋的代码,需要使用autopep8、yapf等工具来格式化。
import math, sys;
def example1():
####This is a long comment. This should be wrapped to fit within 72 characters.
some_tuple=( 1,2, 3,'a' );
some_variable={'long':'Long code lines should be wrapped within 79 characters.',
'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'],
'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1,
20,300,40000,500000000,60000000000000000]}}
return (some_tuple, some_variable)
@wolfhong
wolfhong / katalon_output_demo1.py
Created May 3, 2018 14:17
示例:使用katalon recorder录制操作:打开百度首页,搜索初音未来,点开百度百科词条。
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class Baidu(unittest.TestCase):
@wolfhong
wolfhong / send_email.py
Last active May 3, 2018 13:26
send_email.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
brief 发送邮件,不依赖第三方库. py2
"""
import socket
import smtplib
import mimetypes
import email