Posts in category “Tips”

Quick Tip: Get GitHub PR Diffs Easily

Need to share changes from a GitHub PR (even closed ones)? Just add .diff or .patch to the PR URL:

Original URL:

https://github.com/owner/repo/pull/123

For diff format:

https://github.com/owner/repo/pull/123.diff

For patch format:

https://github.com/owner/repo/pull/123.patch

Both work for open, closed, or merged PRs. Perfect for code reviews, investigations, or sharing changes with others.

For LLM/AI analysis: Use .diff format - it's cleaner and more standardized than .patch which includes extra email headers.

Fix Rider WinForms Designer Build Locks

Problem

Rider's WinForms Designer locks files, preventing builds. It is super annoying!

Solution

  1. File → Settings (Ctrl+Alt+S)
  2. Tools → Windows Forms Designer
  3. Uncheck "Enable Windows Forms Designer"
  4. Apply and restart Rider

Emergency Fix

Kill locked processes:

taskkill /IM dotnet.exe /F

Alternative

Use Visual Studio for form design, Rider for code.

WiFi Driver Fix for Mid-2010 MacBook Pro on Pop!_OS 22.04

# Remove conflicting B43 driver
sudo apt remove firmware-b43-installer

# Install Broadcom wireless driver
sudo apt install bcmwl-kernel-source

# Reset wireless modules
sudo modprobe -r b43 ssb wl
sudo modprobe wl

Troubleshooting

  • If WiFi doesn't work, reboot your system
  • Ensure you have the latest system updates

Note: This method resolves WiFi issues for my mid-2010 MacBook Pro. By the way, this driver has very good performance! I love this solution!!!

Windows Server 2022 RDP Connection Fix

Problem

  • Our IT security team has weird security setup, which successfully prevented the RDP client from remembering the password, and also caused the following annoying issue

    • RDP connection requires clicking "More choices" → "Use a different account" every time
    • Username not remembered despite saving in RDP file

Solution

Edit your .rdp file with these key settings:

full address:s:your-server-address, such as xetawsdev85.xemt.dev 
domain:s:XEMT 
username:s:your-username, such as David.Wei 
enablecredsspsupport:i:0

Key Points

  1. Separate domain and username - don't use XEMT\David.Wei format in RDP file
  2. Set authentication level:i:2 - forces proper authentication (this step has been proved not necessory)
  3. Disable CredSSP support - enablecredsspsupport:i:0 is essential (tested, this is the KEY option!)
  4. If you see a certificate warning on first connection - check "Don't ask me again"

Result

Username will be pre-filled correctly, only password entry required.

Fixing Claude Code (1.0.51/1.0.45) in Git Bash

1.0.72 works well among all my terminals in Windows and Linux without any hacks. So please forget the fix in this article and try 1.0.72!
for version 1.0.51 or newer, you can simply add a new environment variable with CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\git\bin\bash.exe using Edit environment variables for your account feature on windows.

However, I stick with v1.0.45 for now, as I noticed 1.0.51 no longer support paste image in gitbash, which is a pity!

I just noticed this hack only works with version 1.0.45, so please stick with version 1.0.45 for now until we found another hack :D

Claude Code fails in Git Bash with path errors like:

Error: /usr/bin/bash: line 1: C:UsersDavid.WeiAppDataLocalTemp/claude-shell-snapshot-6ea5: No such file or directory

Root cause: os.tmpdir() returns Windows paths, Git Bash expects Unix paths.

Solution: Patch the CLI directly with sed.

# Create ~/bin/c
#!/bin/bash
REAL_CLAUDE=$(which claude)
basedir=$(dirname "$REAL_CLAUDE")
case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*)
        if command -v cygpath > /dev/null 2>&1; then
            basedir=`cygpath -w "$basedir"`
        fi
    ;;
esac

CLAUDE_DIR="$basedir/node_modules/@anthropic-ai/claude-code"
CLI_FILE="$CLAUDE_DIR/cli.js"
BACKUP_FILE="$CLI_FILE.original"

# Backup once
if [ ! -f "$BACKUP_FILE" ]; then
    cp "$CLI_FILE" "$BACKUP_FILE"
fi

# Patch and run
cp "$BACKUP_FILE" "$CLI_FILE"
sed -i 's/\b\w\+\.tmpdir()/\"\/tmp\"/g' "$CLI_FILE"

cd "$CLAUDE_DIR"
exec node "cli.js" "$@"
chmod +x ~/bin/c
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

Now works:

c doctor
c --version  

The regex catches minified variable names. Patches fresh every run, so updates don't break it.