Skip to content

Instantly share code, notes, and snippets.

View zmwangx's full-sized avatar
🐍
Pythonista learning new technologies

Zhiming Wang zmwangx

🐍
Pythonista learning new technologies
View GitHub Profile
@zmwangx
zmwangx / getgoogler.py
Created November 15, 2019 10:25
googler installation script (working copy)
#!/usr/bin/env python3
import builtins
import collections
import hashlib
import os
import pathlib
import shutil
import subprocess
import sys
@zmwangx
zmwangx / _m.weibo.cn.md
Created April 19, 2019 09:10 — forked from momo0v0/_m.weibo.cn.md
m.weibo.cn API
@zmwangx
zmwangx / read_keypress_with_timeout.py
Last active February 21, 2022 23:02
Python: cross-platform code to read keypress with a timeout. Good for "press any key to continue" with an expiration timer.
import os
import time
from typing import Optional
if os.name == "posix":
import select
import sys
import termios
import tty
@zmwangx
zmwangx / urlgrep
Created December 27, 2018 19:43
Python script to extract URLs from HTML documents.
#!/usr/bin/env python3
"""Extract URLs from HTML documents."""
import argparse
import re
import sys
import urllib.parse
import bs4
@zmwangx
zmwangx / pythonista-ytdl.py
Created December 7, 2018 01:10
Share sheet extension to download YouTube videos and save them to apps of your choice, powered by youtube-dl and Pythonista
import contextlib
import logging
import os
import shutil
import sys
import tempfile
import appex
import console
import youtube_dl
@zmwangx
zmwangx / fonts.reg
Created October 20, 2018 17:19
How to make Chinese filenames not so ugly in Windows 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Segoe UI (TrueType)"="-segoeui.ttf"
"Segoe UI Black (TrueType)"="-seguibl.ttf"
"Segoe UI Black Italic (TrueType)"="-seguibli.ttf"
"Segoe UI Bold (TrueType)"="-segoeuib.ttf"
"Segoe UI Bold Italic (TrueType)"="-segoeuiz.ttf"
"Segoe UI Emoji (TrueType)"="-seguiemj.ttf"
"Segoe UI Historic (TrueType)"="-seguihis.ttf"
@zmwangx
zmwangx / .gitignore
Last active July 22, 2018 22:23
Trivial program to reload apache without root
/a2graceful
@zmwangx
zmwangx / client.py
Last active January 23, 2021 15:28
Python requests.iter_content with timeout
#!/usr/bin/env python3
import sys
import eventlet
eventlet.monkey_patch(socket=True)
from eventlet.timeout import Timeout
import requests
#!/usr/bin/env zsh
# macOS 10.13.2.
setopt xtrace errexit
ROOTDIR=$PWD/python-benchmark
brew install python2 python3 llvm llvm@4 llvm@3.9
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>&#105;&#110;&#115;&#116;&#97;&#108;&#108;&#46;&#49;</title>
<style type="text/css">
body {
text-align: center;
}