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 / LICENSE
Last active October 23, 2017 12:36
apt-mirror mirror list and generation script for deb.nodesource.com
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@zmwangx
zmwangx / content.js
Created October 21, 2017 21:17
NoMostVisited: a failed attempt to remove the most visited grid from Chrome's new tab page while preserving everything else (Chrome 61 onward)
function removeMostVisited () {
var mostVisitedElem = document.getElementById('most-visited')
if (mostVisitedElem) {
mostVisitedElem.style.visibility = 'hidden'
}
}
if (document.readyState === 'complete') {
removeMostVisited()
} else {
@zmwangx
zmwangx / matplotlib-SongtiSC.patch
Created October 8, 2017 17:43
matplotlib patch for using Songti SC (from Songti.ttc) on macOS
diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py
index 9602db7..1ddec34 100644
--- a/lib/matplotlib/font_manager.py
+++ b/lib/matplotlib/font_manager.py
@@ -66,7 +66,7 @@ except ImportError:
from backports.functools_lru_cache import lru_cache
-USE_FONTCONFIG = False
+USE_FONTCONFIG = True
@zmwangx
zmwangx / cross-repo-embedded-code-snippets.md
Last active February 28, 2023 18:48
GitHub feature request: cross-repo embedded code snippets

Hi,

I really like the embedded code snippets feature introduced last month,[1] but I just realized it doesn't work across repositories. Take this comment[2] as an example: currently, a snippet permalink into Linuxbrew/homebrew-core[3] is turned into an embedded snippet, but a snippet permalink into Linuxbrew/brew[4] is not. It would be really nice if cross-repo links are also converted. It would be beneficial to the Homebrew project for instance, where the package manager itself is developed in Homebrew/brew, the package definitions are developed in separate repos (what we call taps) like Homebrew/homebrew-core, and there are quite a bit of cross references between brew and taps. Thank you.

Best, Zhiming

[1] https://github.com/blog/2415-introducing-embedded-code-snippets
[2] https://github.com/Linuxbrew/homebrew-core/issues/4198#issuecomment-331113613
[3] https://github.com/Linuxbrew/homebrew-core/blob/59b343a86689531bc59702e376654821f766b1c8/Formula/glibc.rb#L16-L31

#!/usr/bin/env zsh
typeset -a langcode
langcode=(
Chinese zh
Spanish es
English en
Hindi hi
Arabic ar
Portuguese pt
@zmwangx
zmwangx / qq-music-merge-album
Created September 20, 2017 09:52
Merge all tracks of an album on QQMusic into a single file.
#!/usr/bin/env python3
# Merge all tracks of an album on QQMusic into a single file.
#
# Sometimes QQMusic may not follow its own naming rules. You need to
# make hard links with the correct filenames in those cases.
import argparse
import bs4
import json
@zmwangx
zmwangx / locatedisk
Created September 19, 2017 09:14
Locate disk device id by volume name (macOS).
#!/usr/bin/env python3
import argparse
import plistlib
import subprocess
import sys
LOGICAL = 0
PHYSICAL = 1
#!/usr/bin/env python3
# Extract emojis from Weibo intl. 2.6.7.ipa.
#
# Unpack the ipa, navigate to Payload/WeiboOverseas.app, then run this script
# from there. The emojis will be extracted into the emojis/ subdir, as well as
# a JSON registry registry.json.
import collections
import json
#!/usr/bin/env python3
# Requires Python 3.6+.
import argparse
import os
import pathlib
import shlex
import shutil
import sqlite3