Skip to content

Instantly share code, notes, and snippets.

View dongweiming's full-sized avatar
:octocat:
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔

Weiming Dong dongweiming

:octocat:
🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔
View GitHub Profile
@dongweiming
dongweiming / .zshrc
Created November 27, 2019 09:07 — forked from SlexAxton/.zshrc
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@dongweiming
dongweiming / test.py
Created August 15, 2019 12:32
requests 中间件的写法
from requests import Session, Response
from requests.adapters import HTTPAdapter
class MiddlewareHTTPAdapter(HTTPAdapter):
def __init__(self, middlewares=None, *args, **kwargs):
self.middlewares = middlewares or []
super().__init__(*args, **kwargs)
def register(self, middleware):
@dongweiming
dongweiming / xiaoe.py
Created February 16, 2019 15:38
小鹅通新用户抽奖脚本
from datetime import datetime
from collections import defaultdict
from http.cookies import SimpleCookie
import requests
URL = 'https://admin.xiaoe-tech.com/new/customerList?is_pay=0&ruler=0&search=&page={page}'
cookie = SimpleCookie()
with open('cookie.txt') as f:
import sys
import antigravity
if sys.version_info < (3, 6):
print('Python 3.6+ is the future!')
exit()
def say(name: str) -> None:
print(f'Life is short, you need {name}!')
# coding=utf-8
# pip install zhihu_oauth python-dateutil
import os
import re
from datetime import datetime
from collections import defaultdict
import dateutil.parser
from zhihu_oauth import ZhihuClient
# coding=utf-8
import re
import ast
import time
from datetime import datetime
from collections import defaultdict
from http.cookies import SimpleCookie
import requests
from bs4 import BeautifulSoup
# coding=utf-8
# pip install zhihu_oauth python-dateutil
import os
import re
from datetime import datetime
from collections import defaultdict
import dateutil.parser
from zhihu_oauth import ZhihuClient
@dongweiming
dongweiming / send_message.py
Last active December 18, 2018 06:49
send_message.py
# coding=utf-8
# pip install zhihu_oauth
import os
import time
import json
@dongweiming
dongweiming / 0_urllib2.py
Last active December 18, 2018 06:49 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
# coding=utf-8
import json
import urllib2
from cookielib import CookieJar
hb_url = 'https://httpbin.org/basic-auth/user/pass'
req = urllib2.Request(hb_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@dongweiming
dongweiming / client.py
Last active April 15, 2017 07:26
知乎API爬虫
# coding=utf-8
import os
import json
import time
import requests
from requests.auth import AuthBase
from settings import LOGIN_URL, CAPTCHA_URL
from config import (
API_VERSION, APP_VERSION, APP_BUILD, UUID, UA, APP_ZA, CLIENT_ID,