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 / self-hosted-gitlab-manually-confirm-user-email.md
Created June 7, 2024 12:50
Manually confirm user email with `gitlab-rails console`
  • Run gitlab-rails console;

  • Find the user:

    user = User.User.find_by_username('username')
  • Look at the list of emails and find the one you want to confirm:

@zmwangx
zmwangx / No longer able to make public gists secret.md
Last active June 2, 2025 13:45
No longer able to make public gists private β€” message to GitHub

We've been able to toggle visibility of gists since 2014 (https://github.com/blog/1837-change-the-visibility-of-your-gists), but I just noticed that I can no longer make public gists private. That is, when I edit private gists I still see the "Make Public" button, but not the other way round β€” there's only a "Delete" button when I edit public gists; the "Make Secret" which should be next to it (as shown in the screencast in the linked blog post) is nowhere to be found. I made a screenshot and a screencast demonstrating the issue, both of which are attached. Could you please confirm this issue? Was this an intentional change, and why? Thank you for your attention.

gist-unable-to-make-secret

![gist-unable-to-make-secret](https://cloud.githubusercontent.com/assets/4149852/16898407/c76db210-4c0b-11e6-9108-0450f1edebb4.gif)
@zmwangx
zmwangx / Postfix: sender-dependent SASL authentication.md
Last active May 26, 2025 11:34
Postfix: sender-dependent SASL authentication β€” relay to multiple SMTP hosts, or relay to the same host but authenticate as different users (e.g., two Gmail accounts)

This is a sequel to "Postfix: relay to authenticated SMTP".

I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.

As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):

/etc/postfix/main.cf:
    # sender-dependent sasl authentication
    smtp_sender_dependent_authentication = yes

sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

@zmwangx
zmwangx / mac-keys-unicode.md
Last active March 15, 2025 00:10
Unicode characters for special keys on the Mac keyboard (not necessarily Mac specific). #symbols

⌘ – ⌘ – ⌘ – the Command Key symbol
βŒ₯ – ⌥ – ⌥ – the Option Key symbol
⇧ – ⇧ – ⇧ – the Shift Key symbol
βŒƒ – ⌃ – ⌃ – the Control Key symbol
βŽ‹ – ⎋ – ⎋ – the ESC Key symbol
β‡ͺ – ⇪ – ⇪ – the Capslock symbol
⏎ – ⏎ – ⏎ – the Return symbol
⌫ – ⌫ – ⌫ – the Delete / Backspace symbol
β‡₯ – ⇥ – ⇥ – the Tab Key symbol

@zmwangx
zmwangx / launch-mutt.scpt
Created May 15, 2015 10:39
AppleScript example of creating a new iTerm2 window and execute a command.
#!/usr/bin/osascript
tell application "iTerm"
activate
create window with default profile
tell current window
tell current tab
tell current session
write text "mutt"
end tell
end tell
@zmwangx
zmwangx / # openssl@3 - 2024-11-18_20-49-53.txt
Created November 18, 2024 12:58
openssl@3 on macOS 12.7 - Homebrew build logs
Homebrew build logs for openssl@3 on macOS 12.7
Build date: 2024-11-18 20:49:53
@zmwangx
zmwangx / thumbnails.sh
Last active October 12, 2024 11:02
Script to generate thumbnails of a video and combine into one tile image. Uses FFmpeg and ImageMagick.
#!/bin/zsh
# Script to generate thumbnails of a video and combine into one tile image.
#
# CAUTION:
# FFprobe might fail to extract duration info from a MKV container. Use
# ffmpeg -i video.mkv -c:v copy -c:a copy video.mp4
# to swap to an MP4 container.
#
# Dependencies:
# 1. ffmpeg
@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 / python-dev-environment-on-chinese-vps.md
Last active August 15, 2024 17:07
Setting up sane Python dev environment on a Mainland China-based VPS (Alibaba Cloud).

Due to geoblocks and the half broken nature of Mainland China's Internet connection to the rest of the world, I need a VPS located in Mainland China with at least semi-decent and semi-reliable outbound conenction in order to do certain things, e.g., downloading videos from certain video hosting sites / content providers. Alibaba Cloud ECS is such a semi-reliable service; moreover, unlike other Chinese VPS providers, it accepts PayPal. At $8/mo it offers 1 core, 1 GB RAM, 40 GB non-SSD disk space, and 2 TB outbound traffic quota at 30 Mbps max. (Note that during free trial the bandwidth limit is 1 Mbps, which is very frustrating.) Not exactly the best deal (I'd rather sign up for a smaller plan like DO's $5 droplet, which by the way can be billed by hour, unlike Alibaba's $8/mo plan which is always billed monthly β€” their "Pay-As-You-Go" plans are much more expensive and completely sold out at the moment), but I won't call it a rip-off ei