Skip to content

Instantly share code, notes, and snippets.

View lexrus's full-sized avatar
🏠
Working from home

Lex Tang lexrus

🏠
Working from home
View GitHub Profile
@lexrus
lexrus / available-on-testflight.md
Last active August 7, 2026 06:31
[Animated SVG] Avaiable on TestFlight Badge

Available on TestFlight — animated badge

The concept for this badge comes from a X post by Nob Nukui(https://x.com/nobtaka/status/2084928872152539163)

This animated SVG source code was generated with Grok 4.5. You are free to use this SVG however you like. No attribution is necessary. If you have a moment, I'd appreciate it if you could drop a like on the original post to show your support.

Thanks.

@lexrus
lexrus / patch_pencil_headless.py
Created July 28, 2026 04:47
Patch for the pen.dev CLI (@pen.dev/cli) headless mode: fixes the "Base URI must be absolute" bug so headless export of .pen files with image resources works without launching the desktop app. By Lex (https://lex.sh). Generated by GLM-5.2.
#!/usr/bin/env python3
"""
Patch the Pencil CLI (pen.dev, @pen.dev/cli) so its headless mode can render
`.pen` files that reference image resources — without launching the Pencil
desktop app.
WHY THIS FILE EXISTS
--------------------
The Pencil CLI can export designs two ways: by driving the running desktop app
(`pencil interactive --app desktop`), or fully headless (`pencil interactive
@lexrus
lexrus / AI_007_prompt.en.txt
Last active July 9, 2026 03:13
AI 通宵干活 prompt
__This is the requirements section, please replace it yourself__
Above are the requirements, below are the decision-making requirements:
- I'm going to sleep now, all product and technical decisions are under your control, I'll come to review the results tomorrow morning
- I'll sleep for about 8 hours, so don't rush to produce results, take your time with all the details, don't save tokens, getting it right is most important
- When you encounter uncertainties, first check the documentation in context7, if still uncertain, search online
- Execute all subtasks in phases, run unit tests after each phase is completed, to avoid having to start over after completing everything only to find it doesn't work
- Don't get hung up on the UI part, try to use mainstream conventional approaches, I'll polish the details tomorrow, you just focus on getting the functionality working
@lexrus
lexrus / disable_all_animation.sh
Created August 1, 2014 06:05
Disable all animations of OS X.
# opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# showing and hiding sheets, resizing preference windows, zooming windows
# float 0 doesn't work
defaults write -g NSWindowResizeTime -float 0.001
@lexrus
lexrus / glm
Last active October 21, 2025 05:19
/usr/local/bin/glm
#!/bin/bash
export ANTHROPIC_AUTH_TOKEN=___REPLACE_ME_WITH_YOUR_ZAI_API_KEY___
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export API_TIMEOUT_MS=3000000
export ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-4.5-air
export ANTHROPIC_DEFAULT_SONNET_MODEL=glm-4.6
export ANTHROPIC_DEFAULT_OPUS_MODEL=glm-4.6
$HOME/.claude/local/claude --dangerously-skip-permissions
@lexrus
lexrus / ss_startup.sh
Last active September 18, 2025 02:51
ss_startup.sh
#!/bin/sh
#
# This startup script initializes a Shadowsocks server in Debian 11.
# It's compatible with DigitalOcean, Linode and Vultr.
#
# Author: @lexrus https://github.com/lexrus
#
# Get $100 free credit for VPS with my referral links:
# DigitalOcean: https://m.do.co/c/3eb5cf371fc9
# Linode: https://www.linode.com/lp/refer/?r=9f144941e797d495a10c2841c3137ce1acde5f15
@lexrus
lexrus / doss.sh
Last active June 2, 2024 15:24
A tiny script to initialize a new Shadowsocks server in DigitalOcean.
#!/bin/bash
#
# This macOS bash script helps you initialize a new Shadowsocks server with doctl in seconds.
# Original author: lexrus https://github.com/lexrus
#
# You can get $100 free credit for create VPS in DigitalOcean with my referral link:
# https://m.do.co/c/3eb5cf371fc9
#
# Please intall and authorize doctl before running this script.
# https://github.com/digitalocean/doctl
@lexrus
lexrus / delete_all_imessage_conversations.applescript
Last active January 26, 2024 16:12
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
# System Preferences -> Accessibility -> Display -> Reduce motion
tell application "Messages" to activate
tell application "Messages"
set chatCount to (count of chats)
end tell
tell application "System Events"
tell process "Messages"
@lexrus
lexrus / ForkWeeklyReport.sh
Last active November 28, 2023 09:58
Fork custom command which export weekly report of current git user.
cd $path
DATE=`date -v-6d +"%Y-%m-%d"`
AUTHOR=`git config user.name`
LOG=`git log --branches --pretty=format:"\n%ad: %s" --date=short --after=$DATE --author="$AUTHOR"`
CHANGES=`git log --branches --date=short --after=$DATE --author="$AUTHOR" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "本周贡献代码: +%s行, -%s行, 总行数: %s\n", add, subs, loc }' -`
WEEKSTART=`date -v"monday" +"%-m月%d"`
TODAY=`date +"%-m月%d"`
REPORT="【周报】$WEEKSTART ~ $TODAY \n\n$CHANGES\n$LOG\n"
@lexrus
lexrus / RxTextFieldDelegateProxy.swift
Created February 14, 2018 03:33
RxSwift extension for textFieldShouldReturn of UITextFieldDelegate
//
// RxTextFieldDelegateProxy.swift
//
// Created by Lex Tang on 2/14/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxSwift
import RxCocoa