Skip to content

Instantly share code, notes, and snippets.

@qzydustin
qzydustin / macOS-input-method-killer.sh
Last active January 3, 2025 06:22
Resolving macOS Chinese Input Lag Issue
#!/bin/sh
# This script aims to address the problem of input lag that can occur when using the Chinese input method on macOS.
# It provides a simple and effective solution by terminating the SCIM process, which is often the cause of the lag.
# To use the script, follow these steps:
# 1. Open the Terminal application (located in "Applications/Utilities/Terminal").
# 2. Copy and paste the script into the Terminal window.
# 3. Press Enter to execute the script.
@tintoy
tintoy / ssh_jump.py
Created April 27, 2018 02:45
SSH via jump-hosts using Paramiko
#!/usr/bin/env python3
import os
import paramiko
ssh_key_filename = os.getenv('HOME') + '/.ssh/id_rsa'
jumpbox_public_addr = '168.128.52.199'
jumpbox_private_addr = '10.0.5.10'
target_addr = '10.0.5.20'
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active March 23, 2026 06:55
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
# This is a simple wrapper for the "emcc" command from the emscripten compiler.
# Unlike the emscripten SDK script, it lets you specify the compiler version
# number. Just pass the version number using the "--version" flag and put the
# flags for "emcc" after the "--":
#
# python emcc_wrapper.py --version 1.27.0 -- -O3 -s NO_EXIT_RUNTIME=1 ...
#
import os
import sys
import pipes
# 一些闲置的 VPS 装了 COW,给我亲爱的小伙伴们科学上网,不定期更新。
# 偏爱 CLI 的可以安装 @cyfdecyf 的 COW: https://github.com/cyfdecyf/cow
# 喜欢用 GUI 的 Mac 用户可以用 @ohdarling 的 GoAgentX: https://github.com/ohdarling/GoAgentX
# 这是客户端配置文件。
# 如果用 COW,可以直接覆盖 ~/.cow/rc
# 系统 PAC 设置成: http://127.0.0.1:8833/pac
# 如果用 GoAgentX,加一个 COW Service,本地端口用 8833,在高级设置里把这个配置粘贴进去就可以了。
# 欢迎在 Twitter 上关注我 https://twitter.com/lexrus
@evansd
evansd / on_parent_exit.py
Created April 9, 2012 21:19
Ensure subprocesses exit when their parents die
"""
Utility (Linux only) to ensure subprocesses exit when their parents do by sending
a specified signal when the parent dies.
Usage:
subprocess.Popen(['some-executable'], preexec_fn=on_parent_exit('SIGHUP'))
"""
import signal